Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Merge branch 'master' into refactor-file-writer

leotrs6d0127b84271
diff --cc tests/test_scene_rendering/test_cli_flags.py
index a44bc8add,2c02bf3e6..e6347f496
--- a/tests/test_scene_rendering/test_cli_flags.py
+++ b/tests/test_scene_rendering/test_cli_flags.py
@@@ -112,26 -117,27 +115,52 @@@ def test_s_flag(tmp_path, manim_cfg_fil
assert not is_empty, "running manim with -s flag did not render an image"
+ @pytest.mark.slow
+ def test_r_flag(tmp_path, manim_cfg_file, simple_scenes_path):
+ scene_name = "SquareToCircle"
+ command = [
+ "python",
+ "-m",
+ "manim",
+ simple_scenes_path,
+ scene_name,
+ "-ql",
+ "-s",
+ "--media_dir",
+ str(tmp_path),
+ "-r",
+ "100, 200",
+ ]
+ out, err, exit_code = capture(command)
+ assert exit_code == 0, err
+
+ is_not_empty = any((tmp_path / "images").iterdir())
+ assert is_not_empty, "running manim with -s, -r flag did not render a file"
+
+ filename = tmp_path / "images" / "simple_scenes" / "SquareToCircle.png"
+ assert np.asarray(Image.open(filename)).shape == (100, 200, 4)
++
++
+def test_custom_folders(tmp_path, manim_cfg_file, simple_scenes_path):
+ scene_name = "SquareToCircle"
+ command = [
+ "python",
+ "-m",
+ "manim",
+ simple_scenes_path,
+ scene_name,
+ "-ql",
+ "-s",
+ "--media_dir",
+ str(tmp_path),
+ "--custom_folders",
+ ]
+ out, err, exit_code = capture(command)
+ assert exit_code == 0, err
+
+ exists = (tmp_path / "videos").exists()
+ assert not exists, "--custom_folders produced a 'videos/' dir"
+
+ exists = (tmp_path / "SquareToCircle.png").exists()
+ assert exists, "--custom_folders did not produce the output file"