Skip to content

Commit

Permalink
Access in EDT
Browse files Browse the repository at this point in the history
  • Loading branch information
prsadhuk committed Jun 3, 2024
1 parent d2f9256 commit 78b3e70
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/jdk/javax/swing/JMenu/TestUngrab.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class TestUngrab {
static volatile Dimension dim;
static volatile int width;
static volatile int height;
static volatile boolean popupVisible;

private static void createAndShowGUI() {
frame = new JFrame();
Expand All @@ -79,6 +80,7 @@ public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(() -> createAndShowGUI());
robot.waitForIdle();
robot.delay(1000);

SwingUtilities.invokeAndWait(() -> {
point = menu.getLocationOnScreen();
dim = menu.getSize();
Expand All @@ -88,6 +90,7 @@ public static void main(String[] args) throws Exception {
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.waitForIdle();

SwingUtilities.invokeAndWait(() -> {
loc = frame.getLocationOnScreen();
width = frame.getWidth();
Expand All @@ -97,8 +100,12 @@ public static void main(String[] args) throws Exception {
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(1000);
System.out.println("isPopupMenuVisible " + menu.isPopupMenuVisible());
if (menu.isPopupMenuVisible()) {

SwingUtilities.invokeAndWait(() -> {
popupVisible = menu.isPopupMenuVisible();
});
System.out.println("isPopupMenuVisible " + popupVisible);
if (popupVisible) {
throw new RuntimeException("popup menu not closed on resize");
}
} finally {
Expand Down

0 comments on commit 78b3e70

Please sign in to comment.