Skip to content

Commit bbbfef6

Browse files
committed
Use image_comparison decorator in pgf tests.
1 parent e903c34 commit bbbfef6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/matplotlib/tests/test_backend_pgf.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import matplotlib.pyplot as plt
1212
from matplotlib.compat import subprocess
1313
from matplotlib.testing.compare import compare_images, ImageComparisonFailure
14-
from matplotlib.testing.decorators import _image_directories
14+
from matplotlib.testing.decorators import image_comparison, _image_directories
1515

1616
baseline_dir, result_dir = _image_directories(lambda: 'dummy func')
1717

@@ -81,20 +81,21 @@ def create_figure():
8181

8282
# test compiling a figure to pdf with xelatex
8383
@needs_xelatex
84-
@pytest.mark.style('default')
8584
@pytest.mark.backend('pgf')
85+
@image_comparison(baseline_images=['pgf_xelatex'], extensions=['pdf'],
86+
style='default')
8687
def test_xelatex():
8788
rc_xelatex = {'font.family': 'serif',
8889
'pgf.rcfonts': False}
8990
mpl.rcParams.update(rc_xelatex)
9091
create_figure()
91-
compare_figure('pgf_xelatex.pdf', tol=0)
9292

9393

9494
# test compiling a figure to pdf with pdflatex
9595
@needs_pdflatex
96-
@pytest.mark.style('default')
9796
@pytest.mark.backend('pgf')
97+
@image_comparison(baseline_images=['pgf_pdflatex'], extensions=['pdf'],
98+
style='default')
9899
def test_pdflatex():
99100
import os
100101
if os.environ.get('APPVEYOR', False):
@@ -108,7 +109,6 @@ def test_pdflatex():
108109
'\\usepackage[T1]{fontenc}']}
109110
mpl.rcParams.update(rc_pdflatex)
110111
create_figure()
111-
compare_figure('pgf_pdflatex.pdf', tol=0)
112112

113113

114114
# test updating the rc parameters for each figure
@@ -162,8 +162,9 @@ def test_pathclip():
162162

163163
# test mixed mode rendering
164164
@needs_xelatex
165-
@pytest.mark.style('default')
166165
@pytest.mark.backend('pgf')
166+
@image_comparison(baseline_images=['pgf_mixedmode'], extensions=['pdf'],
167+
style='default')
167168
def test_mixedmode():
168169
rc_xelatex = {'font.family': 'serif',
169170
'pgf.rcfonts': False}
@@ -172,7 +173,6 @@ def test_mixedmode():
172173
Y, X = np.ogrid[-1:1:40j, -1:1:40j]
173174
plt.figure()
174175
plt.pcolor(X**2 + Y**2).set_rasterized(True)
175-
compare_figure('pgf_mixedmode.pdf', tol=0)
176176

177177

178178
# test bbox_inches clipping

0 commit comments

Comments
 (0)