File: test_colors.py

package info (click to toggle)
manimpango 0.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,804 kB
  • sloc: python: 1,252; sh: 164; makefile: 18
file content (26 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
from pathlib import Path

import pytest

from . import CASES_DIR
from ._manim import Text
from .svg_tester import SVGStyleTester


def test_invalid_color_fail(tmpdir):
    loc = Path(tmpdir, "test.svg")
    assert not loc.exists()
    with pytest.raises(ValueError):
        Text("color", color="invalid", filename=str(loc))


def test_colors(tmpdir):
    expected = Path(CASES_DIR, "color_red.svg")
    loc = Path(tmpdir, "test.svg")
    assert not loc.exists()
    Text("color", color="red", filename=str(loc))
    assert loc.exists()
    s = SVGStyleTester(gotSVG=loc, expectedSVG=expected)
    assert len(s.got_svg_style) == len(s.expected_svg_style)
    assert s.got_svg_style == s.expected_svg_style