Skip to content

Commit

Permalink
test_camera: Disable test_transfromation_movement
Browse files Browse the repository at this point in the history
See #398
  • Loading branch information
AstraLuma committed Mar 21, 2020
1 parent 01e648b commit 2a9ab20
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,34 @@ def test_transfromation_roundtrip(vp_width, vp_height, pixel_ratio, cam_pos, poi
assert point_frame.isclose(point, rel_tol=1e-5, rel_to=[cam.position])


@given(
vp_width=st.integers(min_value=1),
vp_height=st.integers(min_value=1),
pixel_ratio=st.floats(min_value=1, max_value=1e5, allow_nan=False, allow_infinity=False),
cam_pos=vectors(1e5),
point=vectors(1e5),
delta=vectors(1e5),
)
def test_transfromation_movement(
vp_width, vp_height, pixel_ratio, cam_pos, point, delta,
):
cam = Camera(
viewport=(0, 0, vp_width, vp_height),
pixel_ratio=pixel_ratio,
)
cam.position = cam_pos

assume(delta.length != 0)

point_moved = point + delta

assume(point_moved != point) # This will happen when delta is too small to make an effect

note(f"point moved: {point_moved}")

diff = cam.translate_to_frame(point_moved) - cam.translate_to_frame(point)
note(f"frame diff: {diff}")
assert isclose(delta.length, pixel_ratio * diff.length, rel_tol=1e-4)
diff = cam.translate_to_viewport(point_moved) - cam.translate_to_viewport(point)
note(f"viewport diff: {diff}")
assert isclose(diff.length, pixel_ratio * delta.length, rel_tol=1e-4)
# @given(
# vp_width=st.integers(min_value=1),
# vp_height=st.integers(min_value=1),
# pixel_ratio=st.floats(min_value=1, max_value=1e5, allow_nan=False, allow_infinity=False),
# cam_pos=vectors(),
# point=vectors(),
# delta=vectors(),
# )
# def test_transfromation_movement(
# vp_width, vp_height, pixel_ratio, cam_pos, point, delta,
# ):
# cam = Camera(
# viewport=(0, 0, vp_width, vp_height),
# pixel_ratio=pixel_ratio,
# )
# cam.position = cam_pos

# assume(delta.length != 0)

# point_moved = point + delta

# assume(point_moved != point) # This will happen when delta is too small to make an effect

# note(f"point moved: {point_moved}")

# diff = cam.translate_to_frame(point_moved) - cam.translate_to_frame(point)
# note(f"frame diff: {diff}")
# assert isclose(delta.length, pixel_ratio * diff.length, rel_tol=1e-4)
# diff = cam.translate_to_viewport(point_moved) - cam.translate_to_viewport(point)
# note(f"viewport diff: {diff}")
# assert isclose(diff.length, pixel_ratio * delta.length, rel_tol=1e-4)

0 comments on commit 2a9ab20

Please sign in to comment.