Search in sources :

Example 1 with PointQuery

use of org.testfx.service.query.PointQuery in project TestFX by TestFX.

the class CallableBoundsPointQuery method query.

@Override
public Point2D query() {
    Bounds bounds = fetchCallableBounds();
    PointQuery boundsQuery = new BoundsPointQuery(bounds).atPosition(getPosition()).atOffset(getOffset());
    return boundsQuery.query();
}
Also used : Bounds(javafx.geometry.Bounds) PointQuery(org.testfx.service.query.PointQuery)

Example 2 with PointQuery

use of org.testfx.service.query.PointQuery in project TestFX by TestFX.

the class PointLocatorImplTest method pointFor_Node_atOffset_afterChange.

@Test
public void pointFor_Node_atOffset_afterChange() {
    // given:
    boundsLocatorStub.bounds = nodeBounds;
    PointQuery pointQuery = pointLocator.point((Node) null);
    // when:
    boundsLocatorStub.bounds = nodeBoundsAfterChange;
    Point2D point = pointQuery.atOffset(0, 0).query();
    // then:
    assertThat(point, CoreMatchers.equalTo(topLeftPointFrom(nodeBoundsAfterChange)));
}
Also used : Point2D(javafx.geometry.Point2D) PointQuery(org.testfx.service.query.PointQuery) Test(org.junit.Test)

Example 3 with PointQuery

use of org.testfx.service.query.PointQuery in project TestFX by TestFX.

the class PointLocatorImplTest method pointFor_Scene_atOffset.

@Test
public void pointFor_Scene_atOffset() {
    // given:
    boundsLocatorStub.bounds = sceneBounds;
    PointQuery pointQuery = pointLocator.point((Scene) null);
    // when:
    Point2D point = pointQuery.atOffset(0, 0).query();
    // then:
    assertThat(point, CoreMatchers.equalTo(topLeftPointFrom(sceneBounds)));
}
Also used : Point2D(javafx.geometry.Point2D) PointQuery(org.testfx.service.query.PointQuery) Test(org.junit.Test)

Example 4 with PointQuery

use of org.testfx.service.query.PointQuery in project TestFX by TestFX.

the class PointLocatorImplTest method pointFor_Point2D_atOffset.

@Test
public void pointFor_Point2D_atOffset() {
    // given:
    boundsLocatorStub.bounds = nodeBounds;
    PointQuery pointQuery = pointLocator.point(new Point2D(100, 100));
    // when:
    Point2D point = pointQuery.atOffset(0, 0).query();
    // then:
    assertThat(point, CoreMatchers.equalTo(new Point2D(100, 100)));
}
Also used : Point2D(javafx.geometry.Point2D) PointQuery(org.testfx.service.query.PointQuery) Test(org.junit.Test)

Example 5 with PointQuery

use of org.testfx.service.query.PointQuery in project TestFX by TestFX.

the class ClickRobotImplTest method doubleClickOn_with_pointQuery_and_primary_button.

@Test
public void doubleClickOn_with_pointQuery_and_primary_button() {
    // given:
    PointQuery pointQuery = mock(PointQuery.class);
    // when:
    clickRobot.doubleClickOn(pointQuery, MouseButton.PRIMARY);
    // then:
    verify(moveRobot, times(1)).moveTo(eq(pointQuery), eq(Motion.DEFAULT));
    verify(mouseRobot, times(2)).pressNoWait(eq(MouseButton.PRIMARY));
    verify(mouseRobot, times(2)).release(eq(MouseButton.PRIMARY));
    verify(sleepRobot, times(1)).sleep(anyLong());
    verifyNoMoreInteractions(moveRobot, mouseRobot, sleepRobot);
}
Also used : PointQuery(org.testfx.service.query.PointQuery) Test(org.junit.Test)

Aggregations

PointQuery (org.testfx.service.query.PointQuery)22 Test (org.junit.Test)19 Point2D (javafx.geometry.Point2D)16 Before (org.junit.Before)3 Rule (org.junit.Rule)3 AdditionalMatchers.not (org.mockito.AdditionalMatchers.not)3 ArgumentMatchers.argThat (org.mockito.ArgumentMatchers.argThat)3 ArgumentMatchers.eq (org.mockito.ArgumentMatchers.eq)3 BDDMockito.given (org.mockito.BDDMockito.given)3 Mockito.mock (org.mockito.Mockito.mock)3 Mockito.times (org.mockito.Mockito.times)3 Mockito.verify (org.mockito.Mockito.verify)3 TestFXRule (org.testfx.framework.junit.TestFXRule)3 BaseRobot (org.testfx.robot.BaseRobot)3 Motion (org.testfx.robot.Motion)3 MouseRobot (org.testfx.robot.MouseRobot)3 MoveRobot (org.testfx.robot.MoveRobot)3 SleepRobot (org.testfx.robot.SleepRobot)3 BoundingBox (javafx.geometry.BoundingBox)2 Bounds (javafx.geometry.Bounds)2