Skip to content

Commit 3f8bd92

Browse files
committed
8233556: [TESTBUG] JPopupMenu tests fail on MacOS
Reviewed-by: serb
1 parent 4acf634 commit 3f8bd92

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

test/jdk/ProblemList.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,7 @@ javax/swing/JRootPane/4670486/bug4670486.java 8042381 macosx-all
799799
javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java 8233555 macosx-all
800800
javax/swing/JRadioButton/8075609/bug8075609.java 8233555 macosx-all
801801
javax/swing/JRadioButton/8033699/bug8033699.java 8233555 macosx-all
802-
javax/swing/JPopupMenu/6827786/bug6827786.java 8233556 macosx-all
803-
javax/swing/JPopupMenu/6544309/bug6544309.java 8233556 macosx-all
804-
javax/swing/JPopupMenu/4634626/bug4634626.java 8233556 macosx-all
805-
javax/swing/JPopupMenu/4458079/bug4458079.java 8233556 macosx-all
802+
javax/swing/JPopupMenu/4634626/bug4634626.java 8017175 macosx-all
806803
javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java 8233637 macosx-all
807804
javax/swing/JMenuItem/6249972/bug6249972.java 8233640 macosx-all
808805
javax/swing/JMenuItem/4171437/bug4171437.java 8233641 macosx-all

test/jdk/javax/swing/JPopupMenu/4458079/bug4458079.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,27 @@ public class bug4458079 extends JFrame implements PopupMenuListener {
4444
static volatile boolean itemASelected = false;
4545
public static void main(String[] args) throws Exception {
4646
Robot robot = new Robot();
47-
robot.waitForIdle();
47+
robot.setAutoDelay(100);
4848
// move mouse outside menu to prevent auto selection
4949
robot.mouseMove(100,100);
50+
robot.waitForIdle();
5051

5152
SwingUtilities.invokeAndWait(new Runnable() {
5253
public void run() {
5354
new bug4458079().createAndShowGUI();
5455
}
5556
});
5657

57-
robot.setAutoDelay(50);
58-
58+
robot.waitForIdle();
59+
robot.delay(1000);
5960
Util.hitMnemonics(robot, KeyEvent.VK_M);
6061

6162
robot.waitForIdle();
62-
Thread.sleep(1000);
6363

6464
Util.hitKeys(robot, KeyEvent.VK_DOWN);
6565
Util.hitKeys(robot, KeyEvent.VK_ENTER);
6666

6767
robot.waitForIdle();
68-
Thread.sleep(1000);
6968

7069
if (!itemASelected) {
7170
throw new RuntimeException("Test failed: arrow key traversal in JMenu broken!");

test/jdk/javax/swing/JPopupMenu/6544309/bug6544309.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,13 @@
2222
*/
2323
/*
2424
@test
25-
@key headful
25+
@key headful
2626
@bug 6544309
2727
@summary Checks that 'Select Input Method' popup menu allows to select
2828
items with keyboard.
29-
@author Mikhail Lapshin
30-
@library /lib/client
31-
@build ExtendedRobot
3229
@run main bug6544309
3330
*/
34-
31+
import java.awt.Robot;
3532
import java.awt.event.ActionEvent;
3633
import java.awt.event.ActionListener;
3734
import java.awt.event.KeyEvent;
@@ -44,19 +41,24 @@
4441
public class bug6544309 {
4542
private JDialog dialog;
4643
private boolean passed;
47-
private static ExtendedRobot robot;
44+
private static Robot robot;
4845

4946
public static void main(String[] args) throws Exception {
50-
robot = new ExtendedRobot();
47+
robot = new Robot();
48+
robot.setAutoDelay(100);
5149
// move mouse outside menu to prevent auto selection
5250
robot.mouseMove(100,100);
51+
robot.waitForIdle();
52+
5353
final bug6544309 test = new bug6544309();
5454
try {
5555
SwingUtilities.invokeAndWait(new Runnable() {
5656
public void run() {
5757
test.setupUI();
5858
}
5959
});
60+
robot.waitForIdle();
61+
robot.delay(1000);
6062
test.test();
6163
System.out.println("Test passed");
6264
} finally {
@@ -95,13 +97,16 @@ private void test() throws Exception {
9597
private void testImpl() throws Exception {
9698
robot.waitForIdle();
9799
System.out.println("Pressing DOWN ARROW");
98-
robot.type(KeyEvent.VK_DOWN);
100+
robot.keyPress(KeyEvent.VK_DOWN);
101+
robot.keyRelease(KeyEvent.VK_DOWN);
99102
robot.waitForIdle();
100103
System.out.println("Pressing DOWN ARROW");
101-
robot.type(KeyEvent.VK_DOWN);
104+
robot.keyPress(KeyEvent.VK_DOWN);
105+
robot.keyRelease(KeyEvent.VK_DOWN);
102106
robot.waitForIdle();
103107
System.out.println("Pressing SPACE");
104-
robot.type(KeyEvent.VK_SPACE);
108+
robot.keyPress(KeyEvent.VK_SPACE);
109+
robot.keyRelease(KeyEvent.VK_SPACE);
105110
}
106111

107112
private void checkResult() {

test/jdk/javax/swing/JPopupMenu/6827786/bug6827786.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ public class bug6827786 {
4949
public static void main(String[] args) throws Exception {
5050
try {
5151
Robot robot = new Robot();
52-
robot.setAutoDelay(50);
52+
robot.setAutoDelay(100);
5353
// move mouse outside menu to prevent auto selection
54-
robot.mouseMove(100,100);
54+
robot.mouseMove(100,100);
55+
robot.waitForIdle();
5556

5657
SwingUtilities.invokeAndWait(new Runnable() {
5758

@@ -61,6 +62,7 @@ public void run() {
6162
});
6263

6364
robot.waitForIdle();
65+
robot.delay(1000);
6466

6567
SwingUtilities.invokeAndWait(new Runnable() {
6668

0 commit comments

Comments
 (0)