Skip to content

Commit

Permalink
test new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
behackl committed Oct 26, 2023
1 parent eb905f3 commit b165efc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/module/mobject/text/test_texmobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pathlib import Path

import numpy as np
import pytest

from manim import MathTex, SingleStringMathTex, Tex, TexTemplate, config, tempconfig
Expand Down Expand Up @@ -96,6 +97,23 @@ def test_tex_white_space_and_non_whitespace_args():
assert len(tex[3]) == len("".join(str_part_4.split()))


def test_multi_part_tex_with_empty_parts():
"""Check that if a Tex or MathTex Mobject with multiple
string arguments is created where some of the parts render
as empty SVGs, then the number of family members with points
should still be the same as the snipped in one singular part.
"""
tex_parts = ["(-1)", "^{", "0}"]
one_part_fomula = MathTex("".join(tex_parts))
multi_part_formula = MathTex(*tex_parts)

for one_part_glyph, multi_part_glyph in zip(
one_part_fomula.family_members_with_points(),
multi_part_formula.family_members_with_points()
):
np.testing.assert_allclose(one_part_glyph.points, multi_part_glyph.points)


def test_tex_size():
"""Check that the size of a :class:`Tex` string is not changed."""
text = Tex("what").center()
Expand Down

0 comments on commit b165efc

Please sign in to comment.