Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0354d65

Browse files
committed
Add test for metadata
1 parent e9128a2 commit 0354d65

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ def test_pdf_pages():
208208
}
209209
mpl.rcParams.update(rc_pdflatex)
210210

211-
Y, X = np.ogrid[-1:1:40j, -1:1:40j]
212-
213211
fig1 = plt.figure()
214212
ax1 = fig1.add_subplot(1, 1, 1)
215213
ax1.plot(range(5))
@@ -223,3 +221,24 @@ def test_pdf_pages():
223221
with PdfPages(os.path.join(result_dir, 'pdfpages.pdf')) as pdf:
224222
pdf.savefig(fig1)
225223
pdf.savefig(fig2)
224+
225+
226+
@needs_xelatex
227+
@pytest.mark.style('default')
228+
@pytest.mark.backend('pgf')
229+
def test_pdf_pages_metadata():
230+
rc_pdflatex = {
231+
'font.family': 'serif',
232+
'pgf.rcfonts': False,
233+
}
234+
mpl.rcParams.update(rc_pdflatex)
235+
236+
fig = plt.figure()
237+
ax = fig.add_subplot(1, 1, 1)
238+
ax.plot(range(5))
239+
fig.tight_layout()
240+
241+
md = {'author': 'me', 'title': 'Multipage PDF with pgf'}
242+
with PdfPages(os.path.join(result_dir, 'pdfpages.pdf'), metadata=md) as pdf:
243+
pdf.savefig(fig)
244+
pdf.savefig(fig)

0 commit comments

Comments
 (0)