Skip to content

Commit e6a0877

Browse files
tests/: added test_4445()
Downloads large input file from github.
1 parent 26ad9d5 commit e6a0877

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_pixmap.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,3 +550,32 @@ def test_4423():
550550
assert not ee, f'Received unexpected exception: {e}'
551551
wt = pymupdf.TOOLS.mupdf_warnings()
552552
assert wt == 'format error: cannot find object in xref (56 0 R)\nformat error: cannot find object in xref (68 0 R)'
553+
554+
555+
def test_4445():
556+
print()
557+
# Test case is large so we download it instead of having it in PyMuPDF
558+
# git. We put it in `cache/` directory do it is not removed by `git clean`
559+
# (unless `-d` is specified).
560+
import util
561+
path = util.download(
562+
'https://github.com/user-attachments/files/19738242/ss.pdf',
563+
'test_4445.pdf',
564+
size=2671185,
565+
)
566+
with pymupdf.open(path) as document:
567+
page = document[0]
568+
pixmap = page.get_pixmap()
569+
print(f'{pixmap.width=}')
570+
print(f'{pixmap.height=}')
571+
if pymupdf.mupdf_version_tuple >= (1, 26):
572+
assert (pixmap.width, pixmap.height) == (792, 612)
573+
else:
574+
assert (pixmap.width, pixmap.height) == (612, 792)
575+
if 0:
576+
path_pixmap = f'{path}.png'
577+
pixmap.save(path_pixmap)
578+
print(f'Have created {path_pixmap=}')
579+
wt = pymupdf.TOOLS.mupdf_warnings()
580+
print(f'{wt=}')
581+
assert wt == 'broken xref subsection, proceeding anyway.\nTrailer Size is off-by-one. Ignoring.'

0 commit comments

Comments
 (0)