Skip to content
Permalink
Browse files
8233559: [TESTBUG] TestNimbusOverride.java is failing on macos
Backport-of: c638618
  • Loading branch information
RealCLanger committed Oct 20, 2021
1 parent b122119 commit bab6d940e0cba845f42bf59d51290bc4b9322d00
Showing 2 changed files with 28 additions and 26 deletions.
@@ -773,7 +773,6 @@ javax/swing/text/StyledEditorKit/4506788/bug4506788.java 8233562 macosx-all
javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java 233570 macosx-all
javax/swing/text/GlyphPainter2/6427244/bug6427244.java 8208566 macosx-all
javax/swing/ProgressMonitor/ProgressMonitorEscapeKeyPress.java 8233635 macosx-all
javax/swing/plaf/nimbus/TestNimbusOverride.java 8233559 macosx-all
javax/swing/JRootPane/4670486/bug4670486.java 8042381 macosx-all
javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java 8233555 macosx-all
javax/swing/JRadioButton/8075609/bug8075609.java 8233555 macosx-all
@@ -31,17 +31,14 @@
*/

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.Robot;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
@@ -56,36 +53,41 @@ public class TestNimbusOverride extends JFrame
private static boolean passed = false;

public static void main(String [] args) throws Exception {
Robot robot = new Robot();
SwingUtilities.invokeAndWait(() -> {
try {
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
throw new RuntimeException(e);
}
tf = new TestNimbusOverride();
tf.pack();
tf.setVisible(true);
});
robot.setAutoDelay(100);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);
robot.waitForIdle();
SwingUtilities.invokeAndWait(() -> tf.dispose());
if (!passed) {
try {
Robot robot = new Robot();
SwingUtilities.invokeAndWait(() -> {
try {
UIManager.setLookAndFeel(
"javax.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
throw new RuntimeException(e);
}
tf = new TestNimbusOverride();
tf.pack();
tf.setVisible(true);
});
robot.setAutoDelay(100);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);
robot.waitForIdle();
if (!passed) {
throw new RuntimeException(
"Setting Nimbus.Overrides property affects custom keymap installation");
"Setting Nimbus.Overrides property affects custom" +
" keymap installation");
}
} finally {
SwingUtilities.invokeAndWait(() -> tf.dispose());
}
}

public TestNimbusOverride()
{
setDefaultCloseOperation(DISPOSE_ON_CLOSE);

/*
* Create a frame containing a JEditorPane, and override the action for the space bar to show
* a dialog.
* Create a frame containing a JEditorPane, and override the action for
* the space bar to show a dialog.
*/
JEditorPane pp = new JEditorPane();
UIDefaults defaults = new UIDefaults();
@@ -102,7 +104,8 @@ public TestNimbusOverride()
Keymap origKeymap = pp.getKeymap();
Keymap km = JEditorPane.addKeymap("Test keymap", origKeymap);

km.addActionForKeyStroke(KeyStroke.getKeyStroke(' '), new AbstractAction("SHOW_SPACE") {
km.addActionForKeyStroke(KeyStroke.getKeyStroke(' '),
new AbstractAction("SHOW_SPACE") {
@Override
public void actionPerformed(ActionEvent e)
{

1 comment on commit bab6d94

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on bab6d94 Oct 20, 2021

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.