From 1f6bd0c3e509029bbf524b0ba34ce44601ac0b6a Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Fri, 11 Oct 2024 20:03:14 +0000 Subject: [PATCH] 8341972: java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java timed out after JDK-8341257 Reviewed-by: azvegint --- test/jdk/ProblemList.txt | 1 + .../awt/dnd/DnDRemoveFocusOwnerCrashTest.java | 49 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index db0794f8f2d..034830a2575 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -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 diff --git a/test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java b/test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java index 27cf54e1845..1fc7c2e82b8 100644 --- a/test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java +++ b/test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java @@ -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()); - } } }