8233634: [TESTBUG] Swing text test bug4278839.java fails on macos
authorpsadhukhan
Thu, 14 Nov 2019 10:59:45 +0530
changeset 59188 9db62a092725
parent 59187 ede8023f6b72
child 59189 b5cdba232fca
8233634: [TESTBUG] Swing text test bug4278839.java fails on macos Reviewed-by: serb
test/jdk/ProblemList.txt
test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java
--- a/test/jdk/ProblemList.txt	Thu Nov 14 10:56:09 2019 +0530
+++ b/test/jdk/ProblemList.txt	Thu Nov 14 10:59:45 2019 +0530
@@ -842,7 +842,6 @@
 javax/swing/text/JTextComponent/6361367/bug6361367.java 8233569 macosx-all
 javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java 233570 macosx-all
 javax/swing/text/GlyphPainter2/6427244/bug6427244.java 8208566 macosx-all
-javax/swing/text/DefaultEditorKit/4278839/bug4278839.java 8233634 macosx-all
 javax/swing/ProgressMonitor/ProgressMonitorEscapeKeyPress.java 8233635 macosx-all
 javax/swing/plaf/nimbus/TestNimbusOverride.java 8233559 macosx-all
 javax/swing/JTree/4927934/bug4927934.java 8233550 macosx-all
--- a/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java	Thu Nov 14 10:56:09 2019 +0530
+++ b/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java	Thu Nov 14 10:59:45 2019 +0530
@@ -24,7 +24,7 @@
 /*
  * @test
  * @key headful
- * @bug 4278839
+ * @bug 4278839 8233634
  * @summary Incorrect cursor movement between words at the end of line
  * @author Anton Nashatyrev
  * @library ../../../regtesthelpers
@@ -41,12 +41,13 @@
     private static boolean passed = true;
     private static JTextArea area;
     private static Robot robo;
+    private static JFrame frame;
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         try {
 
             robo = new Robot();
-            robo.setAutoDelay(100);
+            robo.setAutoDelay(200);
 
             SwingUtilities.invokeAndWait(new Runnable() {
                 @Override
@@ -60,6 +61,7 @@
             clickMouse();
             robo.waitForIdle();
 
+            area.setCaretPosition(0);
 
             if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
                 Util.hitKeys(robo, KeyEvent.VK_HOME);
@@ -86,6 +88,10 @@
         } catch (Exception e) {
             throw new RuntimeException("Test failed because of an exception:",
                     e);
+        } finally {
+            if (frame != null) {
+                SwingUtilities.invokeAndWait(() -> frame.dispose());
+            }
         }
 
         if (!passed) {
@@ -143,7 +149,7 @@
     }
 
     private static void createAndShowGUI() {
-        JFrame frame = new JFrame();
+        frame = new JFrame();
         frame.setTitle("Bug# 4278839");
         frame.setSize(200, 200);
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);