A community-maintained Python framework for creating mathematical animations.
Update Camera test
Devin Neal97f07158e3d3
diff --git a/manim/__init__.py b/manim/__init__.pyindex 0f6b70bfd..9d3c64892 100644--- a/manim/__init__.py+++ b/manim/__init__.py@@ -21,6 +21,8 @@ from .animation.specialized import *from .animation.transform import *from .animation.update import *+from .renderer.cairo_renderer import *+from .camera.camera import *from .camera.mapping_camera import *from .camera.moving_camera import *diff --git a/manim/camera/camera.py b/manim/camera/camera.pyindex e2aa8948e..6fb59497e 100644--- a/manim/camera/camera.py+++ b/manim/camera/camera.py@@ -67,7 +67,7 @@ class Camera(object):"use_z_index": True,}- def __init__(self, background=None, **kwargs):+ def __init__(self, video_quality_config, background=None, **kwargs):"""Initialises the Camera.Parametersdiff --git a/manim/renderer/cairo_renderer.py b/manim/renderer/cairo_renderer.pyindex 6c811c7b0..9ed5c87f8 100644--- a/manim/renderer/cairo_renderer.py+++ b/manim/renderer/cairo_renderer.py@@ -86,9 +86,7 @@ class CairoRenderer:time: time elapsed since initialisation of scene."""- def __init__(self, scene, camera_class):- self.camera = camera_class(**camera_config)-+ def __init__(self, scene, camera_class, **kwargs):# All of the following are set to EITHER the value passed via kwargs,# OR the value stored in the global config dict at the time of# _instance construction_. Before, they were in the CONFIG dict, which@@ -103,8 +101,8 @@ class CairoRenderer:"frame_width","frame_rate",]:- self.video_quality_config[attr] = camera_config.get(attr, config[attr])-+ self.video_quality_config[attr] = kwargs.get(attr, config[attr])+ self.camera = camera_class(self.video_quality_config, **camera_config)self.file_writer = SceneFileWriter(self.video_quality_config,scene,diff --git a/tests/test_camera.py b/tests/test_camera.pydeleted file mode 100644index dd8f00f5b..000000000--- a/tests/test_camera.py+++ /dev/null@@ -1,16 +0,0 @@-import pytest-from manim import Camera, tempconfig, config---def test_camera():- """Test that Camera instances initialize to the correct config."""- # by default, use the config- assert Camera().frame_width == config["frame_width"]- # init args override config- assert Camera(frame_width=10).frame_width == 10-- # if config changes, reflect those changes- with tempconfig({"frame_width": 100}):- assert Camera().frame_width == 100- # ..init args still override new config- assert Camera(frame_width=10).frame_width == 10diff --git a/tests/test_renderer.py b/tests/test_renderer.pynew file mode 100644index 000000000..6995b0067--- /dev/null+++ b/tests/test_renderer.py@@ -0,0 +1,27 @@+import pytest+from manim import CairoRenderer, Camera, tempconfig, config+++def test_renderer():+ """Test that CairoRenderer instances initialize to the correct config."""+ # by default, use the config+ assert (+ CairoRenderer(None, Camera).video_quality_config["frame_width"]+ == config["frame_width"]+ )+ # init args override config+ assert (+ CairoRenderer(None, Camera, frame_width=10).video_quality_config["frame_width"]+ == 10+ )++ # if config changes, reflect those changes+ with tempconfig({"frame_width": 100}):+ assert CairoRenderer(None, Camera).video_quality_config["frame_width"] == 100+ # ..init args still override new config+ assert (+ CairoRenderer(None, Camera, frame_width=10).video_quality_config[+ "frame_width"+ ]+ == 10+ )