use of org.testfx.service.query.PointQuery in project TestFX by TestFX.
the class DragRobotImplTest method drag_with_pointQuery_and_primary_button.
@Test
public void drag_with_pointQuery_and_primary_button() {
// given:
PointQuery pointQuery = mock(PointQuery.class);
// when:
dragRobot.drag(pointQuery, MouseButton.PRIMARY);
// then:
verify(mouseRobot, times(1)).press(eq(MouseButton.PRIMARY));
verify(moveRobot, times(1)).moveTo(eq(pointQuery));
verifyNoMoreInteractions(mouseRobot);
}
use of org.testfx.service.query.PointQuery in project TestFX by TestFX.
the class DragRobotImplTest method dropTo_pointQuery_with_dragged_with_primary_button.
@Test
public void dropTo_pointQuery_with_dragged_with_primary_button() {
// given:
PointQuery pointQuery = mock(PointQuery.class);
// and:
dragRobot.drag(MouseButton.PRIMARY);
reset(mouseRobot, moveRobot);
// when:
dragRobot.dropTo(pointQuery);
// then:
verify(moveRobot, times(1)).moveTo(eq(pointQuery));
verify(mouseRobot, times(1)).release();
verifyNoMoreInteractions(moveRobot, mouseRobot);
}
use of org.testfx.service.query.PointQuery in project TestFX by TestFX.
the class MoveRobotImplTest method moveTo_a_point_within_1000_pixels.
@Test
public void moveTo_a_point_within_1000_pixels() {
// given:
Point2D sourcePoint = new Point2D(0, 0);
given(baseRobot.retrieveMouse()).willReturn(sourcePoint);
// and:
Point2D targetPoint = new Point2D(1000, 0);
PointQuery pointQuery = mock(PointQuery.class);
given(pointQuery.query()).willReturn(targetPoint);
// when:
moveRobot.moveTo(pointQuery);
// then:
verify(mouseRobot, times(199)).moveNoWait(not(eq(targetPoint)));
verify(mouseRobot, times(2)).move(targetPoint);
}
use of org.testfx.service.query.PointQuery in project TestFX by TestFX.
the class MoveRobotImplTest method moveTo_should_move_to_moved_target_point.
@Test
public void moveTo_should_move_to_moved_target_point() {
// given:
Point2D sourcePoint = new Point2D(0, 0);
given(baseRobot.retrieveMouse()).willReturn(sourcePoint);
// and:
Point2D targetPoint = new Point2D(10, 0);
Point2D movedTargetPoint = new Point2D(20, 0);
PointQuery pointQuery = mock(PointQuery.class);
given(pointQuery.query()).willReturn(targetPoint, movedTargetPoint);
// when:
moveRobot.moveTo(pointQuery);
// then:
verify(mouseRobot, times(1)).move(targetPoint);
verify(mouseRobot, times(1)).move(movedTargetPoint);
}
use of org.testfx.service.query.PointQuery in project TestFX by TestFX.
the class MoveRobotImplTest method moveTo_a_point_with_motion_VERTICAL_FIRST.
@Test
public void moveTo_a_point_with_motion_VERTICAL_FIRST() {
// given:
Point2D sourcePoint = new Point2D(0, 0);
given(baseRobot.retrieveMouse()).willReturn(sourcePoint);
// and:
Point2D targetPoint = new Point2D(300, 100);
PointQuery pointQuery = mock(PointQuery.class);
given(pointQuery.query()).willReturn(targetPoint);
// when:
moveRobot.moveTo(pointQuery, Motion.VERTICAL_FIRST);
// then:
verify(mouseRobot, times(199)).moveNoWait(argThat(argument -> sourcePoint.getX() == argument.getX() || targetPoint.getY() == argument.getY()));
verify(mouseRobot, times(2)).move(targetPoint);
}
Aggregations