diff --git a/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeBase.java b/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeBase.java index b1702deeb02..c49e810f5a7 100644 --- a/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeBase.java +++ b/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeBase.java @@ -191,11 +191,6 @@ public ColorPanel(java.awt.Color color) { } } - private static boolean isOnWayland() { - String waylandDisplay = System.getenv("WAYLAND_DISPLAY"); - return waylandDisplay != null && !waylandDisplay.isEmpty(); - } - public void testAbove(boolean above) { int checkLoc = BASE_LOCATION + 3 * BASE_SIZE /4; int clickLoc = BASE_LOCATION + BASE_SIZE / 4; @@ -207,7 +202,7 @@ public void testAbove(boolean above) { // Emulating mouse clicks on XWayland with XTEST does not currently affect the Wayland compositor, // so trying to click on the window title or window body will not bring the window to the front. - if (isOnWayland()) { + if (Util.isOnWayland()) { runWaitSleep(() -> myApp.stage.toFront()); } } diff --git a/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeJDialogTest.java b/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeJDialogTest.java index 5be7c2c30ab..f4e001e090b 100644 --- a/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeJDialogTest.java +++ b/tests/system/src/test/java/test/robot/javafx/embed/swing/SwingNodeJDialogTest.java @@ -32,10 +32,13 @@ import java.lang.reflect.InvocationTargetException; import java.util.concurrent.CountDownLatch; +import static org.junit.Assume.assumeTrue; + public class SwingNodeJDialogTest extends SwingNodeBase { @Test(timeout = 15000) public void testJDialogAbove() throws InterruptedException, InvocationTargetException { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 myApp.createStageAndDialog(); myApp.showDialog(); @@ -46,6 +49,7 @@ public void testJDialogAbove() throws InterruptedException, InvocationTargetExce @Test(timeout = 15000) public void testNodeRemovalAfterShow() throws InterruptedException, InvocationTargetException { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 myApp.createStageAndDialog(); myApp.showDialog(); @@ -60,6 +64,7 @@ public void testNodeRemovalAfterShow() throws InterruptedException, InvocationTa @Test(timeout = 15000) public void testNodeRemovalBeforeShow() throws InterruptedException, InvocationTargetException { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 myApp.createStageAndDialog(); myApp.detachSwingNode(); myApp.showDialog(); @@ -72,6 +77,7 @@ public void testNodeRemovalBeforeShow() throws InterruptedException, InvocationT @Test(timeout = 15000) public void testStageCloseAfterShow() throws InvocationTargetException, InterruptedException { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 myApp.createStageAndDialog(); myApp.showDialog(); testAbove(true); @@ -81,6 +87,7 @@ public void testStageCloseAfterShow() throws InvocationTargetException, Interrup @Test(timeout = 15000) public void testStageCloseBeforeShow() throws InvocationTargetException, InterruptedException { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 myApp.createStageAndDialog(); myApp.closeStage(); myApp.showDialog(); @@ -91,6 +98,7 @@ public void testStageCloseBeforeShow() throws InvocationTargetException, Interru @Test(timeout = 15000) public void testNodeRemovalBeforeShowHoldEDT() throws InterruptedException, InvocationTargetException { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 myApp.createAndShowStage(); CountDownLatch latch = new CountDownLatch(1); SwingUtilities.invokeLater(()-> { @@ -108,6 +116,7 @@ public void testNodeRemovalBeforeShowHoldEDT() throws InterruptedException, Invo @Test(timeout = 15000) public void testStageCloseBeforeShowHoldEDT() throws InvocationTargetException, InterruptedException { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 myApp.createAndShowStage(); CountDownLatch latch = new CountDownLatch(1); SwingUtilities.invokeLater(()-> { diff --git a/tests/system/src/test/java/test/robot/javafx/scene/SRGBTest.java b/tests/system/src/test/java/test/robot/javafx/scene/SRGBTest.java index 829cbdcdf4a..7cef9f3c6d2 100644 --- a/tests/system/src/test/java/test/robot/javafx/scene/SRGBTest.java +++ b/tests/system/src/test/java/test/robot/javafx/scene/SRGBTest.java @@ -52,6 +52,7 @@ import static org.junit.Assume.assumeTrue; import test.robot.testharness.VisualTestBase; +import test.util.Util; public class SRGBTest extends VisualTestBase { @@ -218,6 +219,7 @@ public void screenCaptureTest() { // Timeout for potential hang on XWayland, see JDK-8335468. @Test(timeout = 15000) public void sRGBPixelTest() throws Exception { + assumeTrue(!Util.isOnWayland()); // JDK-8335470 Rectangle swatch = prepareStage(); for (TestColor testColor : TestColor.values()) { diff --git a/tests/system/src/test/java/test/util/Util.java b/tests/system/src/test/java/test/util/Util.java index e7396c6da36..7014705a332 100644 --- a/tests/system/src/test/java/test/util/Util.java +++ b/tests/system/src/test/java/test/util/Util.java @@ -48,6 +48,7 @@ import javafx.stage.Window; import org.junit.Assert; import junit.framework.AssertionFailedError; +import com.sun.javafx.PlatformUtil; /** * Utility methods for life-cycle testing @@ -490,4 +491,16 @@ public static double getTolerance(Region r) { } return 0.0; } + + + /** + * + * @return true if running Wayland + */ + public static boolean isOnWayland() { + if (!PlatformUtil.isLinux()) return false; + + String waylandDisplay = System.getenv("WAYLAND_DISPLAY"); + return waylandDisplay != null && !waylandDisplay.isEmpty(); + } }