def test_given_physical_coordinate_when_getting_robot_coordinate_then_coordinate_is_returned(self): coordinate = Coordinate(self._sample_point, CoordinateSystem.PHYSICAL, CoordinateSystem.PHYSICAL, self._playfield_mock_instance) point = coordinate.get(CoordinateSystem.ROBOT, robot = self._robot_mock_instance) assert_equals(point.round(), Vector2(-15, 0))
def test_given_camera_coordinate_with_altitude_when_getting_game_coordinate_then_perspective_correction_is_applied(self): coordinate = Coordinate(self._sample_point, CoordinateSystem.CAMERA, CoordinateSystem.CAMERA, self._playfield_mock_instance, self.SAMPLE_ALTITUDE, self.SAMPLE_IMAGE_SIZE) point = coordinate.get() assert_true(point > self._sample_point.offset(-self.SAMPLE_PLAYFIELD_LOCATION))
def test_given_game_coordinate_when_getting_camera_coordinate_then_error_is_raised(self): coordinate = Coordinate(self._sample_point, CoordinateSystem.GAME, CoordinateSystem.GAME, self._playfield_mock_instance) point = coordinate.get(CoordinateSystem.CAMERA) assert_equals(point, self._sample_point.offset(self.SAMPLE_PLAYFIELD_LOCATION))
def test_given_game_coordinate_when_getting_physical_coordinate_then_coordinate_is_returned(self): coordinate = Coordinate(self._sample_point, CoordinateSystem.GAME, CoordinateSystem.GAME, self._playfield_mock_instance) point = coordinate.get(CoordinateSystem.PHYSICAL) assert_equals(point, self._sample_point.scale(1 / self.SAMPLE_PHYSICAL_SCALE))
def test_given_game_coordinate_when_getting_game_coordinate_then_coordinate_is_returned(self): coordinate = Coordinate(self._sample_point, CoordinateSystem.GAME, CoordinateSystem.GAME, self._playfield_mock_instance) point = coordinate.get() assert_equals(point, self._sample_point)