8199079: Test javax/swing/UIDefaults/6302464/bug6302464.java is unstable

Reviewed-by: prr
This commit is contained in:
Prasanta Sadhukhan 2021-04-21 14:35:48 +00:00
parent 45c474a04c
commit 41fc7ddd8d
2 changed files with 28 additions and 8 deletions

View File

@ -759,7 +759,6 @@ javax/swing/JFileChooser/6738668/bug6738668.java 8194946 generic-all
javax/swing/JInternalFrame/Test6325652.java 8224977 macosx-all
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java 8065099,8208565 macosx-all,linux-all
javax/swing/UIDefaults/6302464/bug6302464.java 8199079 macosx-all
javax/swing/dnd/8139050/NativeErrorsInTableDnD.java 8202765 macosx-all,linux-all
javax/swing/Popup/TaskbarPositionTest.java 8065097 macosx-all,linux-all
javax/swing/JEditorPane/6917744/bug6917744.java 8213124 macosx-all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -118,28 +118,49 @@ public class bug6302464 {
private static void testAntialiasingHints() {
setMetalLookAndFeel();
HashSet colorsAAOff = getAntialiasedColors(VALUE_TEXT_ANTIALIAS_OFF, 100);
boolean isMacOSX14 = false;
boolean isMacOSXBigSur = false;
if (System.getProperty("os.name").contains("OS X")) {
String version = System.getProperty("os.version", "");
if (version.startsWith("10.")) {
version = version.substring(3);
int periodIndex = version.indexOf('.');
if (periodIndex != -1) {
version = version.substring(0, periodIndex);
}
try {
int v = Integer.parseInt(version);
isMacOSX14 = (v >= 14);
} catch (NumberFormatException e) {
}
} else if (version.startsWith("11.")) {
isMacOSXBigSur = true;
}
}
if (!isMacOSX14 && !isMacOSXBigSur) {
HashSet colorsAAOff = getAntialiasedColors(VALUE_TEXT_ANTIALIAS_OFF, 100);
if (colorsAAOff.size() > 2) {
throw new RuntimeException("Wrong number of antialiased colors.");
if (colorsAAOff.size() > 2) {
throw new RuntimeException("Wrong number of antialiased colors.");
}
}
HashSet colorsAAOnLCD100 = getAntialiasedColors(
VALUE_TEXT_ANTIALIAS_LCD_HRGB, 100);
if (colorsAAOnLCD100.size() <= 2) {
throw new RuntimeException("Wrong number of antialiased colors.");
throw new RuntimeException("Wrong number of antialiased ANTIALIAS_LCD_HRGB_100 colors.");
}
HashSet colorsAAOnLCD250 = getAntialiasedColors(
VALUE_TEXT_ANTIALIAS_LCD_HRGB, 250);
if (colorsAAOnLCD250.size() <= 2) {
throw new RuntimeException("Wrong number of antialiased colors.");
throw new RuntimeException("Wrong number of antialiased ANTIALIAS_LCD_HRGB_250 colors.");
}
if (colorsAAOnLCD100.equals(colorsAAOnLCD250)) {
throw new RuntimeException("LCD contarst is not used.");
throw new RuntimeException("LCD contrast is not used.");
}
}