Skip to content

Commit e11476c

Browse files
committed
8233551: [TESTBUG] SelectEditTableCell.java fails on MacOS
Reviewed-by: mdoerr Backport-of: 9b3fb5d
1 parent d14462f commit e11476c

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java 802462
697697
javax/swing/JComboBox/8033069/bug8033069ScrollBar.java 8163367 generic-all
698698
javax/swing/JColorChooser/Test6827032.java 8197825 windows-all
699699
javax/swing/JColorChooser/Test7194184.java 8194126 linux-all,macosx-all
700-
javax/swing/JTable/7124218/SelectEditTableCell.java 8148958 linux-all,macosx-all
701700
javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all
702701
javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all
703702
javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all

test/jdk/javax/swing/JTable/7124218/SelectEditTableCell.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,28 @@ public class SelectEditTableCell {
5050

5151
public static void main(String[] args) throws Exception {
5252
robot = new Robot();
53-
robot.delay(2000);
53+
robot.setAutoDelay(100);
5454
UIManager.LookAndFeelInfo[] lookAndFeelArray
5555
= UIManager.getInstalledLookAndFeels();
5656
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
5757
executeCase(lookAndFeelItem.getClassName());
5858
}
59-
6059
}
6160

6261
private static void executeCase(String lookAndFeelString) throws Exception {
63-
if (tryLookAndFeel(lookAndFeelString)) {
64-
createUI(lookAndFeelString);
65-
robot.delay(2000);
66-
runTestCase();
67-
robot.delay(2000);
68-
cleanUp();
69-
robot.delay(2000);
62+
try {
63+
if (tryLookAndFeel(lookAndFeelString)) {
64+
createUI(lookAndFeelString);
65+
robot.delay(2000);
66+
runTestCase();
67+
robot.delay(2000);
68+
cleanUp();
69+
robot.delay(2000);
70+
}
71+
} finally {
72+
if (frame != null) {
73+
SwingUtilities.invokeAndWait(frame::dispose);
74+
}
7075
}
7176

7277
}
@@ -100,6 +105,7 @@ private static void runTestCase() throws Exception {
100105
robot.mouseMove(centerPoint.x, centerPoint.y);
101106
robot.mousePress(InputEvent.BUTTON1_MASK);
102107
robot.mouseRelease(InputEvent.BUTTON1_MASK);
108+
robot.waitForIdle();
103109
SwingUtilities.invokeAndWait(new Runnable() {
104110
@Override
105111
public void run() {
@@ -112,7 +118,7 @@ public void run() {
112118
}
113119
}
114120
});
115-
robot.waitForIdle();
121+
116122
int fetchKeyCode;
117123
keyTap(fetchKeyCode = isMac(lookAndFeel)
118124
? KeyEvent.VK_ENTER : KeyEvent.VK_SPACE);
@@ -129,7 +135,7 @@ public void run() {
129135
}
130136
}
131137
});
132-
robot.waitForIdle();
138+
133139
keyTap(KeyEvent.VK_SPACE);
134140
robot.waitForIdle();
135141
SwingUtilities.invokeAndWait(new Runnable() {
@@ -149,10 +155,12 @@ public void run() {
149155
}
150156
}
151157
});
152-
robot.waitForIdle();
158+
153159
// hitting a letter key will start editing
154160
keyTap(KeyEvent.VK_A);
161+
robot.waitForIdle();
155162
keyTap(KeyEvent.VK_SPACE);
163+
robot.waitForIdle();
156164
keyTap(KeyEvent.VK_A);
157165
robot.waitForIdle();
158166
SwingUtilities.invokeAndWait(new Runnable() {

0 commit comments

Comments
 (0)