|
|
|
@ -36,8 +36,6 @@ import org.junit.jupiter.api.condition.OS;
|
|
|
|
|
|
|
|
|
|
import com.github.weisj.darklaf.LafManager; |
|
|
|
|
import com.github.weisj.darklaf.color.ColorUtil; |
|
|
|
|
import com.github.weisj.darklaf.theme.DarculaTheme; |
|
|
|
|
import com.github.weisj.darklaf.theme.IntelliJTheme; |
|
|
|
|
import com.github.weisj.darklaf.ui.rootpane.DarkRootPaneUI; |
|
|
|
|
import com.github.weisj.darklaf.util.SystemInfo; |
|
|
|
|
|
|
|
|
@ -55,12 +53,13 @@ class CustomTitleBarTest extends AbstractImageTest {
|
|
|
|
|
|
|
|
|
|
@BeforeAll |
|
|
|
|
static void setup() { |
|
|
|
|
LafManager.registerInitTask((t, d) -> { |
|
|
|
|
TestUtils.runOnSwingThreadNotThrowing(() -> LafManager.registerInitTask((t, d) -> { |
|
|
|
|
d.put("MacOS.TitlePane.background", TITLE_BAR_COLOR); |
|
|
|
|
d.put("MacOS.TitlePane.inactiveBackground", TITLE_BAR_COLOR); |
|
|
|
|
d.put("Windows.TitlePane.background", TITLE_BAR_COLOR); |
|
|
|
|
d.put("Windows.TitlePane.inactiveBackground", TITLE_BAR_COLOR); |
|
|
|
|
}); |
|
|
|
|
})); |
|
|
|
|
TestUtils.ensureLafInstalled(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
@ -155,7 +154,6 @@ class CustomTitleBarTest extends AbstractImageTest {
|
|
|
|
|
@Test |
|
|
|
|
@EnabledOnOs({OS.MAC, OS.WINDOWS}) |
|
|
|
|
void checkTitleBarColored() { |
|
|
|
|
SwingUtilities.invokeLater(() -> LafManager.install(new IntelliJTheme())); |
|
|
|
|
UIManager.put("macos.coloredTitleBar", true); |
|
|
|
|
checkImage("colored_title_" + SystemInfo.getOsName(), |
|
|
|
|
img -> assertScreenColorEquals(TITLE_BAR_COLOR, new Color(img.getRGB(img.getWidth() / 2, TITLE_BAR_Y)), |
|
|
|
@ -165,7 +163,6 @@ class CustomTitleBarTest extends AbstractImageTest {
|
|
|
|
|
@Test |
|
|
|
|
@EnabledOnOs(OS.MAC) |
|
|
|
|
void checkTitleBarNotColored() { |
|
|
|
|
SwingUtilities.invokeLater(() -> LafManager.install(new IntelliJTheme())); |
|
|
|
|
UIManager.put("macos.coloredTitleBar", false); |
|
|
|
|
checkImage("non_colored_title_" + SystemInfo.getOsName(), img -> { |
|
|
|
|
Color c = new Color(img.getRGB(img.getWidth() / 2, TITLE_BAR_Y)); |
|
|
|
@ -177,7 +174,6 @@ class CustomTitleBarTest extends AbstractImageTest {
|
|
|
|
|
@Test |
|
|
|
|
@EnabledOnOs(OS.MAC) |
|
|
|
|
void checkForDarkNativeTitle() { |
|
|
|
|
SwingUtilities.invokeLater(() -> LafManager.install(new DarculaTheme())); |
|
|
|
|
UIManager.put("macos.coloredTitleBar", false); |
|
|
|
|
checkImage("native_title_dark_mac", img -> { |
|
|
|
|
assertScreenColorNotEquals(CONTENT_COLOR, new Color(img.getRGB(img.getWidth() / 2, TITLE_BAR_Y)), |
|
|
|
@ -192,7 +188,6 @@ class CustomTitleBarTest extends AbstractImageTest {
|
|
|
|
|
@Test |
|
|
|
|
@EnabledOnOs(OS.MAC) |
|
|
|
|
void checkForLightNativeTitle() { |
|
|
|
|
SwingUtilities.invokeLater(() -> LafManager.install(new IntelliJTheme())); |
|
|
|
|
UIManager.put("macos.coloredTitleBar", false); |
|
|
|
|
checkImage("native_title_light_mac", img -> { |
|
|
|
|
assertScreenColorNotEquals(CONTENT_COLOR, new Color(img.getRGB(img.getWidth() / 2, TITLE_BAR_Y)), |
|
|
|
@ -207,7 +202,6 @@ class CustomTitleBarTest extends AbstractImageTest {
|
|
|
|
|
@Test |
|
|
|
|
@EnabledOnOs({OS.MAC, OS.WINDOWS}) |
|
|
|
|
void checkTitleBarHidden() { |
|
|
|
|
TestUtils.runOnSwingThreadNotThrowing(() -> LafManager.install(new IntelliJTheme())); |
|
|
|
|
UIManager.put("macos.coloredTitleBar", true); |
|
|
|
|
Assertions.assertTrue(LafManager.isDecorationsEnabled()); |
|
|
|
|
checkImage("title_bar_hidden_" + SystemInfo.getOsName(), |
|
|
|
@ -222,7 +216,6 @@ class CustomTitleBarTest extends AbstractImageTest {
|
|
|
|
|
@Test |
|
|
|
|
@EnabledOnOs(OS.WINDOWS) |
|
|
|
|
void checkDisableCustomDecoration() { |
|
|
|
|
SwingUtilities.invokeLater(() -> LafManager.install(new IntelliJTheme())); |
|
|
|
|
checkImage("native_title_bar_window", |
|
|
|
|
f -> LafManager.setDecorationsEnabled(false), |
|
|
|
|
img -> assertScreenColorNotEquals(TITLE_BAR_COLOR, |
|
|
|
|