From 5d673a2f3b1d6517fd386dca0a0a6742f02482c7 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 2 Dec 2014 17:14:43 +0300 Subject: [PATCH] IDEA-133649 test case --- .../impl/EditorColorsSchemeDelegateTest.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorColorsSchemeDelegateTest.java diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorColorsSchemeDelegateTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorColorsSchemeDelegateTest.java new file mode 100644 index 000000000000..86072775c36b --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorColorsSchemeDelegateTest.java @@ -0,0 +1,56 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.editor.impl; + +import com.intellij.openapi.editor.colors.EditorColorsManager; +import com.intellij.openapi.editor.colors.EditorColorsScheme; +import com.intellij.openapi.editor.colors.FontPreferences; +import com.intellij.openapi.editor.colors.impl.EditorColorsManagerImpl; +import com.intellij.testFramework.TestFileType; + +public class EditorColorsSchemeDelegateTest extends AbstractEditorTest { + private EditorColorsScheme mySavedScheme; + private EditorColorsScheme myTestScheme; + + @Override + protected void setUp() throws Exception { + super.setUp(); + mySavedScheme = EditorColorsManager.getInstance().getGlobalScheme(); + myTestScheme = (EditorColorsScheme)mySavedScheme.clone(); + myTestScheme.setName("EditingTest.testScheme"); + EditorColorsManager.getInstance().addColorsScheme(myTestScheme); + EditorColorsManager.getInstance().setGlobalScheme(myTestScheme); + } + + @Override + protected void tearDown() throws Exception { + EditorColorsManager.getInstance().setGlobalScheme(mySavedScheme); + ((EditorColorsManagerImpl)EditorColorsManager.getInstance()).getSchemesManager().removeScheme(myTestScheme); + super.tearDown(); + } + + public void testSecondaryFontIsAvailable() throws Exception { + FontPreferences globalPrefs = myTestScheme.getFontPreferences(); + globalPrefs.register("DummyFont", globalPrefs.getSize(globalPrefs.getFontFamily())); + assertEquals(2, globalPrefs.getRealFontFamilies().size()); + + init("blah", TestFileType.TEXT); + + FontPreferences editorPrefs = myEditor.getColorsScheme().getFontPreferences(); + assertEquals(2, editorPrefs.getRealFontFamilies().size()); + assertEquals("DummyFont", editorPrefs.getRealFontFamilies().get(1)); + } +}