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

Backport-of: 84fc485
  • Loading branch information
RealCLanger committed Oct 11, 2021
1 parent d66464e commit 82491fd2d2c694cc75ad2aef504ea596ea6d36de
Showing with 28 additions and 7 deletions.
  1. +0 −1 test/jdk/ProblemList.txt
  2. +28 −6 test/jdk/javax/swing/MultiUIDefaults/4300666/bug4300666.java
@@ -755,7 +755,6 @@ javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-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/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
@@ -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);
}
}
}

1 comment on commit 82491fd

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 82491fd Oct 11, 2021

Please sign in to comment.