8196465: javax/swing/JComboBox/8182031/ComboPopupTest.java fails on Linux

Reviewed-by: azvegint
This commit is contained in:
Prasanta Sadhukhan 2022-04-12 13:08:35 +00:00
parent 5851631de2
commit 83466434fd
2 changed files with 11 additions and 23 deletions

View File

@ -718,7 +718,6 @@ javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java 8194048 windows-all
javax/swing/text/DefaultCaret/HidingSelection/MultiSelectionTest.java 8213562 linux-all
javax/swing/JFileChooser/6798062/bug6798062.java 8146446 windows-all
javax/swing/JComboBox/8182031/ComboPopupTest.java 8196465 linux-all,macosx-all
javax/swing/JFileChooser/6738668/bug6738668.java 8194946 generic-all
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java 8065099,8208565 macosx-all,linux-all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,22 +46,6 @@ public class ComboPopupTest {
private volatile Point p = null;
private volatile Dimension d = null;
void blockTillDisplayed(JComponent comp) throws Exception {
while (p == null) {
try {
SwingUtilities.invokeAndWait(() -> {
p = comp.getLocationOnScreen();
d = comboBox.getSize();
});
} catch (IllegalStateException e) {
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
}
}
}
}
public static void main(String[] args) throws Exception {
new ComboPopupTest();
}
@ -69,13 +53,18 @@ public class ComboPopupTest {
public ComboPopupTest() throws Exception {
try {
Robot robot = new Robot();
robot.setAutoDelay(200);
robot.setAutoDelay(100);
SwingUtilities.invokeAndWait(() -> start());
blockTillDisplayed(comboBox);
robot.delay(1000);
SwingUtilities.invokeAndWait(() -> {
p = comboBox.getLocationOnScreen();
d = comboBox.getSize();
});
robot.waitForIdle();
robot.mouseMove(p.x + d.width-1, p.y + d.height/2);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mouseMove(p.x + d.width - 1, p.y + d.height/2);
robot.waitForIdle();
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.waitForIdle();
System.out.println("popmenu visible " + comboBox.isPopupVisible());