Skip to content

Commit 602018d

Browse files
committed
8202667: java/awt/Debug/DumpOnKey/DumpOnKey.java times out on Windows
Backport-of: cd778f5b049d52b68ab5872aad5f81e86e1718f7
1 parent eee7d9c commit 602018d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ java/awt/font/TextLayout/LigatureCaretTest.java 8266312 generic-all
447447
java/awt/image/VolatileImage/CustomCompositeTest.java 8199002 windows-all,linux-all
448448
java/awt/image/VolatileImage/GradientPaints.java 8199003 linux-all
449449
java/awt/JAWT/JAWT.sh 8197798 windows-all,linux-all
450-
java/awt/Debug/DumpOnKey/DumpOnKey.java 8202667 windows-all
451450
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java 8339929 linux-all
452451
java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java 8202860 linux-all
453452
java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882 linux-all

test/jdk/java/awt/Debug/DumpOnKey/DumpOnKey.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
2222
*/
2323

2424
import java.awt.AWTException;
25+
import java.awt.EventQueue;
2526
import java.awt.Frame;
2627
import java.awt.Robot;
2728
import java.awt.Window;
@@ -58,9 +59,11 @@ public void list(final PrintStream out, final int indent) {
5859
w.setSize(200, 200);
5960
w.setLocationRelativeTo(null);
6061
w.setVisible(true);
62+
w.toFront();
63+
w.requestFocus();
6164

6265
final Robot robot = new Robot();
63-
robot.setAutoDelay(50);
66+
robot.setAutoDelay(100);
6467
robot.setAutoWaitForIdle(true);
6568
robot.mouseMove(w.getX() + w.getWidth() / 2,
6669
w.getY() + w.getHeight() / 2);
@@ -74,7 +77,14 @@ public void list(final PrintStream out, final int indent) {
7477
robot.keyRelease(KeyEvent.VK_SHIFT);
7578
robot.keyRelease(KeyEvent.VK_CONTROL);
7679

77-
w.dispose();
80+
try {
81+
EventQueue.invokeAndWait(() -> {
82+
w.dispose();
83+
});
84+
} catch (Exception e) {}
85+
86+
robot.delay(2000);
87+
7888
if (dumped != dump) {
7989
throw new RuntimeException("Exp:" + dump + ", actual:" + dumped);
8090
}

0 commit comments

Comments
 (0)