Skip to content

Commit 0beb271

Browse files
committed
8196465: javax/swing/JComboBox/8182031/ComboPopupTest.java fails on Linux
Backport-of: 83466434fda3bd048fa8e2d274a797a7d9506c16
1 parent 8ea7310 commit 0beb271

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
694694
javax/swing/JTabbedPane/4624207/bug4624207.java 8064922 macosx-all
695695
javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
696696
javax/swing/JFileChooser/6798062/bug6798062.java 8146446 windows-all
697-
javax/swing/JComboBox/8182031/ComboPopupTest.java 8196465 linux-all,macosx-all
698697
javax/swing/JFileChooser/6738668/bug6738668.java 8194946 generic-all
699698
javax/swing/JInternalFrame/Test6325652.java 8224977 macosx-all
700699
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all

test/jdk/javax/swing/JComboBox/8182031/ComboPopupTest.java

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -46,36 +46,25 @@ public class ComboPopupTest {
4646
private volatile Point p = null;
4747
private volatile Dimension d = null;
4848

49-
void blockTillDisplayed(JComponent comp) throws Exception {
50-
while (p == null) {
51-
try {
52-
SwingUtilities.invokeAndWait(() -> {
53-
p = comp.getLocationOnScreen();
54-
d = comboBox.getSize();
55-
});
56-
} catch (IllegalStateException e) {
57-
try {
58-
Thread.sleep(1000);
59-
} catch (InterruptedException ie) {
60-
}
61-
}
62-
}
63-
}
64-
6549
public static void main(String[] args) throws Exception {
6650
new ComboPopupTest();
6751
}
6852

6953
public ComboPopupTest() throws Exception {
7054
try {
7155
Robot robot = new Robot();
72-
robot.setAutoDelay(200);
56+
robot.setAutoDelay(100);
7357
SwingUtilities.invokeAndWait(() -> start());
74-
blockTillDisplayed(comboBox);
58+
robot.delay(1000);
59+
SwingUtilities.invokeAndWait(() -> {
60+
p = comboBox.getLocationOnScreen();
61+
d = comboBox.getSize();
62+
});
63+
robot.waitForIdle();
64+
robot.mouseMove(p.x + d.width - 1, p.y + d.height/2);
7565
robot.waitForIdle();
76-
robot.mouseMove(p.x + d.width-1, p.y + d.height/2);
77-
robot.mousePress(InputEvent.BUTTON1_MASK);
78-
robot.mouseRelease(InputEvent.BUTTON1_MASK);
66+
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
67+
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
7968
robot.waitForIdle();
8069

8170
System.out.println("popmenu visible " + comboBox.isPopupVisible());

0 commit comments

Comments
 (0)