8341972: java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java timed out after JDK-8341257

Reviewed-by: azvegint
This commit is contained in:
Damon Nguyen 2024-10-11 20:03:14 +00:00
parent 7276a1bec0
commit 1f6bd0c3e5
2 changed files with 25 additions and 25 deletions

View File

@ -201,6 +201,7 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java 8169476 windows
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 8169474,8224055 macosx-all,windows-all
java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java 8298910 linux-all
java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java 8242805 macosx-all
java/awt/dnd/DnDCursorCrashTest.java 8242805 macosx-all
java/awt/dnd/DnDClipboardDeadlockTest.java 8079553 linux-all
java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java 8194947 generic-all

View File

@ -64,10 +64,13 @@ public class DnDRemoveFocusOwnerCrashTest {
public static Frame frame;
public static Robot robot;
public static DragSourceButton dragSourceButton;
static volatile Point p;
public static void main(String[] args) throws Exception {
try {
robot = new Robot();
robot.setAutoWaitForIdle(true);
robot.delay(FRAME_ACTIVATION_TIMEOUT);
EventQueue.invokeAndWait(() -> {
frame = new Frame();
dragSourceButton = new DragSourceButton();
@ -79,37 +82,33 @@ public class DnDRemoveFocusOwnerCrashTest {
frame.add(dropTargetPanel);
frame.pack();
frame.setVisible(true);
});
try {
robot.delay(FRAME_ACTIVATION_TIMEOUT);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("The test failed.");
}
robot.waitForIdle();
robot.delay(FRAME_ACTIVATION_TIMEOUT);
Point p = dragSourceButton.getLocationOnScreen();
EventQueue.invokeAndWait(() -> {
p = dragSourceButton.getLocationOnScreen();
p.translate(10, 10);
});
try {
Robot robot = new Robot();
robot.mouseMove(p.x, p.y);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
for (int dy = 0; dy < 50; dy++) {
robot.mouseMove(p.x, p.y + dy);
robot.delay(10);
}
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.keyRelease(KeyEvent.VK_CONTROL);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("The test failed.");
robot.delay(FRAME_ACTIVATION_TIMEOUT);
robot.mouseMove(p.x, p.y);
robot.delay(FRAME_ACTIVATION_TIMEOUT);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
for (int dy = 0; dy < 50; dy++) {
robot.mouseMove(p.x, p.y + dy);
robot.delay(10);
}
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.keyRelease(KeyEvent.VK_CONTROL);
} finally {
EventQueue.invokeAndWait(() -> {
if (frame != null) {
frame.dispose();
}
});
} finally {
if (frame != null) {
EventQueue.invokeAndWait(() -> frame.dispose());
}
}
}