A community-maintained Python framework for creating mathematical animations.
Add missing tests for AnimationGroup 'remover' field (#2318)
Filip911d42b364f9
diff --git a/tests/control_data/graphical_units_data/composition/animationgroup_is_passing_remover_to_animations.npz b/tests/control_data/graphical_units_data/composition/animationgroup_is_passing_remover_to_animations.npznew file mode 100644index 000000000..f98436b2cBinary files /dev/null and b/tests/control_data/graphical_units_data/composition/animationgroup_is_passing_remover_to_animations.npz differdiff --git a/tests/control_data/graphical_units_data/composition/animationgroup_is_passing_remover_to_nested_animationgroups.npz b/tests/control_data/graphical_units_data/composition/animationgroup_is_passing_remover_to_nested_animationgroups.npznew file mode 100644index 000000000..f98436b2cBinary files /dev/null and b/tests/control_data/graphical_units_data/composition/animationgroup_is_passing_remover_to_nested_animationgroups.npz differdiff --git a/tests/test_composition.py b/tests/test_composition.pyindex 0d804f1ec..d73aa432f 100644--- a/tests/test_composition.py+++ b/tests/test_composition.py@@ -1,8 +1,12 @@+import pytest+from manim.animation.animation import Animation, Waitfrom manim.animation.composition import AnimationGroup, Succession+from manim.animation.creation import Create, Writefrom manim.animation.fading import FadeIn, FadeOutfrom manim.constants import DOWN, UP-from manim.mobject.geometry import Circle, Line, Square+from manim.mobject.geometry import Circle, Line, RegularPolygon, Square+from manim.scene.scene import Scenedef test_succession_timing():@@ -97,3 +101,40 @@ def test_animationgroup_with_wait():timings = animation_group.anims_with_timingsassert timings == [(wait, 0.0, 1.0), (sqr_anim, 1.0, 2.0)]+++ "animation_remover, animation_group_remover", [(False, True), (True, False)]+)+def test_animationgroup_is_passing_remover_to_animations(+ animation_remover, animation_group_remover+):+ scene = Scene()+ sqr_animation = Create(Square(), remover=animation_remover)+ circ_animation = Write(Circle(), remover=animation_remover)+ animation_group = AnimationGroup(+ sqr_animation, circ_animation, remover=animation_group_remover+ )++ scene.play(animation_group)+ scene.wait(0.1)++ assert sqr_animation.remover+ assert circ_animation.remover+++def test_animationgroup_is_passing_remover_to_nested_animationgroups():+ scene = Scene()+ sqr_animation = Create(Square())+ circ_animation = Write(Circle(), remover=True)+ polygon_animation = Create(RegularPolygon(5))+ animation_group = AnimationGroup(+ AnimationGroup(sqr_animation, polygon_animation), circ_animation, remover=True+ )++ scene.play(animation_group)+ scene.wait(0.1)++ assert sqr_animation.remover+ assert circ_animation.remover+ assert polygon_animation.removerdiff --git a/tests/test_graphical_units/test_composition.py b/tests/test_graphical_units/test_composition.pynew file mode 100644index 000000000..c5f8b7fd7--- /dev/null+++ b/tests/test_graphical_units/test_composition.py@@ -0,0 +1,24 @@+from manim import *+from tests.test_graphical_units.testing.frames_comparison import frames_comparison++__module_test__ = "composition"+++@frames_comparison+def test_animationgroup_is_passing_remover_to_animations(scene):+ animation_group = AnimationGroup(Create(Square()), Write(Circle()), remover=True)++ scene.play(animation_group)+ scene.wait(0.1)+++@frames_comparison+def test_animationgroup_is_passing_remover_to_nested_animationgroups(scene):+ animation_group = AnimationGroup(+ AnimationGroup(Create(Square()), Create(RegularPolygon(5))),+ Write(Circle(), remover=True),+ remover=True,+ )++ scene.play(animation_group)+ scene.wait(0.1)