use of javafx.scene.control.TextField in project TestFX by TestFX.
the class NodeAssertTest method isFocused.
@Test
public void isFocused() throws Exception {
// given:
FxToolkit.setupSceneRoot(() -> {
textField = new TextField("foo");
return new StackPane(textField);
});
// when:
Platform.runLater(() -> textField.requestFocus());
WaitForAsyncUtils.waitForFxEvents();
// then:
assertThat(textField).isFocused();
}
use of javafx.scene.control.TextField in project TestFX by TestFX.
the class NodeAssertTest method isNotFocused_fails.
@Test
public void isNotFocused_fails() throws Exception {
// given:
FxToolkit.setupSceneRoot(() -> {
textField = new TextField("foo");
return new StackPane(textField);
});
// when:
Platform.runLater(() -> textField.requestFocus());
WaitForAsyncUtils.waitForFxEvents();
// then:
assertThatThrownBy(() -> assertThat(textField).isNotFocused()).isExactlyInstanceOf(AssertionError.class).hasMessageStartingWith("Expected: Node does not have focus\n");
}
use of javafx.scene.control.TextField in project TestFX by TestFX.
the class NodeAssertTest method isFocused_fails.
@Test
public void isFocused_fails() throws Exception {
// given:
FxToolkit.setupSceneRoot(() -> {
textField = new TextField("foo");
textField2 = new TextField("bar");
return new StackPane(textField, textField2);
});
// when:
Platform.runLater(() -> textField2.requestFocus());
WaitForAsyncUtils.waitForFxEvents();
// then:
assertThatThrownBy(() -> assertThat(textField).isFocused()).isExactlyInstanceOf(AssertionError.class).hasMessageStartingWith("Expected: Node has focus\n");
}
use of javafx.scene.control.TextField in project TestFX by TestFX.
the class TextInputControlAssertTest method setup.
@Before
public void setup() throws Exception {
FxToolkit.setupFixture(() -> {
foobarTextField = new TextField("foobar");
quuxTextField = new TextField("quux");
});
}
use of javafx.scene.control.TextField in project TestFX by TestFX.
the class WriteHeadlessTest method setup.
@Before
public void setup() throws Exception {
FxToolkit.setupSceneRoot(() -> {
TextField textField = new TextField();
textField.setId("name");
return new HBox(textField);
});
FxToolkit.setupStage(Stage::show);
}
Aggregations