diff --git a/src/test/java/org/fxmisc/cssfx/test/misc/DisableOnMacCondition.java b/src/test/java/org/fxmisc/cssfx/test/misc/DisableOnMacCondition.java new file mode 100644 index 0000000..b772779 --- /dev/null +++ b/src/test/java/org/fxmisc/cssfx/test/misc/DisableOnMacCondition.java @@ -0,0 +1,24 @@ +package org.fxmisc.cssfx.test.misc; + +import org.junit.jupiter.api.extension.ConditionEvaluationResult; +import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.ExtensionContext; + +import java.util.Locale; + +public class DisableOnMacCondition implements ExecutionCondition { + private static final String MAC_OS = "macos"; + + @Override + public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { + final String osName = System.getProperty("os.name"); + final String cleanOsName = osName + .replaceAll("\\s", "") + .toLowerCase(Locale.ENGLISH); + if(cleanOsName.contains(MAC_OS)) { + return ConditionEvaluationResult.disabled("Test disabled on JVM running on " + osName); + } else { + return ConditionEvaluationResult.enabled("Test enabled, running on " + osName); + } + } +} \ No newline at end of file diff --git a/src/test/java/org/fxmisc/cssfx/test/misc/DisabledOnMac.java b/src/test/java/org/fxmisc/cssfx/test/misc/DisabledOnMac.java new file mode 100644 index 0000000..727dab3 --- /dev/null +++ b/src/test/java/org/fxmisc/cssfx/test/misc/DisabledOnMac.java @@ -0,0 +1,14 @@ +package org.fxmisc.cssfx.test.misc; + +import org.junit.jupiter.api.extension.ExtendWith; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@ExtendWith(DisableOnMacCondition.class) +public @interface DisabledOnMac { +} \ No newline at end of file diff --git a/src/test/java/org/fxmisc/cssfx/test/ui/BasicUITest.java b/src/test/java/org/fxmisc/cssfx/test/ui/BasicUITest.java index 1cedc83..4450fcd 100644 --- a/src/test/java/org/fxmisc/cssfx/test/ui/BasicUITest.java +++ b/src/test/java/org/fxmisc/cssfx/test/ui/BasicUITest.java @@ -25,6 +25,7 @@ import javafx.scene.paint.Color; import javafx.stage.Stage; import org.fxmisc.cssfx.CSSFX; +import org.fxmisc.cssfx.test.misc.DisabledOnMac; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.testfx.api.FxRobot; @@ -72,6 +73,7 @@ public void checkCSSIsApplied(FxRobot robot) { } @Test + @DisabledOnMac public void checkCSSFXCanChangeTheLabelFontColor(FxRobot robot) throws Exception { // The CSS used by the UI URI basicCSS = BasicUI.class.getResource("basic.css").toURI();