Skip to content

Commit

Permalink
temporary disable non working test on Mac
Browse files Browse the repository at this point in the history
see #21
  • Loading branch information
McFoggy committed Apr 15, 2020
1 parent 6f4b071 commit 171d3ec
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
14 changes: 14 additions & 0 deletions src/test/java/org/fxmisc/cssfx/test/misc/DisabledOnMac.java
Original file line number Diff line number Diff line change
@@ -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 {
}
2 changes: 2 additions & 0 deletions src/test/java/org/fxmisc/cssfx/test/ui/BasicUITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 171d3ec

Please sign in to comment.