Repository: ManimCommunity/manim

Issue:
Create a test for resolution configuration
## Enhancement proposal
A test for the `--resolution` configuration option. It should be placed [here](https://github.com/ManimCommunity/manim/blob/main/tests/test_scene_rendering/test_cli_flags.py) and [here](https://github.com/ManimCommunity/manim/blob/main/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py) (the OpenGL test can be marked as `xfail` if setting resolution does not work properly on OpenGL). Test different resolutions as well as different ways of separating the resolutions (width and height separated by `;`, `,`, and `-`).

## Additional comments
<!-- Add further context that you think might be relevant. -->



Discussion:

Resolving patch:
diff --git a/manim/utils/commands.py b/manim/utils/commands.py
--- a/manim/utils/commands.py
+++ b/manim/utils/commands.py
@@ -27,7 +27,7 @@ def get_video_metadata(path_to_video: str) -> Dict[str, Any]:
         "stream=width,height,nb_frames,duration,avg_frame_rate,codec_name",
         "-print_format",
         "json",
-        path_to_video,
+        str(path_to_video),
     ]
     config, err, exitcode = capture(command)
     assert exitcode == 0, f"FFprobe error: {err}"


Test patch:
diff --git a/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py b/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py
--- a/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py
+++ b/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py
@@ -1,3 +1,4 @@
+import itertools
 import os
 import sys
 
@@ -6,7 +7,7 @@
 from click.testing import CliRunner
 from PIL import Image
 
-from manim import capture
+from manim import capture, get_video_metadata
 from manim.__main__ import main
 from manim.utils.file_ops import add_version_before_extension
 from tests.utils.video_tester import video_comparison
@@ -35,6 +36,44 @@ def test_basic_scene_with_default_values(tmp_path, manim_cfg_file, simple_scenes
     assert exit_code == 0, err
 
 
+@pytest.mark.slow()
+def test_resolution_flag(tmp_path, manim_cfg_file, simple_scenes_path):
+    scene_name = "NoAnimations"
+    resolutions = [
+        (720, 480),
+        (1280, 720),
+        (1920, 1080),
+        (2560, 1440),
+        (3840, 2160),
+        (640, 480),
+        (800, 600),
+    ]
+
+    separators = [";", ",", "-"]
+
+    for (width, height), separator in itertools.product(resolutions, separators):
+        command = [
+            sys.executable,
+            "-m",
+            "manim",
+            "--media_dir",
+            str(tmp_path),
+            "--resolution",
+            f"{width}{separator}{height}",
+            str(simple_scenes_path),
+            scene_name,
+        ]
+
+        _, err, exit_code = capture(command)
+        assert exit_code == 0, err
+
+        path = (
+            tmp_path / "videos" / "simple_scenes" / f"{height}p60" / f"{scene_name}.mp4"
+        )
+        meta = get_video_metadata(path)
+        assert (width, height) == (meta["width"], meta["height"])
+
+
 @pytest.mark.slow
 @video_comparison(
     "SquareToCircleWithlFlag.json",
diff --git a/tests/test_scene_rendering/simple_scenes.py b/tests/test_scene_rendering/simple_scenes.py
--- a/tests/test_scene_rendering/simple_scenes.py
+++ b/tests/test_scene_rendering/simple_scenes.py
@@ -32,7 +32,7 @@ class NoAnimations(Scene):
     def construct(self):
         dot = Dot().set_color(GREEN)
         self.add(dot)
-        self.wait(1)
+        self.wait(0.1)
 
 
 class SceneWithStaticWait(Scene):
diff --git a/tests/test_scene_rendering/test_cli_flags.py b/tests/test_scene_rendering/test_cli_flags.py
--- a/tests/test_scene_rendering/test_cli_flags.py
+++ b/tests/test_scene_rendering/test_cli_flags.py
@@ -1,3 +1,4 @@
+import itertools
 import sys
 from pathlib import Path
 
@@ -6,7 +7,7 @@
 from click.testing import CliRunner
 from PIL import Image
 
-from manim import capture
+from manim import capture, get_video_metadata
 from manim.__main__ import main
 from manim.utils.file_ops import add_version_before_extension
 
@@ -33,6 +34,44 @@ def test_basic_scene_with_default_values(tmp_path, manim_cfg_file, simple_scenes
     assert exit_code == 0, err
 
 
+@pytest.mark.slow
+def test_resolution_flag(tmp_path, manim_cfg_file, simple_scenes_path):
+    scene_name = "NoAnimations"
+    resolutions = [
+        (720, 480),
+        (1280, 720),
+        (1920, 1080),
+        (2560, 1440),
+        (3840, 2160),
+        (640, 480),
+        (800, 600),
+    ]
+
+    separators = [";", ",", "-"]
+
+    for (width, height), separator in itertools.product(resolutions, separators):
+        command = [
+            sys.executable,
+            "-m",
+            "manim",
+            "--media_dir",
+            str(tmp_path),
+            "--resolution",
+            f"{width}{separator}{height}",
+            str(simple_scenes_path),
+            scene_name,
+        ]
+
+        _, err, exit_code = capture(command)
+        assert exit_code == 0, err
+
+        path = (
+            tmp_path / "videos" / "simple_scenes" / f"{height}p60" / f"{scene_name}.mp4"
+        )
+        meta = get_video_metadata(path)
+        assert (width, height) == (meta["width"], meta["height"])
+
+
 @pytest.mark.slow
 @video_comparison(
     "SquareToCircleWithlFlag.json",