(system)
| 218 | pytest.param('xelatex', marks=[needs_pgf_xelatex]), |
| 219 | ]) |
| 220 | def test_pdf_pages(system): |
| 221 | rc_pdflatex = { |
| 222 | 'font.family': 'serif', |
| 223 | 'pgf.rcfonts': False, |
| 224 | 'pgf.texsystem': system, |
| 225 | } |
| 226 | mpl.rcParams.update(rc_pdflatex) |
| 227 | |
| 228 | fig1, ax1 = plt.subplots() |
| 229 | ax1.plot(range(5)) |
| 230 | fig1.tight_layout() |
| 231 | |
| 232 | fig2, ax2 = plt.subplots(figsize=(3, 2)) |
| 233 | ax2.plot(range(5)) |
| 234 | fig2.tight_layout() |
| 235 | |
| 236 | path = os.path.join(result_dir, f'pdfpages_{system}.pdf') |
| 237 | md = { |
| 238 | 'Author': 'me', |
| 239 | 'Title': 'Multipage PDF with pgf', |
| 240 | 'Subject': 'Test page', |
| 241 | 'Keywords': 'test,pdf,multipage', |
| 242 | 'ModDate': datetime.datetime( |
| 243 | 1968, 8, 1, tzinfo=datetime.timezone(datetime.timedelta(0))), |
| 244 | 'Trapped': 'Unknown' |
| 245 | } |
| 246 | |
| 247 | with PdfPages(path, metadata=md) as pdf: |
| 248 | pdf.savefig(fig1) |
| 249 | pdf.savefig(fig2) |
| 250 | pdf.savefig(fig1) |
| 251 | |
| 252 | assert pdf.get_pagecount() == 3 |
| 253 | |
| 254 | |
| 255 | @mpl.style.context('default') |
nothing calls this directly
no test coverage detected
searching dependent graphs…