Skip to content

Commit 2b4f783

Browse files
committed
add a test to check that rotating an image to and from doesn't change it
1 parent b50a547 commit 2b4f783

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_graphical_units/test_img_and_svg.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,19 @@ def test_ImageInterpolation(scene):
284284
scene.add(img1, img2, img3, img4, img5)
285285
[s.shift(4 * LEFT + pos * 2 * RIGHT) for pos, s in enumerate(scene.mobjects)]
286286
scene.wait()
287+
288+
289+
def test_ImageMobject_points_length():
290+
file_path = get_svg_resource("tree_img_640x351.png")
291+
im1 = ImageMobject(file_path)
292+
assert len(im1.points) == 4
293+
294+
def test_ImageMobject_rotation():
295+
# see https://github.com/ManimCommunity/manim/issues/3067
296+
# rotating an image to and from the same angle should not change the image
297+
file_path = get_svg_resource("tree_img_640x351.png")
298+
im1 = ImageMobject(file_path)
299+
im2 = im1.copy()
300+
im1.rotate(PI / 2)
301+
im1.rotate(-PI / 2)
302+
np.testing.assert_array_equal(im1.points, im2.points)

0 commit comments

Comments
 (0)