mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
restore uiSettings after LafManager test
This commit is contained in:
@@ -3,7 +3,6 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.laf.LafManagerImpl;
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -15,25 +14,26 @@ import java.awt.*;
|
||||
public class LafManagerTest extends PlatformTestCase {
|
||||
|
||||
public void testCustomFont() {
|
||||
String fontFace = UISettings.getInstance().getFontFace();
|
||||
int fontSize = UISettings.getInstance().getFontSize();
|
||||
final String fontFace = UISettings.getInstance().getFontFace();
|
||||
final int fontSize = UISettings.getInstance().getFontSize();
|
||||
final LafManagerImpl lafManager = LafManagerImpl.getTestInstance();
|
||||
final UISettings uiSettings = UISettings.getInstance();
|
||||
|
||||
try {
|
||||
UISettings instance = UISettings.getInstance();
|
||||
String newFontName = "Arial";
|
||||
int newFontSize = 17;
|
||||
instance.setFontFace(newFontName);
|
||||
instance.setFontSize(newFontSize);
|
||||
instance.setOverrideLafFonts(true);
|
||||
LafManagerImpl lafManager = LafManagerImpl.getTestInstance();
|
||||
lafManager.setCurrentLookAndFeel(new DarculaLookAndFeelInfo());
|
||||
uiSettings.setFontFace(newFontName);
|
||||
uiSettings.setFontSize(newFontSize);
|
||||
uiSettings.setOverrideLafFonts(true);
|
||||
lafManager.updateUI();
|
||||
Font font = UIManager.getFont("Label.font");
|
||||
assertEquals("Font name is not changed", newFontName, font.getName());
|
||||
assertEquals("Font size is not changed", newFontSize, font.getSize());
|
||||
} finally {
|
||||
uiSettings.setOverrideLafFonts(false);
|
||||
UISettings.getInstance().setFontFace(fontFace);
|
||||
UISettings.getInstance().setFontSize(fontSize);
|
||||
lafManager.updateUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user