From d97de8260c19e468c87221e28f29128e56ec8ee1 Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Thu, 10 Aug 2023 17:52:28 +0000 Subject: [PATCH] 8313633: [macOS] java/awt/dnd/NextDropActionTest/NextDropActionTest.java fails with java.lang.RuntimeException: wrong next drop action! Reviewed-by: honkar, serb --- .../dnd/NextDropActionTest/NextDropActionTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java b/test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java index e4d61a5d166..04acf61e11a 100644 --- a/test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java +++ b/test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java @@ -88,7 +88,7 @@ public class NextDropActionTest { final DragSourceListener dsl = new DragSourceAdapter() { boolean firstCall = true; public void dragDropEnd(DragSourceDropEvent e) { - System.err.println("DragSourseListener.dragDropEnd(): " + + System.err.println("DragSourceListener.dragDropEnd(): " + " firstCall=" + firstCall + " drop action=" + e.getDropAction()); if (firstCall) { @@ -140,18 +140,22 @@ public class NextDropActionTest { robot.keyRelease(KeyEvent.VK_CONTROL); LOCK.wait(WAIT_TIMEOUT); } + if (!firstEnd) { - System.err.println("DragSourseListener.dragDropEnd() " + + System.err.println("DragSourceListener.dragDropEnd() " + "was not called, returning"); return; } + robot.delay(1000); + synchronized (LOCK) { Util.doDragDrop(robot, startPoint, endPoint); LOCK.wait(WAIT_TIMEOUT); } + if (!secondEnd) { - System.err.println("DragSourseListener.dragDropEnd() " + + System.err.println("DragSourceListener.dragDropEnd() " + "was not called, returning"); return; } @@ -171,7 +175,7 @@ public class NextDropActionTest { class Util { public static int sign(int n) { - return n < 0 ? -1 : n == 0 ? 0 : 1; + return Integer.compare(n, 0); } public static void doDragDrop(Robot robot, Point startPoint, Point endPoint) {