Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fix :attr:`.ManimConfig.format` not updating movie file extension (#3839)

adeshpande628a54535bad
diff --git a/manim/_config/utils.py b/manim/_config/utils.py
index 031631177..6c2492d95 100644
--- a/manim/_config/utils.py
+++ b/manim/_config/utils.py
@@ -1052,6 +1052,7 @@ class ManimConfig(MutableMapping):
val,
[None, "png", "gif", "mp4", "mov", "webm"],
)
+ self.resolve_movie_file_extension(self.transparent)
if self.format == "webm":
logging.getLogger("manim").warning(
"Output format set as webm, this can be slower than other formats",
diff --git a/tests/test_config.py b/tests/test_config.py
index 18f7691cf..6429f1d5c 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -4,6 +4,7 @@ import tempfile
from pathlib import Path
import numpy as np
+import pytest
from manim import WHITE, Scene, Square, Tex, Text, tempconfig
from manim._config.utils import ManimConfig
@@ -33,6 +34,20 @@ def test_tempconfig(config):
assert config[k] == v
+ ("format", "expected_file_extension"),
+ [
+ ("mp4", ".mp4"),
+ ("webm", ".webm"),
+ ("mov", ".mov"),
+ ("gif", ".mp4"),
+ ],
+)
+def test_resolve_file_extensions(config, format, expected_file_extension):
+ config.format = format
+ assert config.movie_file_extension == expected_file_extension
+
+
class MyScene(Scene):
def construct(self):
self.add(Square())