Skip to content

Commit

Permalink
8199079: Test javax/swing/UIDefaults/6302464/bug6302464.java is unstable
Browse files Browse the repository at this point in the history
Reviewed-by: prr
  • Loading branch information
prsadhuk committed Apr 21, 2021
1 parent 45c474a commit 41fc7dd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -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
Expand Down
35 changes: 28 additions & 7 deletions test/jdk/javax/swing/UIDefaults/6302464/bug6302464.java
@@ -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
Expand Down Expand Up @@ -118,28 +118,49 @@ private static void testFontRenderingContext(Object aaHint) {
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.");
}
}

Expand Down

1 comment on commit 41fc7dd

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.