Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8233559: [TESTBUG] TestNimbusOverride.java is failing on macos #524

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -775,7 +775,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)
{