@@ -121,6 +121,32 @@ def test_s_flag(tmp_path, manim_cfg_file, simple_scenes_path):
121121 assert not is_empty , "running manim with -s flag did not render an image"
122122
123123
124+ @pytest .mark .slow
125+ def test_s_flag_opengl_renderer (tmp_path , manim_cfg_file , simple_scenes_path ):
126+ scene_name = "SquareToCircle"
127+ command = [
128+ sys .executable ,
129+ "-m" ,
130+ "manim" ,
131+ "-ql" ,
132+ "-s" ,
133+ "--renderer" ,
134+ "opengl" ,
135+ "--media_dir" ,
136+ str (tmp_path ),
137+ simple_scenes_path ,
138+ scene_name ,
139+ ]
140+ out , err , exit_code = capture (command )
141+ assert exit_code == 0 , err
142+
143+ exists = (tmp_path / "videos" ).exists ()
144+ assert not exists , "running manim with -s flag rendered a video"
145+
146+ is_empty = not any ((tmp_path / "images" / "simple_scenes" ).iterdir ())
147+ assert not is_empty , "running manim with -s flag did not render an image"
148+
149+
124150@pytest .mark .slow
125151def test_r_flag (tmp_path , manim_cfg_file , simple_scenes_path ):
126152 scene_name = "SquareToCircle"
@@ -365,6 +391,33 @@ def test_images_are_created_when_png_format_set(
365391 assert expected_png_path .exists (), "png file not found at " + str (expected_png_path )
366392
367393
394+ @pytest .mark .slow
395+ def test_images_are_created_when_png_format_set_for_opengl (
396+ tmp_path , manim_cfg_file , simple_scenes_path
397+ ):
398+ """Test images are created in media directory when --format png is set for opengl"""
399+ scene_name = "SquareToCircle"
400+ command = [
401+ sys .executable ,
402+ "-m" ,
403+ "manim" ,
404+ "-ql" ,
405+ "--renderer" ,
406+ "opengl" ,
407+ "--media_dir" ,
408+ str (tmp_path ),
409+ "--format" ,
410+ "png" ,
411+ simple_scenes_path ,
412+ scene_name ,
413+ ]
414+ out , err , exit_code = capture (command )
415+ assert exit_code == 0 , err
416+
417+ expected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle0000.png"
418+ assert expected_png_path .exists (), "png file not found at " + str (expected_png_path )
419+
420+
368421@pytest .mark .slow
369422def test_images_are_zero_padded_when_zero_pad_set (
370423 tmp_path , manim_cfg_file , simple_scenes_path
@@ -397,6 +450,40 @@ def test_images_are_zero_padded_when_zero_pad_set(
397450 assert expected_png_path .exists (), "png file not found at " + str (expected_png_path )
398451
399452
453+ @pytest .mark .slow
454+ def test_images_are_zero_padded_when_zero_pad_set_for_opengl (
455+ tmp_path , manim_cfg_file , simple_scenes_path
456+ ):
457+ """Test images are zero padded when --format png and --zero_pad n are set with the opengl renderer"""
458+ scene_name = "SquareToCircle"
459+ command = [
460+ sys .executable ,
461+ "-m" ,
462+ "manim" ,
463+ "-ql" ,
464+ "--renderer" ,
465+ "opengl" ,
466+ "--media_dir" ,
467+ str (tmp_path ),
468+ "--format" ,
469+ "png" ,
470+ "--zero_pad" ,
471+ "3" ,
472+ simple_scenes_path ,
473+ scene_name ,
474+ ]
475+ out , err , exit_code = capture (command )
476+ assert exit_code == 0 , err
477+
478+ unexpected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle0.png"
479+ assert not unexpected_png_path .exists (), "non zero padded png file found at " + str (
480+ unexpected_png_path
481+ )
482+
483+ expected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle000.png"
484+ assert expected_png_path .exists (), "png file not found at " + str (expected_png_path )
485+
486+
400487@pytest .mark .slow
401488def test_webm_format_output (tmp_path , manim_cfg_file , simple_scenes_path ):
402489 """Test only webm created when --format webm is set"""
0 commit comments