mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fix test failures due to private mangling
This commit is contained in:
parent
8f218ce2a5
commit
093332ee52
|
@ -16,7 +16,7 @@ import { DEFAULT_BOLD_FONT_WEIGHT, DEFAULT_FONT_WEIGHT, DEFAULT_LETTER_SPACING,
|
||||||
export class TerminalConfigurationService extends Disposable implements ITerminalConfigurationService {
|
export class TerminalConfigurationService extends Disposable implements ITerminalConfigurationService {
|
||||||
declare _serviceBrand: undefined;
|
declare _serviceBrand: undefined;
|
||||||
|
|
||||||
private _fontMetrics: TerminalFontMetrics;
|
protected _fontMetrics: TerminalFontMetrics;
|
||||||
|
|
||||||
private _config!: Readonly<ITerminalConfiguration>;
|
private _config!: Readonly<ITerminalConfiguration>;
|
||||||
get config() { return this._config; }
|
get config() { return this._config; }
|
||||||
|
@ -72,7 +72,7 @@ class TerminalFontMetrics extends Disposable {
|
||||||
private _charMeasureElement: HTMLElement | undefined;
|
private _charMeasureElement: HTMLElement | undefined;
|
||||||
private _lastFontMeasurement: ITerminalFont | undefined;
|
private _lastFontMeasurement: ITerminalFont | undefined;
|
||||||
|
|
||||||
protected _linuxDistro: LinuxDistro = LinuxDistro.Unknown;
|
linuxDistro: LinuxDistro = LinuxDistro.Unknown;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _terminalConfigurationService: ITerminalConfigurationService,
|
private readonly _terminalConfigurationService: ITerminalConfigurationService,
|
||||||
|
@ -112,10 +112,10 @@ class TerminalFontMetrics extends Disposable {
|
||||||
|
|
||||||
// Work around bad font on Fedora/Ubuntu
|
// Work around bad font on Fedora/Ubuntu
|
||||||
if (!this._terminalConfigurationService.config.fontFamily) {
|
if (!this._terminalConfigurationService.config.fontFamily) {
|
||||||
if (this._linuxDistro === LinuxDistro.Fedora) {
|
if (this.linuxDistro === LinuxDistro.Fedora) {
|
||||||
fontFamily = '\'DejaVu Sans Mono\'';
|
fontFamily = '\'DejaVu Sans Mono\'';
|
||||||
}
|
}
|
||||||
if (this._linuxDistro === LinuxDistro.Ubuntu) {
|
if (this.linuxDistro === LinuxDistro.Ubuntu) {
|
||||||
fontFamily = '\'Ubuntu Mono\'';
|
fontFamily = '\'Ubuntu Mono\'';
|
||||||
|
|
||||||
// Ubuntu mono is somehow smaller, so set fontSize a bit larger to get the same perceived size.
|
// Ubuntu mono is somehow smaller, so set fontSize a bit larger to get the same perceived size.
|
||||||
|
|
|
@ -14,6 +14,9 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||||
import { ITerminalConfigurationService, LinuxDistro } from 'vs/workbench/contrib/terminal/browser/terminal';
|
import { ITerminalConfigurationService, LinuxDistro } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||||
import { TerminalConfigurationService } from 'vs/workbench/contrib/terminal/browser/terminalConfigurationService';
|
import { TerminalConfigurationService } from 'vs/workbench/contrib/terminal/browser/terminalConfigurationService';
|
||||||
|
|
||||||
|
class TestTerminalConfigurationService extends TerminalConfigurationService {
|
||||||
|
get fontMetrics() { return this._fontMetrics; }
|
||||||
|
}
|
||||||
|
|
||||||
suite('Workbench - TerminalConfigurationService', () => {
|
suite('Workbench - TerminalConfigurationService', () => {
|
||||||
let configurationService: TestConfigurationService;
|
let configurationService: TestConfigurationService;
|
||||||
|
@ -58,11 +61,11 @@ suite('Workbench - TerminalConfigurationService', () => {
|
||||||
function createTerminalConfigationService(config: any, linuxDistro?: LinuxDistro): ITerminalConfigurationService {
|
function createTerminalConfigationService(config: any, linuxDistro?: LinuxDistro): ITerminalConfigurationService {
|
||||||
const instantiationService = new TestInstantiationService();
|
const instantiationService = new TestInstantiationService();
|
||||||
instantiationService.set(IConfigurationService, new TestConfigurationService(config));
|
instantiationService.set(IConfigurationService, new TestConfigurationService(config));
|
||||||
const terminalConfigurationService = store.add(instantiationService.createInstance(TerminalConfigurationService));
|
const terminalConfigurationService = store.add(instantiationService.createInstance(TestTerminalConfigurationService));
|
||||||
instantiationService.set(ITerminalConfigurationService, terminalConfigurationService);
|
instantiationService.set(ITerminalConfigurationService, terminalConfigurationService);
|
||||||
terminalConfigurationService.setPanelContainer(mainWindow.document.body);
|
terminalConfigurationService.setPanelContainer(mainWindow.document.body);
|
||||||
if (linuxDistro) {
|
if (linuxDistro) {
|
||||||
(terminalConfigurationService as any)._fontMetrics._linuxDistro = linuxDistro;
|
terminalConfigurationService.fontMetrics.linuxDistro = linuxDistro;
|
||||||
}
|
}
|
||||||
return terminalConfigurationService;
|
return terminalConfigurationService;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue