Skip to content

Commit 4a4a41f

Browse files
committed
Add image test for matplotlib#26892
1 parent 896b280 commit 4a4a41f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Binary file not shown.

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,27 @@ def test_sketch_params():
406406
# \pgfdecoratecurrentpath must be after the path definition and before the
407407
# path is used (\pgfusepath)
408408
assert baseline in buf
409+
410+
411+
# test to make sure that the document font size is set consistently (see #26892)
412+
@needs_pgf_xelatex
413+
@pytest.mark.skipif(
414+
not _has_tex_package('unicode-math'), reason='needs unicode-math.sty'
415+
)
416+
@pytest.mark.backend('pgf')
417+
@image_comparison(['pgf_document_font_size.pdf'], style='default', remove_text=True)
418+
def test_document_font_size():
419+
mpl.rcParams.update({
420+
'pgf.texsystem': 'xelatex',
421+
'pgf.rcfonts': False,
422+
'pgf.preamble': r'\usepackage{unicode-math}',
423+
})
424+
plt.figure()
425+
plt.plot([],
426+
label=r'$this is a very very very long math label a \times b + 10^{-3}$ '
427+
r'and some text'
428+
)
429+
plt.plot([],
430+
label=r'\normalsize the document font size is \the\fontdimen6\font'
431+
)
432+
plt.legend()

0 commit comments

Comments
 (0)