Skip to content

Commit

Permalink
8233567: [TESTBUG] FocusSubRequestTest.java fails on macos
Browse files Browse the repository at this point in the history
Backport-of: b90ad76
  • Loading branch information
TheRealMDoerr committed Oct 25, 2021
1 parent cfb1bd2 commit 80e371c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.ja
java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java 8233565 macosx-all
java/awt/keyboard/AllKeyCode/AllKeyCode.java 8242930 macosx-all
java/awt/FullScreen/8013581/bug8013581.java 8169471 macosx-all
java/awt/Focus/FocusSubRequestTest/FocusSubRequestTest.java 8233567 macosx-all
java/awt/event/MouseEvent/RobotLWTest/RobotLWTest.java 8233568 macosx-all
java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java 8233568 macosx-all
java/awt/event/MouseEvent/ClickDuringKeypress/ClickDuringKeypress.java 8233568 macosx-all
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2021, 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
Expand Down Expand Up @@ -62,6 +62,7 @@ public void keyPressed(KeyEvent e) {

try {
robot = new Robot();
robot.setAutoDelay(100);
} catch(Exception e) {
throw new RuntimeException("Error: unable to create robot", e);
}
Expand All @@ -77,7 +78,6 @@ public void start() {

robot.delay(100);
robot.keyPress(KeyEvent.VK_K);
robot.delay(100);
robot.keyRelease(KeyEvent.VK_K);

robot.waitForIdle();
Expand All @@ -90,14 +90,16 @@ public void start() {
}

private void waitTillShown(Component component) {
while (true) {
Point p = null;
while (p == null) {
try {
Thread.sleep(100);
component.getLocationOnScreen();
break;
} catch(InterruptedException ie) {
throw new RuntimeException(ie);
} catch(IllegalComponentStateException icse) {}
p = component.getLocationOnScreen();
} catch (IllegalStateException e) {
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
}
}
}
}
}

1 comment on commit 80e371c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.