Search in sources :

Example 1 with PointLocator

use of org.testfx.service.locator.PointLocator in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(double x, double y) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    return pointLocator.point(new Point2D(x, y)).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) Point2D(javafx.geometry.Point2D) PointLocator(org.testfx.service.locator.PointLocator)

Example 2 with PointLocator

use of org.testfx.service.locator.PointLocator in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(Bounds bounds) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    return pointLocator.point(bounds).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) PointLocator(org.testfx.service.locator.PointLocator)

Example 3 with PointLocator

use of org.testfx.service.locator.PointLocator in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(Scene scene) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    targetWindow(scene.getWindow());
    return pointLocator.point(scene).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) PointLocator(org.testfx.service.locator.PointLocator)

Example 4 with PointLocator

use of org.testfx.service.locator.PointLocator in project TestFX by TestFX.

the class FxRobot method point.

@Override
public PointQuery point(Point2D point) {
    PointLocator pointLocator = context.getPointLocator();
    Pos pointPosition = context.getPointPosition();
    return pointLocator.point(point).atPosition(pointPosition);
}
Also used : Pos(javafx.geometry.Pos) PointLocator(org.testfx.service.locator.PointLocator)

Example 5 with PointLocator

use of org.testfx.service.locator.PointLocator in project TestFX by TestFX.

the class AwtRobotAdapterTest method setup.

@Before
public void setup() throws Exception {
    robotAdapter = new AwtRobotAdapter();
    targetStage = FxToolkit.setupStage(stage -> {
        region = new Region();
        region.setStyle("-fx-background-color: magenta;");
        VBox box = new VBox(region);
        box.setPadding(new Insets(10));
        box.setSpacing(10);
        VBox.setVgrow(region, Priority.ALWAYS);
        sceneRoot = new StackPane(box);
        Scene scene = new Scene(sceneRoot, 300, 100);
        stage.setScene(scene);
        stage.show();
    });
    PointLocator pointLocator = new PointLocatorImpl(new BoundsLocatorImpl());
    regionPoint = pointLocator.point(region).atPosition(Pos.CENTER).query();
}
Also used : EventHandler(javafx.event.EventHandler) CoreMatchers.is(org.hamcrest.CoreMatchers.is) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Pos(javafx.geometry.Pos) Scene(javafx.scene.Scene) MouseButton(javafx.scene.input.MouseButton) WaitForAsyncUtils.asyncFx(org.testfx.util.WaitForAsyncUtils.asyncFx) Assume.assumeThat(org.junit.Assume.assumeThat) BeforeClass(org.junit.BeforeClass) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) MouseEvent(javafx.scene.input.MouseEvent) Assume.assumeFalse(org.junit.Assume.assumeFalse) PointLocator(org.testfx.service.locator.PointLocator) CoreMatchers.not(org.hamcrest.CoreMatchers.not) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) StackPane(javafx.scene.layout.StackPane) FxToolkit(org.testfx.api.FxToolkit) VBox(javafx.scene.layout.VBox) TestFXRule(org.testfx.framework.junit.TestFXRule) GraphicsEnvironment(java.awt.GraphicsEnvironment) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) PointLocatorImpl(org.testfx.service.locator.impl.PointLocatorImpl) Parent(javafx.scene.Parent) WaitForAsyncUtils.sleep(org.testfx.util.WaitForAsyncUtils.sleep) Insets(javafx.geometry.Insets) After(org.junit.After) Point2D(javafx.geometry.Point2D) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) Before(org.junit.Before) KeyCode(javafx.scene.input.KeyCode) Color(javafx.scene.paint.Color) Rectangle2D(javafx.geometry.Rectangle2D) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) KeyEvent(javafx.scene.input.KeyEvent) WaitForAsyncUtils(org.testfx.util.WaitForAsyncUtils) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) Priority(javafx.scene.layout.Priority) BoundsLocatorImpl(org.testfx.service.locator.impl.BoundsLocatorImpl) Region(javafx.scene.layout.Region) Rule(org.junit.Rule) Stage(javafx.stage.Stage) Image(javafx.scene.image.Image) Mockito.mock(org.mockito.Mockito.mock) PointLocatorImpl(org.testfx.service.locator.impl.PointLocatorImpl) Insets(javafx.geometry.Insets) PointLocator(org.testfx.service.locator.PointLocator) BoundsLocatorImpl(org.testfx.service.locator.impl.BoundsLocatorImpl) Region(javafx.scene.layout.Region) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) StackPane(javafx.scene.layout.StackPane) Before(org.junit.Before)

Aggregations

Pos (javafx.geometry.Pos)8 PointLocator (org.testfx.service.locator.PointLocator)8 Point2D (javafx.geometry.Point2D)3 TimeUnit (java.util.concurrent.TimeUnit)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 EventHandler (javafx.event.EventHandler)2 Insets (javafx.geometry.Insets)2 Rectangle2D (javafx.geometry.Rectangle2D)2 Parent (javafx.scene.Parent)2 Scene (javafx.scene.Scene)2 Image (javafx.scene.image.Image)2 KeyCode (javafx.scene.input.KeyCode)2 KeyEvent (javafx.scene.input.KeyEvent)2 MouseButton (javafx.scene.input.MouseButton)2 MouseEvent (javafx.scene.input.MouseEvent)2 Priority (javafx.scene.layout.Priority)2 Region (javafx.scene.layout.Region)2 StackPane (javafx.scene.layout.StackPane)2 VBox (javafx.scene.layout.VBox)2 Color (javafx.scene.paint.Color)2