From 7ddcc442674dd206a36cbeec651f3ed1df7cfbc8 Mon Sep 17 00:00:00 2001 From: Pavel Fatin Date: Fri, 14 Oct 2016 13:09:52 +0200 Subject: [PATCH] ImmediatePainterTest: restore editor font and line spacing in tearDown() --- .../editor/impl/ImmediatePainterTest.java | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/ImmediatePainterTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/ImmediatePainterTest.java index 5b03b6fa8c63..30085f743a90 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/ImmediatePainterTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/ImmediatePainterTest.java @@ -16,6 +16,7 @@ package com.intellij.openapi.editor.impl; import com.intellij.openapi.editor.colors.EditorColors; +import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.EditorColorsUtil; import com.intellij.openapi.editor.impl.view.FontLayoutService; import com.intellij.openapi.editor.markup.HighlighterLayer; @@ -40,10 +41,18 @@ import java.io.IOException; * @author Pavel Fatin */ public class ImmediatePainterTest extends AbstractEditorTest { + private String myDefaultFontName; + private int myDefaultFontSize; + private float myDefaultLineSpacing; + @Override protected void setUp() throws Exception { super.setUp(); + myDefaultFontName = getDefaultColorScheme().getEditorFontName(); + myDefaultFontSize = getDefaultColorScheme().getEditorFontSize(); + myDefaultLineSpacing = getDefaultColorScheme().getLineSpacing(); + FontLayoutService.setInstance(null); setZeroLatencyRenderingEnabled(true); @@ -53,6 +62,18 @@ public class ImmediatePainterTest extends AbstractEditorTest { setLineSpacing(1.3F); } + @Override + protected void tearDown() throws Exception { + try { + getDefaultColorScheme().setEditorFontName(myDefaultFontName); + getDefaultColorScheme().setEditorFontSize(myDefaultFontSize); + getDefaultColorScheme().setLineSpacing(myDefaultLineSpacing); + } + finally { + super.tearDown(); + } + } + public void testDrawingNarrowChar() throws Exception { init(""); assertRenderedCorrectly(0, '▌'); @@ -265,16 +286,20 @@ public class ImmediatePainterTest extends AbstractEditorTest { } private static void setCaretColor(Color color) { - EditorColorsUtil.getGlobalOrDefaultColorScheme().setColor(EditorColors.CARET_COLOR, color); + getDefaultColorScheme().setColor(EditorColors.CARET_COLOR, color); } private static void setFont(String name, int size) { - EditorColorsUtil.getGlobalOrDefaultColorScheme().setEditorFontName(name); - EditorColorsUtil.getGlobalOrDefaultColorScheme().setEditorFontSize(size); + getDefaultColorScheme().setEditorFontName(name); + getDefaultColorScheme().setEditorFontSize(size); } private static void setLineSpacing(float lineSpacing) { - EditorColorsUtil.getGlobalOrDefaultColorScheme().setLineSpacing(lineSpacing); + getDefaultColorScheme().setLineSpacing(lineSpacing); + } + + private static EditorColorsScheme getDefaultColorScheme() { + return EditorColorsUtil.getGlobalOrDefaultColorScheme(); } private static void setZeroLatencyRenderingEnabled(boolean enabled) {