Skip to content

Commit 2037107

Browse files
author
duke
committed
Backport 1f6bd0c3e509029bbf524b0ba34ce44601ac0b6a
1 parent 6236ffb commit 2037107

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

test/jdk/ProblemList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java 8169476 windows
195195
java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 8169474,8224055 macosx-all,windows-all
196196
java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java 8298910 linux-all
197197

198+
java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java 8242805 macosx-all
198199
java/awt/dnd/DnDCursorCrashTest.java 8242805 macosx-all
199200
java/awt/dnd/DnDClipboardDeadlockTest.java 8079553 linux-all
200201
java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java 8194947 generic-all

test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ public class DnDRemoveFocusOwnerCrashTest {
6464
public static Frame frame;
6565
public static Robot robot;
6666
public static DragSourceButton dragSourceButton;
67+
static volatile Point p;
6768

6869
public static void main(String[] args) throws Exception {
6970
try {
7071
robot = new Robot();
72+
robot.setAutoWaitForIdle(true);
73+
robot.delay(FRAME_ACTIVATION_TIMEOUT);
7174
EventQueue.invokeAndWait(() -> {
7275
frame = new Frame();
7376
dragSourceButton = new DragSourceButton();
@@ -79,37 +82,33 @@ public static void main(String[] args) throws Exception {
7982
frame.add(dropTargetPanel);
8083
frame.pack();
8184
frame.setVisible(true);
85+
});
8286

83-
try {
84-
robot.delay(FRAME_ACTIVATION_TIMEOUT);
85-
} catch (Exception e) {
86-
e.printStackTrace();
87-
throw new RuntimeException("The test failed.");
88-
}
87+
robot.waitForIdle();
88+
robot.delay(FRAME_ACTIVATION_TIMEOUT);
8989

90-
Point p = dragSourceButton.getLocationOnScreen();
90+
EventQueue.invokeAndWait(() -> {
91+
p = dragSourceButton.getLocationOnScreen();
9192
p.translate(10, 10);
93+
});
9294

93-
try {
94-
Robot robot = new Robot();
95-
robot.mouseMove(p.x, p.y);
96-
robot.keyPress(KeyEvent.VK_CONTROL);
97-
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
98-
for (int dy = 0; dy < 50; dy++) {
99-
robot.mouseMove(p.x, p.y + dy);
100-
robot.delay(10);
101-
}
102-
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
103-
robot.keyRelease(KeyEvent.VK_CONTROL);
104-
} catch (Exception e) {
105-
e.printStackTrace();
106-
throw new RuntimeException("The test failed.");
95+
robot.delay(FRAME_ACTIVATION_TIMEOUT);
96+
robot.mouseMove(p.x, p.y);
97+
robot.delay(FRAME_ACTIVATION_TIMEOUT);
98+
robot.keyPress(KeyEvent.VK_CONTROL);
99+
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
100+
for (int dy = 0; dy < 50; dy++) {
101+
robot.mouseMove(p.x, p.y + dy);
102+
robot.delay(10);
103+
}
104+
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
105+
robot.keyRelease(KeyEvent.VK_CONTROL);
106+
} finally {
107+
EventQueue.invokeAndWait(() -> {
108+
if (frame != null) {
109+
frame.dispose();
107110
}
108111
});
109-
} finally {
110-
if (frame != null) {
111-
EventQueue.invokeAndWait(() -> frame.dispose());
112-
}
113112
}
114113
}
115114

0 commit comments

Comments
 (0)