mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Do not depend on vs/workbench from editor tests
This commit is contained in:
parent
581c47bf45
commit
254d09996e
|
@ -9,7 +9,7 @@ import URI from 'vs/base/common/uri';
|
|||
import * as dom from 'vs/base/browser/dom';
|
||||
import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServiceImpl';
|
||||
import { IDecorationRenderOptions } from 'vs/editor/common/editorCommon';
|
||||
import { TestThemeService, TestTheme } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestTheme, TestThemeService } from "vs/platform/theme/test/common/testThemeService";
|
||||
|
||||
const themeServiceMock = new TestThemeService();
|
||||
|
||||
|
|
56
src/vs/platform/theme/test/common/testThemeService.ts
Normal file
56
src/vs/platform/theme/test/common/testThemeService.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { IThemeService, ITheme, DARK } from 'vs/platform/theme/common/themeService';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
||||
export class TestTheme implements ITheme {
|
||||
|
||||
constructor(private colors: { [id: string]: string; } = {}, public type = DARK) {
|
||||
}
|
||||
|
||||
getColor(color: string, useDefault?: boolean): Color {
|
||||
let value = this.colors[color];
|
||||
if (value) {
|
||||
return Color.fromHex(value);
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
|
||||
defines(color: string): boolean {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
export class TestThemeService implements IThemeService {
|
||||
|
||||
_serviceBrand: any;
|
||||
_theme: ITheme;
|
||||
_onThemeChange = new Emitter<ITheme>();
|
||||
|
||||
constructor(theme = new TestTheme()) {
|
||||
this._theme = theme;
|
||||
}
|
||||
|
||||
getTheme(): ITheme {
|
||||
return this._theme;
|
||||
}
|
||||
|
||||
setTheme(theme: ITheme) {
|
||||
this._theme = theme;
|
||||
this.fireThemeChange();
|
||||
}
|
||||
|
||||
fireThemeChange() {
|
||||
this._onThemeChange.fire(this._theme);
|
||||
}
|
||||
|
||||
public get onThemeChange(): Event<ITheme> {
|
||||
return this._onThemeChange.event;
|
||||
}
|
||||
}
|
|
@ -13,10 +13,11 @@ import URI from 'vs/base/common/uri';
|
|||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorInput, EditorOptions, TextEditorOptions } from 'vs/workbench/common/editor';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import { workbenchInstantiationService, TestThemeService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { workbenchInstantiationService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { DelegatingWorkbenchEditorService, WorkbenchEditorService, IEditorPart } from 'vs/workbench/services/editor/browser/editorService';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { TestThemeService } from "vs/platform/theme/test/common/testThemeService";
|
||||
|
||||
let activeEditor: BaseEditor = <any>{
|
||||
getSelection: function () {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Part } from 'vs/workbench/browser/part';
|
|||
import * as Types from 'vs/base/common/types';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { StorageService, InMemoryLocalStorage } from 'vs/platform/storage/common/storageService';
|
||||
import { TestThemeService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestThemeService } from "vs/platform/theme/test/common/testThemeService";
|
||||
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||
|
||||
class MyPart extends Part {
|
||||
|
|
|
@ -15,8 +15,9 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
|||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
|
||||
import { workbenchInstantiationService, TestThemeService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { workbenchInstantiationService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { TestThemeService } from "vs/platform/theme/test/common/testThemeService";
|
||||
|
||||
const NullThemeService = new TestThemeService();
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ import { IWindowsService, IWindowService } from 'vs/platform/windows/common/wind
|
|||
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||
import { RawTextSource, IRawTextSource } from 'vs/editor/common/model/textSource';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IThemeService, ITheme, DARK } from 'vs/platform/theme/common/themeService';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { generateUuid } from "vs/base/common/uuid";
|
||||
import { TestThemeService } from "vs/platform/theme/test/common/testThemeService";
|
||||
|
||||
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
|
||||
return instantiationService.createInstance(FileEditorInput, resource, void 0);
|
||||
|
@ -1031,48 +1031,3 @@ export class TestWindowsService implements IWindowsService {
|
|||
}
|
||||
}
|
||||
|
||||
export class TestTheme implements ITheme {
|
||||
|
||||
constructor(private colors: { [id: string]: string; } = {}, public type = DARK) {
|
||||
}
|
||||
|
||||
getColor(color: string, useDefault?: boolean): Color {
|
||||
let value = this.colors[color];
|
||||
if (value) {
|
||||
return Color.fromHex(value);
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
|
||||
defines(color: string): boolean {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
export class TestThemeService implements IThemeService {
|
||||
|
||||
_serviceBrand: any;
|
||||
_theme: ITheme;
|
||||
_onThemeChange = new Emitter<ITheme>();
|
||||
|
||||
constructor(theme = new TestTheme()) {
|
||||
this._theme = theme;
|
||||
}
|
||||
|
||||
getTheme(): ITheme {
|
||||
return this._theme;
|
||||
}
|
||||
|
||||
setTheme(theme: ITheme) {
|
||||
this._theme = theme;
|
||||
this.fireThemeChange();
|
||||
}
|
||||
|
||||
fireThemeChange() {
|
||||
this._onThemeChange.fire(this._theme);
|
||||
}
|
||||
|
||||
public get onThemeChange(): Event<ITheme> {
|
||||
return this._onThemeChange.event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,9 +173,9 @@
|
|||
"vs/nls",
|
||||
"**/vs/base/{common,browser}/**",
|
||||
"**/vs/platform/*/{common,browser}/**",
|
||||
"**/vs/platform/*/test/{common,browser}/**",
|
||||
"**/vs/editor/{common,browser}/**",
|
||||
"**/vs/editor/test/{common,browser}/**",
|
||||
"vs/workbench/test/workbenchTestServices" // TODO@Alex
|
||||
"**/vs/editor/test/{common,browser}/**"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue