Repository: ManimCommunity/manim
File: tests/test_graphical_units/test_img_and_svg.py (Python)

Code before:
    def construct(self):
        line_demo = SVGMobject(get_svg_resource("line.svg"))
        self.add(line_demo)
        self.wait()


class CubicPathTest(Scene):
    def construct(self):
        cubic_demo = SVGMobject(get_svg_resource("cubic_demo.svg"))
        self.add(cubic_demo)
        self.wait()


class CubicAndLinetoTest(Scene):
    def construct(self):
        cubic_lineto = SVGMobject(get_svg_resource("cubic_and_lineto.svg"))
        self.add(cubic_lineto)
        self.wait()


class RhomboidTest(Scene):
    """Test the default fill and parsed stroke of a rhomboid"""

    def construct(self):
        rhomboid = SVGMobject(get_svg_resource("rhomboid.svg")).scale(0.5)
        rhomboid_fill = rhomboid.copy().set_fill(color=WHITE, opacity=1).shift(UP * 2)
        rhomboid_no_fill = rhomboid.copy().set_fill(opacity=0).shift(DOWN * 2)

        self.add(rhomboid, rhomboid_fill, rhomboid_no_fill)
        self.wait()


class InheritanceTest(Scene):
    """Ensure SVG inheritance is followed"""

    def construct(self):
        three_arrows = SVGMobject(get_svg_resource("inheritance_test.svg")).scale(0.5)
        self.add(three_arrows)
        self.wait()


class MultiPartPathTest(Scene):
    def construct(self):
        mpp = SVGMobject(get_svg_resource("multi_part_path.svg"))
        self.add(mpp)
        self.wait()


class QuadraticPathTest(Scene):
    def construct(self):
        quad = SVGMobject(get_svg_resource("qcurve_demo.svg"))

Review comment (suggestion):
This is the one line I had trouble making sense of - how can this line specify the fill color as white, but the test file not need a change? Are the results as you expect them to be? I think the fill should have been black as the default SVG color, and that wouldn't have shown up on the black background that is default for Manim...

Code after:
    def construct(self):
        line_demo = SVGMobject(get_svg_resource("line.svg"))
        self.add(line_demo)
        self.wait()


class CubicPathTest(Scene):
    def construct(self):
        cubic_demo = SVGMobject(get_svg_resource("cubic_demo.svg"))
        self.add(cubic_demo)
        self.wait()


class CubicAndLinetoTest(Scene):
    def construct(self):
        cubic_lineto = SVGMobject(get_svg_resource("cubic_and_lineto.svg"))
        self.add(cubic_lineto)
        self.wait()


class RhomboidTest(Scene):
    """Test the default fill and parsed stroke of a rhomboid"""

    def construct(self):
        rhomboid = SVGMobject(get_svg_resource("rhomboid.svg")).scale(0.5)
        rhomboid_fill = rhomboid.copy().set_fill(opacity=1).shift(UP * 2)
        rhomboid_no_fill = rhomboid.copy().set_fill(opacity=0).shift(DOWN * 2)

        self.add(rhomboid, rhomboid_fill, rhomboid_no_fill)
        self.wait()


class InheritanceTest(Scene):
    """Ensure SVG inheritance is followed"""

    def construct(self):
        three_arrows = SVGMobject(get_svg_resource("inheritance_test.svg")).scale(0.5)
        self.add(three_arrows)
        self.wait()


class MultiPartPathTest(Scene):
    def construct(self):
        mpp = SVGMobject(get_svg_resource("multi_part_path.svg"))
        self.add(mpp)
        self.wait()


class QuadraticPathTest(Scene):
    def construct(self):
        quad = SVGMobject(get_svg_resource("qcurve_demo.svg"))