Mercurial > hgrepos > Python2 > PyMuPDF
comparison tests/test_4141.py @ 3:2c135c81b16c
MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:44:09 +0200 |
| parents | 1d09e1dec1d9 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:6015a75abc2d | 3:2c135c81b16c |
|---|---|
| 1 import pymupdf | |
| 2 | |
| 3 import os.path | |
| 4 | |
| 5 | |
| 6 def test_4141(): | |
| 7 """survive missing /Resources object in a number of cases.""" | |
| 8 path = os.path.abspath(f"{__file__}/../../tests/resources/test_4141.pdf") | |
| 9 doc = pymupdf.open(path) | |
| 10 page = doc[0] | |
| 11 # make sure the right test file | |
| 12 assert doc.xref_get_key(page.xref, "Resources") == ("null", "null") | |
| 13 page.insert_htmlbox((100, 100, 200, 200), "Hallo") # will fail without the fix | |
| 14 doc.close() | |
| 15 doc = pymupdf.open(doc.name) | |
| 16 page = doc[0] | |
| 17 tw = pymupdf.TextWriter(page.rect) | |
| 18 tw.append((100, 100), "Hallo") | |
| 19 tw.write_text(page) # will fail without the fix |
