Skip to content

Commit

Permalink
8337827: [XWayland] Skip failing tests on Wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
azvegint committed Aug 9, 2024
1 parent abb6dfe commit 86a110d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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(()-> {
Expand All @@ -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(()-> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import static org.junit.Assume.assumeTrue;

import test.robot.testharness.VisualTestBase;
import test.util.Util;

public class SRGBTest extends VisualTestBase {

Expand Down Expand Up @@ -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()) {
Expand Down
13 changes: 13 additions & 0 deletions tests/system/src/test/java/test/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
}

0 comments on commit 86a110d

Please sign in to comment.