Package org.testfx.matcher.base
Class ColorMatchers
java.lang.Object
org.testfx.matcher.base.ColorMatchers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
getColorText
(javafx.scene.paint.Color color) static org.hamcrest.Matcher
<javafx.scene.paint.Color> hasClosestNamedColor
(String namedColor) Creates a matcher that matches allColor
s that have the given named colorString
as their closest JavaFX named color.static org.hamcrest.Matcher
<javafx.scene.paint.Color> hasClosestNamedColor
(javafx.scene.paint.Color namedColor) Creates a matcher that matches allColor
s that are exactly equal to the given JavaFX namedColor
.static org.hamcrest.Matcher
<javafx.scene.paint.Color> Creates a matcher that matches allColor
s that are exactly equal to the given JavaFX named colorString
.static org.hamcrest.Matcher
<javafx.scene.paint.Color> isColor
(javafx.scene.paint.Color color) Creates a matcher that matches allColor
s that are exactly equal to the givencolor
.static org.hamcrest.Matcher
<javafx.scene.paint.Color> isColor
(javafx.scene.paint.Color color, ColorMatcher colorMatcher) Creates a matcher that matches allColor
s that match the givencolor
with respect to the givencolorMatcher
.
-
Constructor Details
-
ColorMatchers
public ColorMatchers()
-
-
Method Details
-
isColor
public static org.hamcrest.Matcher<javafx.scene.paint.Color> isColor(javafx.scene.paint.Color color) Creates a matcher that matches allColor
s that are exactly equal to the givencolor
. -
isColor
public static org.hamcrest.Matcher<javafx.scene.paint.Color> isColor(javafx.scene.paint.Color color, ColorMatcher colorMatcher) Creates a matcher that matches allColor
s that match the givencolor
with respect to the givencolorMatcher
.For example, to match colors using a custom matcher that considers two colors equal if they have the same red components:
assertThat(Color.rgb(0.3, 0.2, 0.1), ColorMatchers.isColor(Color.rgb(0.3, 0.8, 0.7), (c1, c2) -> c1.getRed() == c2.getRed()));
-
isColor
Creates a matcher that matches allColor
s that are exactly equal to the given JavaFX named colorString
. ThenamedColor
is not case sensitive.- Throws:
AssertionError
- if the given named colorString
is not a JavaFX named color- See Also:
-
hasClosestNamedColor
public static org.hamcrest.Matcher<javafx.scene.paint.Color> hasClosestNamedColor(javafx.scene.paint.Color namedColor) Creates a matcher that matches allColor
s that are exactly equal to the given JavaFX namedColor
.- Throws:
AssertionError
- if the given namedColor
is not a JavaFX named color- See Also:
-
hasClosestNamedColor
public static org.hamcrest.Matcher<javafx.scene.paint.Color> hasClosestNamedColor(String namedColor) Creates a matcher that matches allColor
s that have the given named colorString
as their closest JavaFX named color. ThenamedColor
is not case sensitive.- Throws:
AssertionError
- if the given named colorString
is not a JavaFX named color- See Also:
-
getColorText
-