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: serb
Backport-of: 41fc7dd
  • Loading branch information
TheRealMDoerr committed Dec 9, 2021
1 parent 9b96ac9 commit 554498d
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 @@ -773,7 +773,6 @@ javax/swing/text/html/parser/Parser/HtmlCommentTagParseTest/HtmlCommentTagParseT
javax/swing/text/StyledEditorKit/8016833/bug8016833.java 8199055 generic-all
javax/swing/text/Utilities/8134721/bug8134721.java 8199062 generic-all
javax/swing/tree/DefaultTreeCellRenderer/7142955/bug7142955.java 8199076 generic-all
javax/swing/UIDefaults/6302464/bug6302464.java 8199079 generic-all
javax/swing/UIDefaults/8133926/InternalFrameIcon.java 8199075 generic-all
javax/swing/UIDefaults/8149879/InternalResourceBundle.java 8199054 windows-all
javax/swing/text/html/parser/Parser/8078268/bug8078268.java 8199092 generic-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 554498d

@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.