Skip to content

Commit 26ad9d5

Browse files
tests/: added test_4423().
1 parent 4884190 commit 26ad9d5

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/resources/test_4423.pdf

154 KB
Binary file not shown.

tests/test_pixmap.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,3 +522,31 @@ def test_4435():
522522
print(f'Called page.get_pixmap().', flush=1)
523523
wt = pymupdf.TOOLS.mupdf_warnings()
524524
assert wt == 'bogus font ascent/descent values (0 / 0)\n... repeated 9 times...'
525+
526+
527+
def test_4423():
528+
path = os.path.normpath(f'{__file__}/../../tests/resources/test_4423.pdf')
529+
with pymupdf.open(path) as document:
530+
path2 = f'{path}.pdf'
531+
ee = None
532+
try:
533+
document.save(
534+
path2,
535+
garbage=4,
536+
expand=1,
537+
deflate=True,
538+
pretty=True,
539+
no_new_id=True,
540+
)
541+
except Exception as e:
542+
print(f'Exception: {e}')
543+
ee = e
544+
545+
if (1, 25, 5) <= pymupdf.mupdf_version_tuple < (1, 26):
546+
assert ee, f'Did not receive the expected exception.'
547+
wt = pymupdf.TOOLS.mupdf_warnings()
548+
assert wt == 'dropping unclosed output'
549+
else:
550+
assert not ee, f'Received unexpected exception: {e}'
551+
wt = pymupdf.TOOLS.mupdf_warnings()
552+
assert wt == 'format error: cannot find object in xref (56 0 R)\nformat error: cannot find object in xref (68 0 R)'

0 commit comments

Comments
 (0)