Skip to content

Commit caec8d2

Browse files
committed
8233560: [TESTBUG] ToolTipManager/Test6256140.java is failing on macos
Reviewed-by: serb
1 parent a5b42ec commit caec8d2

File tree

2 files changed

+45
-37
lines changed

2 files changed

+45
-37
lines changed

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,6 @@ javax/swing/dnd/8139050/NativeErrorsInTableDnD.java 8202765 macosx-all,linux-al
783783
javax/swing/Popup/TaskbarPositionTest.java 8065097 macosx-all,linux-all
784784
javax/swing/JEditorPane/6917744/bug6917744.java 8213124 macosx-all
785785
javax/swing/JTree/6263446/bug6263446.java 8213125 macosx-all
786-
javax/swing/ToolTipManager/Test6256140.java 8233560 macosx-all
787786
javax/swing/text/View/8014863/bug8014863.java 8233561 macosx-all
788787
javax/swing/text/StyledEditorKit/4506788/bug4506788.java 8233562 macosx-all
789788
javax/swing/text/JTextComponent/6361367/bug6361367.java 8233569 macosx-all

test/jdk/javax/swing/ToolTipManager/Test6256140.java

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,49 +40,58 @@ public class Test6256140 {
4040

4141
private final static String initialText = "value";
4242
private final static JLabel toolTipLabel = new JLabel("tip");
43+
private static JFrame frame;
4344

4445
public static void main(String[] args) throws Exception {
45-
46-
Robot robot = new Robot();
47-
robot.setAutoDelay(10);
48-
49-
SwingUtilities.invokeAndWait(new Runnable() {
50-
public void run() {
51-
createAndShowGUI();
46+
try {
47+
Robot robot = new Robot();
48+
robot.setAutoDelay(100);
49+
50+
SwingUtilities.invokeAndWait(new Runnable() {
51+
public void run() {
52+
createAndShowGUI();
53+
}
54+
});
55+
robot.waitForIdle();
56+
robot.delay(1000);
57+
58+
Point point = ft.getLocationOnScreen();
59+
robot.mouseMove(point.x, point.y);
60+
robot.waitForIdle();
61+
robot.mouseMove(point.x + 3, point.y + 3);
62+
robot.waitForIdle();
63+
64+
robot.keyPress(KeyEvent.VK_A);
65+
robot.keyRelease(KeyEvent.VK_A);
66+
robot.waitForIdle();
67+
68+
if (!isTooltipShowning()) {
69+
throw new RuntimeException("Tooltip is not shown");
5270
}
53-
});
54-
robot.waitForIdle();
55-
56-
Point point = ft.getLocationOnScreen();
57-
robot.mouseMove(point.x, point.y);
58-
robot.mouseMove(point.x + 3, point.y + 3);
5971

60-
robot.keyPress(KeyEvent.VK_A);
61-
robot.keyRelease(KeyEvent.VK_A);
62-
robot.waitForIdle();
63-
64-
if (!isTooltipShowning()) {
65-
throw new RuntimeException("Tooltip is not shown");
66-
}
72+
robot.keyPress(KeyEvent.VK_ESCAPE);
73+
robot.keyRelease(KeyEvent.VK_ESCAPE);
74+
robot.waitForIdle();
6775

68-
robot.keyPress(KeyEvent.VK_ESCAPE);
69-
robot.keyRelease(KeyEvent.VK_ESCAPE);
70-
robot.waitForIdle();
71-
72-
if (isTooltipShowning()) {
73-
throw new RuntimeException("Tooltip must be hidden now");
74-
}
76+
if (isTooltipShowning()) {
77+
throw new RuntimeException("Tooltip must be hidden now");
78+
}
7579

76-
if (isTextEqual()) {
77-
throw new RuntimeException("FormattedTextField must *not* cancel the updated value this time");
78-
}
80+
if (isTextEqual()) {
81+
throw new RuntimeException("FormattedTextField must *not* cancel the updated value this time");
82+
}
7983

80-
robot.keyPress(KeyEvent.VK_ESCAPE);
81-
robot.keyRelease(KeyEvent.VK_ESCAPE);
82-
robot.waitForIdle();
84+
robot.keyPress(KeyEvent.VK_ESCAPE);
85+
robot.keyRelease(KeyEvent.VK_ESCAPE);
86+
robot.waitForIdle();
8387

84-
if (!isTextEqual()) {
85-
throw new RuntimeException("FormattedTextField must cancel the updated value");
88+
if (!isTextEqual()) {
89+
throw new RuntimeException("FormattedTextField must cancel the updated value");
90+
}
91+
} finally {
92+
if (frame != null) {
93+
SwingUtilities.invokeAndWait(frame::dispose);
94+
}
8695
}
8796
}
8897

@@ -116,7 +125,7 @@ private static void createAndShowGUI() {
116125
ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
117126
ToolTipManager.sharedInstance().setInitialDelay(0);
118127

119-
final JFrame frame = new JFrame();
128+
frame = new JFrame();
120129
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
121130
frame.setLayout(new FlowLayout());
122131

0 commit comments

Comments
 (0)