Confirm correctly abandoning cache when reloading a page.
()
| 593 | |
| 594 | |
| 595 | def test_2596(): |
| 596 | """Confirm correctly abandoning cache when reloading a page.""" |
| 597 | if platform.python_implementation() == 'GraalVM': |
| 598 | print(f'test_2596(): not running on Graal.') |
| 599 | return |
| 600 | doc = pymupdf.Document(f"{scriptdir}/resources/test_2596.pdf") |
| 601 | page = doc[0] |
| 602 | pix0 = page.get_pixmap() # render the page |
| 603 | _ = doc.tobytes(garbage=3) # save with garbage collection |
| 604 | |
| 605 | # Note this will invalidate cache content for this page. |
| 606 | # Reloading the page now empties the cache, so rendering |
| 607 | # will deliver the same pixmap |
| 608 | page = doc.reload_page(page) |
| 609 | pix1 = page.get_pixmap() |
| 610 | assert pix1.samples == pix0.samples |
| 611 | if pymupdf.mupdf_version_tuple < (1, 26, 6): |
| 612 | wt = pymupdf.TOOLS.mupdf_warnings() |
| 613 | assert wt == 'too many indirections (possible indirection cycle involving 24 0 R)' |
| 614 | |
| 615 | |
| 616 | def test_2730(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…