mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* Remove unused imports * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed non pytest imports from tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove unused pytest imports * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * re-added removed pass statements Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
60 lines
1.2 KiB
Python
60 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from manim import (
|
|
BLUE,
|
|
Circle,
|
|
Difference,
|
|
Exclusion,
|
|
Intersection,
|
|
Rectangle,
|
|
Square,
|
|
Triangle,
|
|
Union,
|
|
)
|
|
|
|
# not exported by default, so directly import
|
|
from manim.utils.testing.frames_comparison import frames_comparison
|
|
|
|
__module_test__ = "boolean_ops"
|
|
|
|
|
|
@frames_comparison()
|
|
def test_union(scene):
|
|
a = Square()
|
|
b = Circle().move_to([0.2, 0.2, 0.0])
|
|
c = Rectangle()
|
|
un = Union(a, b, c).next_to(b)
|
|
scene.add(a, b, c, un)
|
|
|
|
|
|
@frames_comparison()
|
|
def test_intersection(scene):
|
|
a = Square()
|
|
b = Circle().move_to([0.3, 0.3, 0.0])
|
|
i = Intersection(a, b).next_to(b)
|
|
scene.add(a, b, i)
|
|
|
|
|
|
@frames_comparison()
|
|
def test_difference(scene):
|
|
a = Square()
|
|
b = Circle().move_to([0.2, 0.3, 0.0])
|
|
di = Difference(a, b).next_to(b)
|
|
scene.add(a, b, di)
|
|
|
|
|
|
@frames_comparison()
|
|
def test_exclusion(scene):
|
|
a = Square()
|
|
b = Circle().move_to([0.3, 0.2, 0.0])
|
|
ex = Exclusion(a, b).next_to(a)
|
|
scene.add(a, b, ex)
|
|
|
|
|
|
@frames_comparison()
|
|
def test_intersection_3_mobjects(scene):
|
|
a = Square()
|
|
b = Circle().move_to([0.2, 0.2, 0])
|
|
c = Triangle()
|
|
i = Intersection(a, b, c, fill_opacity=0.5, color=BLUE)
|
|
scene.add(a, b, c, i)
|