changeset 14473:18b7da5618f5

8196092: javax/swing/JComboBox/8032878/bug8032878.java fails Reviewed-by: serb, pbansal
author psadhukhan
date Mon, 14 Dec 2020 11:34:39 +0000
parents a6258600dfe0
children 63e69aef6997
files test/javax/swing/JComboBox/8032878/bug8032878.java
diffstat 1 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/swing/JComboBox/8032878/bug8032878.java	Fri May 22 17:30:21 2015 +0300
+++ b/test/javax/swing/JComboBox/8032878/bug8032878.java	Mon Dec 14 11:34:39 2020 +0000
@@ -26,9 +26,6 @@
  * @summary Checks that JComboBox as JTable cell editor processes key events
  *          even where setSurrendersFocusOnKeystroke flag in JTable is false and
  *          that it does not lose the first key press where the flag is true.
- * @library ../../regtesthelpers
- * @build Util
- * @author Alexey Ivanov
  * @run main bug8032878
  */
 
@@ -84,6 +81,7 @@
 
         frame.pack();
         frame.setVisible(true);
+        frame.setLocationRelativeTo(null);
     }
 
     private void test(final boolean flag) throws Exception {
@@ -91,11 +89,13 @@
             surrender = flag;
             SwingUtilities.invokeAndWait(this);
 
+            robot.waitForIdle();
+            robot.delay(1000);
             runTest();
             checkResult();
         } finally {
             if (frame != null) {
-                frame.dispose();
+                SwingUtilities.invokeAndWait(() -> frame.dispose());
             }
         }
     }
@@ -103,12 +103,20 @@
     private void runTest() throws Exception {
         robot.waitForIdle();
         // Select 'one'
-        Util.hitKeys(robot, KeyEvent.VK_TAB);
+        robot.keyPress(KeyEvent.VK_TAB);
+        robot.keyRelease(KeyEvent.VK_TAB);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_1);
+        robot.keyRelease(KeyEvent.VK_1);
         robot.waitForIdle();
-        Util.hitKeys(robot, KeyEvent.VK_1);
-        Util.hitKeys(robot, KeyEvent.VK_2);
-        Util.hitKeys(robot, KeyEvent.VK_3);
-        Util.hitKeys(robot, KeyEvent.VK_ENTER);
+        robot.keyPress(KeyEvent.VK_2);
+        robot.keyRelease(KeyEvent.VK_2);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_3);
+        robot.keyRelease(KeyEvent.VK_3);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
         robot.waitForIdle();
     }