8241228: Test jdk/javax/swing/UIDefaults/8146330/UIDefaultKeySizeTest.java is failing

Reviewed-by: serb, pbansal, psadhukhan
This commit is contained in:
Tejpal Rebari 2020-04-13 17:42:05 +05:30
parent efba976cfb
commit 816d9483f0
2 changed files with 28 additions and 21 deletions
test/jdk
ProblemList.txt
javax/swing/UIDefaults/8146330

@ -813,7 +813,6 @@ javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
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

@ -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 @@ public class UIDefaultKeySizeTest {
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");
});
SwingUtilities.invokeAndWait(() -> {
UIManager.getDefaults().remove("TestKey");
});
} catch(UnsupportedLookAndFeelException e) {
System.out.println(" Note: LookAndFeel " + LF.getClassName()
+ " is not supported on this configuration");
}
}
}