From 2b4f783948e3f26654e9913a3d797d7c83629998 Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Sat, 2 Sep 2023 22:36:27 +0530 Subject: [PATCH] add a test to check that rotating an image to and from doesn't change it --- tests/test_graphical_units/test_img_and_svg.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_graphical_units/test_img_and_svg.py b/tests/test_graphical_units/test_img_and_svg.py index b234431abb..0aaae63d19 100644 --- a/tests/test_graphical_units/test_img_and_svg.py +++ b/tests/test_graphical_units/test_img_and_svg.py @@ -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)