Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
42392190
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
42392190
编写于
1月 05, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix terminal config tests
上级
d03cc545
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
69 addition
and
100 deletion
+69
-100
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
...h/parts/terminal/electron-browser/terminalConfigHelper.ts
+5
-11
src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts
...rminal/test/electron-browser/terminalConfigHelper.test.ts
+60
-89
src/vs/workbench/parts/terminal/test/electron-browser/terminalInstance.test.ts
...s/terminal/test/electron-browser/terminalInstance.test.ts
+4
-0
未找到文件。
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
浏览文件 @
42392190
...
...
@@ -16,10 +16,6 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
Severity
from
'
vs/base/common/severity
'
;
import
{
isFedora
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
interface
IEditorConfiguration
{
editor
:
IEditorOptions
;
}
const
DEFAULT_LINE_HEIGHT
=
1.0
;
const
MINIMUM_FONT_SIZE
=
6
;
...
...
@@ -90,21 +86,19 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
* terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties
*/
public
getFont
(
excludeDimensions
?:
boolean
):
ITerminalFont
{
const
config
=
this
.
_configurationService
.
getValue
();
const
editorConfig
=
(
<
IEditorConfiguration
>
config
).
editor
;
const
terminalConfig
=
this
.
config
;
const
editorConfig
=
this
.
_configurationService
.
getValue
<
IEditorOptions
>
(
'
editor
'
);
let
fontFamily
=
t
erminalC
onfig
.
fontFamily
||
editorConfig
.
fontFamily
;
let
fontFamily
=
t
his
.
c
onfig
.
fontFamily
||
editorConfig
.
fontFamily
;
// Work around bad font on Fedora
if
(
!
t
erminalC
onfig
.
fontFamily
)
{
if
(
!
t
his
.
c
onfig
.
fontFamily
)
{
if
(
isFedora
)
{
fontFamily
=
'
\'
DejaVu Sans Mono
\'
'
;
}
}
let
fontSize
=
this
.
_toInteger
(
t
erminalC
onfig
.
fontSize
,
MINIMUM_FONT_SIZE
,
MAXIMUM_FONT_SIZE
,
EDITOR_FONT_DEFAULTS
.
fontSize
);
const
lineHeight
=
t
erminalConfig
.
lineHeight
?
Math
.
max
(
terminalC
onfig
.
lineHeight
,
1
)
:
DEFAULT_LINE_HEIGHT
;
let
fontSize
=
this
.
_toInteger
(
t
his
.
c
onfig
.
fontSize
,
MINIMUM_FONT_SIZE
,
MAXIMUM_FONT_SIZE
,
EDITOR_FONT_DEFAULTS
.
fontSize
);
const
lineHeight
=
t
his
.
config
.
lineHeight
?
Math
.
max
(
this
.
c
onfig
.
lineHeight
,
1
)
:
DEFAULT_LINE_HEIGHT
;
if
(
excludeDimensions
)
{
return
{
...
...
src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts
浏览文件 @
42392190
...
...
@@ -11,6 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
TerminalConfigHelper
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalConfigHelper
'
;
import
{
EDITOR_FONT_DEFAULTS
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
isFedora
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
class
MockConfigurationService
implements
IConfigurationService
{
public
_serviceBrand
:
any
;
...
...
@@ -33,33 +34,17 @@ suite('Workbench - TerminalConfigHelper', () => {
});
test
(
'
TerminalConfigHelper - getFont fontFamily
'
,
function
()
{
let
configurationService
:
IConfigurationService
;
let
configHelper
:
TerminalConfigHelper
;
const
configurationService
=
new
TestConfigurationService
();
configurationService
.
setUserConfiguration
(
'
editor
'
,
{
fontFamily
:
'
foo
'
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
'
bar
'
}
});
configurationService
=
new
MockConfigurationService
({
editor
:
{
fontFamily
:
'
foo
'
},
terminal
:
{
integrated
:
{
fontFamily
:
'
bar
'
}
}
});
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
let
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
assert
.
equal
(
configHelper
.
getFont
().
fontFamily
,
'
bar
'
,
'
terminal.integrated.fontFamily should be selected over editor.fontFamily
'
);
configurationService
=
new
MockConfigurationService
({
editor
:
{
fontFamily
:
'
foo
'
},
terminal
:
{
integrated
:
{
fontFamily
:
0
}
}
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
null
}
});
// Recreate config helper as onDidChangeConfiguration isn't implemented in TestConfigurationService
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
if
(
isFedora
)
{
...
...
@@ -70,65 +55,56 @@ suite('Workbench - TerminalConfigHelper', () => {
});
test
(
'
TerminalConfigHelper - getFont fontSize
'
,
function
()
{
let
configurationService
:
IConfigurationService
;
let
configHelper
:
TerminalConfigHelper
;
const
configurationService
=
new
TestConfigurationService
();
configurationService
=
new
MockConfigurationService
({
editor
:
{
configurationService
.
setUserConfiguration
(
'
editor
'
,
{
fontFamily
:
'
foo
'
,
fontSize
:
9
},
terminal
:
{
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
'
bar
'
,
fontSize
:
10
}
}
});
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
let
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
assert
.
equal
(
configHelper
.
getFont
().
fontSize
,
10
,
'
terminal.integrated.fontSize should be selected over editor.fontSize
'
);
configurationService
=
new
MockConfigurationService
({
editor
:
{
configurationService
.
setUserConfiguration
(
'
editor
'
,
{
fontFamily
:
'
foo
'
},
terminal
:
{
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
0
,
fontFamily
:
null
,
fontSize
:
0
}
}
});
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
assert
.
equal
(
configHelper
.
getFont
().
fontSize
,
6
,
'
The minimum terminal font size should be used when terminal.integrated.fontSize less than it
'
);
configurationService
=
new
MockConfigurationService
({
editor
:
{
configurationService
.
setUserConfiguration
(
'
editor
'
,
{
fontFamily
:
'
foo
'
},
terminal
:
{
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
0
,
fontSize
:
1500
}
}
});
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
assert
.
equal
(
configHelper
.
getFont
().
fontSize
,
25
,
'
The maximum terminal font size should be used when terminal.integrated.fontSize more than it
'
);
configurationService
=
new
MockConfigurationService
({
editor
:
{
fontFamily
:
'
foo
'
,
},
terminal
:
{
configurationService
.
setUserConfiguration
(
'
editor
'
,
{
fontFamily
:
'
foo
'
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
0
,
fontSize
:
null
}
}
});
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
...
...
@@ -136,36 +112,31 @@ suite('Workbench - TerminalConfigHelper', () => {
});
test
(
'
TerminalConfigHelper - getFont lineHeight
'
,
function
()
{
let
configurationService
:
IConfigurationService
;
let
configHelper
:
TerminalConfigHelper
;
const
configurationService
=
new
TestConfigurationService
();
configurationService
=
new
MockConfigurationService
({
editor
:
{
configurationService
.
setUserConfiguration
(
'
editor
'
,
{
fontFamily
:
'
foo
'
,
lineHeight
:
1
},
terminal
:
{
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
0
,
lineHeight
:
2
}
}
});
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
let
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
assert
.
equal
(
configHelper
.
getFont
().
lineHeight
,
2
,
'
terminal.integrated.lineHeight should be selected over editor.lineHeight
'
);
configurationService
=
new
MockConfigurationService
({
editor
:
{
configurationService
.
setUserConfiguration
(
'
editor
'
,
{
fontFamily
:
'
foo
'
,
lineHeight
:
1
},
terminal
:
{
});
configurationService
.
setUserConfiguration
(
'
terminal
'
,
{
integrated
:
{
fontFamily
:
0
,
lineHeight
:
0
}
}
});
configHelper
=
new
TerminalConfigHelper
(
configurationService
,
null
,
null
,
null
);
configHelper
.
panelContainer
=
fixture
;
...
...
src/vs/workbench/parts/terminal/test/electron-browser/terminalInstance.test.ts
浏览文件 @
42392190
...
...
@@ -21,8 +21,11 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
class
TestTerminalInstance
extends
TerminalInstance
{
public
_getCwd
(
shell
:
IShellLaunchConfig
,
root
:
Uri
):
string
{
return
super
.
_getCwd
(
shell
,
root
);
}
...
...
@@ -152,6 +155,7 @@ suite('Workbench - TerminalInstance', () => {
let
keybindingService
=
new
MockKeybindingService
();
let
terminalFocusContextKey
=
contextKeyService
.
createKey
(
'
test
'
,
false
);
instantiationService
=
new
TestInstantiationService
();
instantiationService
.
stub
(
IConfigurationService
,
new
TestConfigurationService
());
instantiationService
.
stub
(
IMessageService
,
new
TestMessageService
());
instantiationService
.
stub
(
IWorkspaceContextService
,
new
TestContextService
());
instantiationService
.
stub
(
IKeybindingService
,
keybindingService
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录