Search in sources :

Example 11 with PointQuery

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

the class PointLocatorImplTest method pointFor_Bounds_atOffset.

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

Example 12 with PointQuery

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

the class PointLocatorImplTest method pointFor_Node_atOffset.

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

Example 13 with PointQuery

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

the class PointLocatorImplTest method pointFor_Window_atOffset.

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

Example 14 with PointQuery

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

the class PointLocatorImplTest method pointFor_Window_atOffset_afterChange.

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

Example 15 with PointQuery

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

the class ClickRobotImplTest method clickOn_with_pointQuery_and_primary_button.

@Test
public void clickOn_with_pointQuery_and_primary_button() {
    // given:
    PointQuery pointQuery = mock(PointQuery.class);
    // when:
    clickRobot.clickOn(pointQuery, MouseButton.PRIMARY);
    // then:
    verify(moveRobot, times(1)).moveTo(eq(pointQuery), eq(Motion.DEFAULT));
    verify(mouseRobot, times(1)).pressNoWait(eq(MouseButton.PRIMARY));
    verify(mouseRobot, times(1)).release(eq(MouseButton.PRIMARY));
    verifyNoMoreInteractions(moveRobot, mouseRobot);
    verifyZeroInteractions(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