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

8163367: Test javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java javax/swing/JComboBox/8033069/bug8033069ScrollBar.java fails intermittently #3678

Closed
wants to merge 4 commits into from
Closed
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
@@ -734,7 +734,6 @@ javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java 81
javax/swing/JWindow/ShapedAndTranslucentWindows/SetShapeAndClickSwing.java 8013450 macosx-all
javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java 8024627 macosx-all
# The next test below is an intermittent failure
javax/swing/JComboBox/8033069/bug8033069ScrollBar.java 8163367 generic-all
javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all
javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all
javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all
@@ -45,9 +45,8 @@
* @library ../../regtesthelpers
* @build Util
* @run main bug8033069NoScrollBar
* @author Alexey Ivanov
*/
public class bug8033069NoScrollBar implements Runnable {
public class bug8033069NoScrollBar {

private static final String[] NO_SCROLL_ITEMS = new String[] {
"A", "B", "C", "D", "E", "F"
@@ -61,6 +60,9 @@ public class bug8033069NoScrollBar implements Runnable {
private JComboBox cb1;
private JComboBox cb2;

private volatile Point p;
private volatile Dimension d;

public static void main(String[] args) throws Exception {
iterateLookAndFeels(new bug8033069NoScrollBar(NO_SCROLL_ITEMS));
}
@@ -98,24 +100,34 @@ private void setupUI() {
frame.add(panel);

frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}

private void disposeUI() {
if (frame != null) {
frame.dispose();
}
}

public void runTest() throws Exception {
try {
SwingUtilities.invokeAndWait(this);
SwingUtilities.invokeAndWait(this::setupUI);

robot.waitForIdle();
assertFalse("cb1 popup is visible",
Util.invokeOnEDT(cb1::isPopupVisible));

// Move mouse pointer to the center of the fist combo box
Point p = cb1.getLocationOnScreen();
Dimension d = cb1.getSize();
SwingUtilities.invokeAndWait(() -> {
p = cb1.getLocationOnScreen();
d = cb1.getSize();
});

robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2);
// Click it to open popup
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

robot.waitForIdle();
assertTrue("cb1 popup is not visible",
@@ -146,28 +158,24 @@ public void runTest() throws Exception {


// Move mouse pointer to the center of the second combo box
p = cb2.getLocationOnScreen();
d = cb2.getSize();
SwingUtilities.invokeAndWait(() -> {
p = cb2.getLocationOnScreen();
d = cb2.getSize();
});

robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2);

robot.mouseWheel(1);
robot.waitForIdle();
assertFalse("cb1 popup is visible after mouse wheel up on cb2",
Util.invokeOnEDT(cb1::isPopupVisible));
} finally {
if (frame != null) {
frame.dispose();
}
SwingUtilities.invokeAndWait(this::disposeUI);
}

System.out.println("Test passed");
}

@Override
public void run() {
setupUI();
}

private static void assertTrue(String message, boolean value) {
assertEquals(message, true, value);
}