Skip to content

Commit a2b4ba3

Browse files
tests/: added test_3448().
Checks issue #3448.
1 parent 49b028a commit a2b4ba3

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

tests/resources/test_3448.pdf

46.4 KB
Binary file not shown.
18 KB
Loading

tests/test_pixmap.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
import pymupdf
9+
import gentle_compare
910

1011
import os
1112
import platform
@@ -388,3 +389,21 @@ def test_3994():
388389
percent, color = pix.color_topusage()
389390
wt = pymupdf.TOOLS.mupdf_warnings()
390391
assert wt == 'premature end of data in flate filter\n... repeated 2 times...'
392+
393+
394+
def test_3448():
395+
path = os.path.normpath(f'{__file__}/../../tests/resources/test_3448.pdf')
396+
with pymupdf.open(path) as document:
397+
page = document[0]
398+
pixmap = page.get_pixmap(alpha=False, dpi=150)
399+
path_out = f'{path}.png'
400+
pixmap.save(path_out)
401+
print(f'Have written to: {path_out}')
402+
path_expected = os.path.normpath(f'{__file__}/../../tests/resources/test_3448.pdf-expected.png')
403+
pixmap_expected = pymupdf.Pixmap(path_expected)
404+
diff = gentle_compare.pixmaps_rms(pixmap, pixmap_expected)
405+
print(f'{diff=}')
406+
if pymupdf.mupdf_version_tuple < (1, 25):
407+
assert 30 <= diff < 45
408+
else:
409+
assert 0 <= diff < 0.5

0 commit comments

Comments
 (0)