Skip to content

Commit 5484892

Browse files
committed
Add smoke test that saving MathText to PNG works.
1 parent 566a7af commit 5484892

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/matplotlib/tests/test_mathtext.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,14 @@ def test_single_minus_sign():
280280
def test_spaces(fig_test, fig_ref):
281281
fig_test.subplots().set_title(r"$1\,2\>3\ 4$")
282282
fig_ref.subplots().set_title(r"$1\/2\:3~4$")
283+
284+
285+
def test_math_to_image(tmpdir):
286+
mathtext.math_to_image('$x^2$', str(tmpdir.join('example.png')))
287+
mathtext.math_to_image('$x^2$', io.BytesIO())
288+
289+
290+
def test_mathtext_to_png(tmpdir):
291+
mt = mathtext.MathTextParser('bitmap')
292+
mt.to_png(str(tmpdir.join('example.png')), '$x^2$')
293+
mt.to_png(io.BytesIO(), '$x^2$')

0 commit comments

Comments
 (0)