From a213de76579fb8dcad7fada26e34715ac1b69062 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Thu, 27 Apr 2017 16:57:53 +0300 Subject: [PATCH] Test fix --- .../impl/EditorColorsSchemeDelegateTest.java | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) 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 index 69ede93f4d2a..ce12d99973e8 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorColorsSchemeDelegateTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorColorsSchemeDelegateTest.java @@ -19,7 +19,9 @@ 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.ModifiableFontPreferences; +import com.intellij.openapi.editor.colors.impl.AppEditorFontOptions; import com.intellij.openapi.editor.colors.impl.EditorColorsManagerImpl; +import com.intellij.openapi.editor.colors.impl.FontPreferencesImpl; import com.intellij.testFramework.TestFileType; public class EditorColorsSchemeDelegateTest extends AbstractEditorTest { @@ -50,15 +52,22 @@ public class EditorColorsSchemeDelegateTest extends AbstractEditorTest { } public void testSecondaryFontIsAvailable() throws Exception { - FontPreferences globalPrefs = myTestScheme.getFontPreferences(); - assertInstanceOf(globalPrefs, ModifiableFontPreferences.class); - ((ModifiableFontPreferences)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)); + FontPreferences globalPrefs = AppEditorFontOptions.getInstance().getFontPreferences(); + FontPreferences tempCopy = new FontPreferencesImpl(); + globalPrefs.copyTo(tempCopy); + try { + assertInstanceOf(globalPrefs, ModifiableFontPreferences.class); + ((ModifiableFontPreferences)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)); + } + finally { + tempCopy.copyTo(globalPrefs); + } } }