Skip to content

Commit 628a545

Browse files
Fix :attr:.ManimConfig.format not updating movie file extension (#3839)
* Fix config.format not updating config.movie_file_extension * Add test
1 parent 7562596 commit 628a545

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

manim/_config/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ def format(self, val: str) -> None:
10521052
val,
10531053
[None, "png", "gif", "mp4", "mov", "webm"],
10541054
)
1055+
self.resolve_movie_file_extension(self.transparent)
10551056
if self.format == "webm":
10561057
logging.getLogger("manim").warning(
10571058
"Output format set as webm, this can be slower than other formats",

tests/test_config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55

66
import numpy as np
7+
import pytest
78

89
from manim import WHITE, Scene, Square, Tex, Text, tempconfig
910
from manim._config.utils import ManimConfig
@@ -33,6 +34,20 @@ def test_tempconfig(config):
3334
assert config[k] == v
3435

3536

37+
@pytest.mark.parametrize(
38+
("format", "expected_file_extension"),
39+
[
40+
("mp4", ".mp4"),
41+
("webm", ".webm"),
42+
("mov", ".mov"),
43+
("gif", ".mp4"),
44+
],
45+
)
46+
def test_resolve_file_extensions(config, format, expected_file_extension):
47+
config.format = format
48+
assert config.movie_file_extension == expected_file_extension
49+
50+
3651
class MyScene(Scene):
3752
def construct(self):
3853
self.add(Square())

0 commit comments

Comments
 (0)