changeset 58972:df8bcff7d20d

8241228: Test jdk/javax/swing/UIDefaults/8146330/UIDefaultKeySizeTest.java is failing Reviewed-by: serb, pbansal, psadhukhan
author trebari
date Mon, 13 Apr 2020 17:42:05 +0530
parents 19afeaa0fdbe
children 3ef964988f81
files test/jdk/ProblemList.txt test/jdk/javax/swing/UIDefaults/8146330/UIDefaultKeySizeTest.java
diffstat 2 files changed, 28 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/ProblemList.txt	Sat Apr 11 10:32:17 2020 +0530
+++ b/test/jdk/ProblemList.txt	Mon Apr 13 17:42:05 2020 +0530
@@ -813,7 +813,6 @@
 javax/swing/JPopupMenu/4966112/bug4966112.java 8064915 macosx-all
 javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java 8238085 macosx-all
 javax/swing/MultiUIDefaults/Test6860438.java 8198391 generic-all
-javax/swing/UIDefaults/8146330/UIDefaultKeySizeTest.java 8241228 aix-all,linux-all,solaris-all
 javax/swing/UITest/UITest.java 8198392 generic-all
 javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 generic-all
 javax/swing/plaf/metal/MetalLookAndFeel/Test8039750.java 8198395 generic-all
--- a/test/jdk/javax/swing/UIDefaults/8146330/UIDefaultKeySizeTest.java	Sat Apr 11 10:32:17 2020 +0530
+++ b/test/jdk/javax/swing/UIDefaults/8146330/UIDefaultKeySizeTest.java	Mon Apr 13 17:42:05 2020 +0530
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8146330
  * @summary Size of values returned by UIDefaults.keys() and
             UIDefaults.keySet() are different
@@ -31,6 +32,7 @@
 
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
 import java.util.Enumeration;
 import java.util.Iterator;
 
@@ -44,30 +46,36 @@
         installedLookAndFeels = UIManager.getInstalledLookAndFeels();
 
         for (UIManager.LookAndFeelInfo LF : installedLookAndFeels) {
-            UIManager.setLookAndFeel(LF.getClassName());
+            try {
+                UIManager.setLookAndFeel(LF.getClassName());
 
-            defaultTestFail = keySizeTest();
-            SwingUtilities.invokeAndWait(() -> {
-                UIManager.getDefaults().put("TestKey","TestValue");
-            });
-            writeTestFail = keySizeTest();
+                defaultTestFail = keySizeTest();
+                SwingUtilities.invokeAndWait(() -> {
+                    UIManager.getDefaults().put("TestKey", "TestValue");
+                });
+                writeTestFail = keySizeTest();
 
-            if(defaultTestFail && writeTestFail ) {
-                throw new RuntimeException("Default key count and Write key"+
-                        " count both are not same in keys() and keySet()");
-            } else if(defaultTestFail || writeTestFail) {
-                if(defaultTestFail) {
-                    throw new RuntimeException("Default key count is not same"+
-                            " in keys() and keySet()");
-                } else {
-                    throw new RuntimeException("Write key count is not same"+
-                            " in keys() and keySet()");
+                if (defaultTestFail && writeTestFail) {
+                    throw new RuntimeException("Default key count and Write " +
+                            "key count both are not same in keys() and" +
+                            " keySet()");
+                } else if (defaultTestFail || writeTestFail) {
+                    if (defaultTestFail) {
+                        throw new RuntimeException("Default key count is not" +
+                                " same in keys() and keySet()");
+                    } else {
+                        throw new RuntimeException("Write key count is not" +
+                                " same in keys() and keySet()");
+                    }
                 }
+
+                SwingUtilities.invokeAndWait(() -> {
+                    UIManager.getDefaults().remove("TestKey");
+                });
+            } catch(UnsupportedLookAndFeelException e) {
+                System.out.println("    Note: LookAndFeel " + LF.getClassName()
+                        + " is not supported on this configuration");
             }
-
-            SwingUtilities.invokeAndWait(() -> {
-                UIManager.getDefaults().remove("TestKey");
-            });
         }
     }