Skip to content

Commit 4736de1

Browse files
SocobSimon May
authored andcommitted
Add image test for #26892
1 parent 4b853bc commit 4736de1

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
@@ -402,3 +402,27 @@ def test_sketch_params():
402402
# \pgfdecoratecurrentpath must be after the path definition and before the
403403
# path is used (\pgfusepath)
404404
assert baseline in buf
405+
406+
407+
# test to make sure that the document font size is set consistently (see #26892)
408+
@needs_pgf_xelatex
409+
@pytest.mark.skipif(
410+
not _has_tex_package('unicode-math'), reason='needs unicode-math.sty'
411+
)
412+
@pytest.mark.backend('pgf')
413+
@image_comparison(['pgf_document_font_size.pdf'], style='default', remove_text=True)
414+
def test_document_font_size():
415+
mpl.rcParams.update({
416+
'pgf.texsystem': 'xelatex',
417+
'pgf.rcfonts': False,
418+
'pgf.preamble': r'\usepackage{unicode-math}',
419+
})
420+
plt.figure()
421+
plt.plot([],
422+
label=r'$this is a very very very long math label a \times b + 10^{-3}$ '
423+
r'and some text'
424+
)
425+
plt.plot([],
426+
label=r'\normalsize the document font size is \the\fontdimen6\font'
427+
)
428+
plt.legend()

0 commit comments

Comments
 (0)