Skip to content

Commit

Permalink
add a test to check that rotating an image to and from doesn't change it
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk committed Sep 2, 2023
1 parent b50a547 commit 2b4f783
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_graphical_units/test_img_and_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,19 @@ def test_ImageInterpolation(scene):
scene.add(img1, img2, img3, img4, img5)
[s.shift(4 * LEFT + pos * 2 * RIGHT) for pos, s in enumerate(scene.mobjects)]
scene.wait()


def test_ImageMobject_points_length():
file_path = get_svg_resource("tree_img_640x351.png")
im1 = ImageMobject(file_path)
assert len(im1.points) == 4

def test_ImageMobject_rotation():
# see https://github.com/ManimCommunity/manim/issues/3067
# rotating an image to and from the same angle should not change the image
file_path = get_svg_resource("tree_img_640x351.png")
im1 = ImageMobject(file_path)
im2 = im1.copy()
im1.rotate(PI / 2)
im1.rotate(-PI / 2)
np.testing.assert_array_equal(im1.points, im2.points)

0 comments on commit 2b4f783

Please sign in to comment.