Skip to content
Permalink
Browse files
7105119: [TEST_BUG] [macosx] In test UIDefaults.toString() must be ca…
…lled with the invokeLater()

Reviewed-by: prr, psadhukhan
  • Loading branch information
mrserb committed Apr 8, 2020
1 parent 8eb7c3e commit 84fc4850a674f0f688cca2c6856e5656428707fc
Showing 2 changed files with 28 additions and 7 deletions.
@@ -807,7 +807,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/MultiUIDefaults/4300666/bug4300666.java 7105119 macosx-all
javax/swing/UIDefaults/8146330/UIDefaultKeySizeTest.java 8241228 linux-all,solaris-all
javax/swing/UITest/UITest.java 8198392 generic-all
javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 generic-all
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2020, 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
@@ -27,12 +27,34 @@
* @summary Printing UIDefaults throws NoSuchElementExcept
*/

import javax.swing.*;
import java.awt.EventQueue;

public class bug4300666 {
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public static void main(final String[] args) {
UIDefaults d = UIManager.getDefaults();
d.toString();
import static javax.swing.UIManager.getInstalledLookAndFeels;

public final class bug4300666 {

public static void main(final String[] args) throws Exception {
for (UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
EventQueue.invokeAndWait(() -> setLookAndFeel(laf));
EventQueue.invokeAndWait(() -> {
UIDefaults d = UIManager.getDefaults();
d.toString();
});
}
}

private static void setLookAndFeel(UIManager.LookAndFeelInfo laf) {
try {
UIManager.setLookAndFeel(laf.getClassName());
} catch (UnsupportedLookAndFeelException ignored) {
System.out.println("Unsupported L&F: " + laf.getClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}

0 comments on commit 84fc485

Please sign in to comment.