public class TextFlowMatchers
extends java.lang.Object
TextFlow controls.| Modifier and Type | Method and Description |
|---|---|
static org.hamcrest.Matcher<javafx.scene.text.TextFlow> |
hasColoredText(java.lang.String coloredTextMarkup)
Allows one to verify both the content and color of the text that makes
up a TextFlow.
|
static org.hamcrest.Matcher<javafx.scene.text.TextFlow> |
hasExactlyColoredText(java.lang.String coloredTextMarkup)
Allows one to verify both the content and color of the text that makes
up a TextFlow.
|
static org.hamcrest.Matcher<javafx.scene.text.TextFlow> |
hasText(java.lang.String string)
Creates a matcher that matches all (
TextFlows whose "text" (the result of combining all of
its Text children's text together) equals the given string. |
public static org.hamcrest.Matcher<javafx.scene.text.TextFlow> hasText(java.lang.String string)
TextFlows whose "text" (the result of combining all of
its Text children's text together) equals the given string.string - the text that matching TextFlows should haveTextFlow has the same
text as the given stringpublic static org.hamcrest.Matcher<javafx.scene.text.TextFlow> hasColoredText(java.lang.String coloredTextMarkup)
Colors are specified using the following markup:
<COLOR>text</COLOR>
Where COLOR is one of JavaFX's named colors.
Here is an example for verifying that a TextFlow contains the text "hello" and that the named color that has the closest value to the color of the text is Colors.RED:
Text text = new Text("hello");
text.setFill(Colors.RED);
TextFlow textFlow = new TextFlow(text);
assertThat(textFlow, TextFlowMatchers.hasColoredText("<RED>hello</RED>"));
coloredTextMarkup - the text contained in the TextFlow with color markup that
specifies the expected color of the textpublic static org.hamcrest.Matcher<javafx.scene.text.TextFlow> hasExactlyColoredText(java.lang.String coloredTextMarkup)
Colors are specified using the following markup:
<COLOR>text</COLOR>
Where COLOR is one of JavaFX's named colors.
Here is an example for verifying that a TextFlow contains the text "hello" and that the color of the text is exactly Colors.BLUE (that is, it has an RGB value of (0, 0, 255)).
Text text = new Text("hello");
text.setFill(Colors.BLUE); // or: text.setFill(Colors.rgb(0, 0, 255));
TextFlow textFlow = new TextFlow(text);
assertThat(textFlow, TextFlowMatchers.hasExactlyColoredText("hello "));
coloredTextMarkup - the text contained in the TextFlow with color markup that
specifies the expected color of the text