mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-18 03:05:21 +08:00

* chore(lib/cli): one video per slide As titled, this PR changes how Manim Slides used to work by only storing one video file per slide. Previously, a slide would store all animations that occur during the given slide. Up to now, the only "advantage" of this was that it would allow the user to know which animation is played. But, at the cost of a very complex logic in present, just especially for reversed slides. On top of top, all converter actually need to concatenate the animations from each slide into one, so it is now performed at rendering time. To migrate from previous Manim Slides versions, the best is the render the slides again, using `manim render` or `manimgl render`. Currently, it is not possible to start at a given animation anymore. However, if wanted, I may re-implement this, but this would require to change the config file again. * fix(ci): trying to fix tests * chore(test): renaming files * chore(docs): remove old line from changelog * fix(docs): typo * fix(ci): manimgl and smarter comparison * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from typing import Any
|
|
|
|
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from manim_slides.config import Key, PresentationConfig
|
|
|
|
|
|
class TestKey:
|
|
@pytest.mark.parametrize(("ids", "name"), [([1], None), ([1], "some key name")])
|
|
def test_valid_keys(self, ids: Any, name: Any) -> None:
|
|
_ = Key(ids=ids, name=name)
|
|
|
|
@pytest.mark.parametrize(
|
|
("ids", "name"), [([], None), ([-1], None), ([1], {"an": " invalid name"})]
|
|
)
|
|
def test_invalid_keys(self, ids: Any, name: Any) -> None:
|
|
with pytest.raises(ValidationError):
|
|
_ = Key(ids=ids, name=name)
|
|
|
|
|
|
class TestPresentationConfig:
|
|
def test_validate(self, presentation_config: PresentationConfig) -> None:
|
|
obj = presentation_config.model_dump()
|
|
_ = PresentationConfig.model_validate(obj)
|
|
|
|
def test_bump_to_json(self, presentation_config: PresentationConfig) -> None:
|
|
_ = presentation_config.model_dump_json(indent=2)
|
|
|
|
def test_empty_presentation_config(self) -> None:
|
|
with pytest.raises(ValidationError):
|
|
_ = PresentationConfig(slides=[], files=[])
|