Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DamonGuy committed Oct 11, 2024
1 parent 7276a1b commit 8840b49
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
1 change: 1 addition & 0 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 15 additions & 24 deletions test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ public class DnDRemoveFocusOwnerCrashTest {
public static Frame frame;
public static Robot robot;
public static DragSourceButton dragSourceButton;
public static 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();
Expand All @@ -80,32 +83,20 @@ public static void main(String[] args) throws Exception {
frame.pack();
frame.setVisible(true);

try {
robot.delay(FRAME_ACTIVATION_TIMEOUT);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("The test failed.");
}

Point p = dragSourceButton.getLocationOnScreen();
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 {
if (frame != null) {
EventQueue.invokeAndWait(() -> frame.dispose());
Expand Down

0 comments on commit 8840b49

Please sign in to comment.