changeset 10703:d9b7ff88960d

8191269: Intermittent unit test failure in SwingNodeJDialogTest Reviewed-by: kcr
author azvegint
date Thu, 16 Nov 2017 09:57:31 +0530
parents bad75af55855
children f35915708e0c
files tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeBase.java tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeJDialogTest.java
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeBase.java	Mon Nov 13 18:37:33 2017 -0800
+++ b/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeBase.java	Thu Nov 16 09:57:31 2017 +0530
@@ -210,9 +210,11 @@
         int checkLoc = BASE_LOCATION + 3 * BASE_SIZE /4;
         int clickLoc = BASE_LOCATION + BASE_SIZE / 4;
 
-        robot.mouseMove(clickLoc, clickLoc);
-        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
-        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        if (myApp.stage != null && myApp.stage.isShowing()) {
+            robot.mouseMove(clickLoc, clickLoc);
+            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        }
 
         if (above) {
             Assert.assertEquals("JDialog is not above JavaFX stage",
--- a/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeJDialogTest.java	Mon Nov 13 18:37:33 2017 -0800
+++ b/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeJDialogTest.java	Thu Nov 16 09:57:31 2017 +0530
@@ -84,7 +84,7 @@
         myApp.createStageAndDialog();
         myApp.closeStage();
         myApp.showDialog();
-        testAbove(false);
+        testAbove(true);
         myApp.disposeDialog();
     }
 
@@ -102,7 +102,7 @@
         latch.await();
         myApp.detachSwingNode();
         testAbove(false);
-        myApp.disposeDialog();
+        myApp.closeStageAndDialog();
         myApp.attachSwingNode();
     }