Skip to content

Commit

Permalink
8233551: [TESTBUG] SelectEditTableCell.java fails on MacOS
Browse files Browse the repository at this point in the history
Reviewed-by: phh
Backport-of: 9b3fb5d1d5a6a3f0fc699b10bdff6d43ae8d1898
  • Loading branch information
Victor Rudometov authored and Paul Hohensee committed Nov 9, 2022
1 parent 736c1fb commit 3a1a2e0
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions jdk/test/javax/swing/JTable/7124218/SelectEditTableCell.java
Expand Up @@ -48,23 +48,28 @@ public class SelectEditTableCell {

public static void main(String[] args) throws Exception {
robot = new Robot();
robot.delay(2000);
robot.setAutoDelay(100);
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
executeCase(lookAndFeelItem.getClassName());
}

}

private static void executeCase(String lookAndFeelString) throws Exception {
if (tryLookAndFeel(lookAndFeelString)) {
createUI(lookAndFeelString);
robot.delay(2000);
runTestCase();
robot.delay(2000);
cleanUp();
robot.delay(2000);
try {
if (tryLookAndFeel(lookAndFeelString)) {
createUI(lookAndFeelString);
robot.delay(2000);
runTestCase();
robot.delay(2000);
cleanUp();
robot.delay(2000);
}
} finally {
if (frame != null) {
SwingUtilities.invokeAndWait(frame::dispose);
}
}

}
Expand Down Expand Up @@ -98,6 +103,7 @@ private static void runTestCase() throws Exception {
robot.mouseMove(centerPoint.x, centerPoint.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.waitForIdle();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
Expand All @@ -110,7 +116,7 @@ public void run() {
}
}
});
robot.waitForIdle();

int fetchKeyCode;
keyTap(fetchKeyCode = isMac(lookAndFeel)
? KeyEvent.VK_ENTER : KeyEvent.VK_SPACE);
Expand All @@ -127,7 +133,7 @@ public void run() {
}
}
});
robot.waitForIdle();

keyTap(KeyEvent.VK_SPACE);
robot.waitForIdle();
SwingUtilities.invokeAndWait(new Runnable() {
Expand All @@ -147,10 +153,12 @@ public void run() {
}
}
});
robot.waitForIdle();

// hitting a letter key will start editing
keyTap(KeyEvent.VK_A);
robot.waitForIdle();
keyTap(KeyEvent.VK_SPACE);
robot.waitForIdle();
keyTap(KeyEvent.VK_A);
robot.waitForIdle();
SwingUtilities.invokeAndWait(new Runnable() {
Expand Down

1 comment on commit 3a1a2e0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.