8313633: [macOS] java/awt/dnd/NextDropActionTest/NextDropActionTest.java fails with java.lang.RuntimeException: wrong next drop action!

Reviewed-by: honkar, serb
This commit is contained in:
Damon Nguyen 2023-08-10 17:52:28 +00:00
parent 79be8d9383
commit d97de8260c

View File

@ -88,7 +88,7 @@ public class NextDropActionTest {
final DragSourceListener dsl = new DragSourceAdapter() { final DragSourceListener dsl = new DragSourceAdapter() {
boolean firstCall = true; boolean firstCall = true;
public void dragDropEnd(DragSourceDropEvent e) { public void dragDropEnd(DragSourceDropEvent e) {
System.err.println("DragSourseListener.dragDropEnd(): " + System.err.println("DragSourceListener.dragDropEnd(): " +
" firstCall=" + firstCall + " firstCall=" + firstCall +
" drop action=" + e.getDropAction()); " drop action=" + e.getDropAction());
if (firstCall) { if (firstCall) {
@ -140,18 +140,22 @@ public class NextDropActionTest {
robot.keyRelease(KeyEvent.VK_CONTROL); robot.keyRelease(KeyEvent.VK_CONTROL);
LOCK.wait(WAIT_TIMEOUT); LOCK.wait(WAIT_TIMEOUT);
} }
if (!firstEnd) { if (!firstEnd) {
System.err.println("DragSourseListener.dragDropEnd() " + System.err.println("DragSourceListener.dragDropEnd() " +
"was not called, returning"); "was not called, returning");
return; return;
} }
robot.delay(1000);
synchronized (LOCK) { synchronized (LOCK) {
Util.doDragDrop(robot, startPoint, endPoint); Util.doDragDrop(robot, startPoint, endPoint);
LOCK.wait(WAIT_TIMEOUT); LOCK.wait(WAIT_TIMEOUT);
} }
if (!secondEnd) { if (!secondEnd) {
System.err.println("DragSourseListener.dragDropEnd() " + System.err.println("DragSourceListener.dragDropEnd() " +
"was not called, returning"); "was not called, returning");
return; return;
} }
@ -171,7 +175,7 @@ public class NextDropActionTest {
class Util { class Util {
public static int sign(int n) { 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) { public static void doDragDrop(Robot robot, Point startPoint, Point endPoint) {