use of javafx.scene.layout.Region in project TestFX by TestFX.
the class JavafxRobotAdapterTest method setup.
@Before
public void setup() throws Exception {
targetStage = FxToolkit.setupStage(stage -> {
region = new Region();
region.setStyle("-fx-background-color: magenta;");
textField = new TextField();
textArea = new TextArea();
textArea.setPrefRowCount(6);
VBox box = new VBox(region, textField, textArea);
box.setPadding(new Insets(10));
box.setSpacing(10);
VBox.setVgrow(region, Priority.ALWAYS);
sceneRoot = new StackPane(box);
Scene scene = new Scene(sceneRoot, 300, 300);
stage.setScene(scene);
stage.show();
});
robotAdapter = new JavafxRobotAdapter();
robotAdapter.robotCreate(targetStage.getScene());
// Points are set to bounds in scene
regionPoint = pointInCenterFor(region.localToScene(region.getBoundsInLocal()));
textFieldPoint = pointInCenterFor(textField.localToScene(textField.getBoundsInLocal()));
textAreaPoint = pointInCenterFor(textArea.localToScene(textArea.getBoundsInLocal()));
}
use of javafx.scene.layout.Region in project TestFX by TestFX.
the class WindowFinderImplTest method setupStages.
public void setupStages() {
window = new Stage();
window.setTitle("window");
windowInWindow = new Stage();
windowInWindow.setTitle("windowInWindow");
windowInWindow.initOwner(window);
windowInWindowInWindow = new Stage();
windowInWindowInWindow.setTitle("windowInWindowInWindow");
windowInWindowInWindow.initOwner(windowInWindow);
otherWindow = new Stage();
otherWindow.setTitle("otherWindow");
scene = new Scene(new Region(), 600, 400);
otherWindow.setScene(scene);
window.show();
windowInWindow.show();
windowInWindowInWindow.show();
otherWindow.show();
}
use of javafx.scene.layout.Region in project TestFX by TestFX.
the class WindowFinderImplTest method setup.
@Before
public void setup() throws TimeoutException {
FxToolkit.registerPrimaryStage();
FxToolkit.showStage();
FxToolkit.setupScene(() -> new Scene(new Region(), 600, 400));
FxToolkit.setupFixture(this::setupStages);
windowFinder = new WindowFinderImpl();
}
use of javafx.scene.layout.Region in project TestFX by TestFX.
the class BoundsLocatorImplTest method setup.
@Before
public void setup() throws TimeoutException {
FxToolkit.registerPrimaryStage();
FxToolkit.setupScene(() -> new Scene(new Region(), 600, 400));
FxToolkit.setupFixture(this::setupStages);
boundsLocator = new BoundsLocatorImpl();
windowInsets = calculateWindowInsets(primaryWindow, primaryScene);
}
use of javafx.scene.layout.Region in project TestFX by TestFX.
the class NodeMatchersTest method anything.
@Test
public void anything() throws Exception {
List<Node> nodes = FxToolkit.setupFixture(() -> {
List<Node> temp = new ArrayList<>(3);
temp.add(new Region());
temp.add(new Button("foo"));
temp.add(new TextField("bar"));
return temp;
});
assertThat(from(nodes).match(NodeMatchers.anything()).queryAll(), hasItem(nodes.get(1)));
}
Aggregations