Skip to content

Commit fb63ca0

Browse files
committed
tests/: Updated tests to take MuPDF 1.26.0 into account.
1 parent 104051b commit fb63ca0

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

tests/test_general.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def test_iswrapped():
5858
doc = pymupdf.open(filename)
5959
page = doc[0]
6060
assert page.is_wrapped
61+
wt = pymupdf.TOOLS.mupdf_warnings()
62+
if pymupdf.mupdf_version_tuple >= (1, 26, 0):
63+
assert wt == 'bogus font ascent/descent values (0 / 0)'
64+
else:
65+
assert not wt
6166

6267

6368
def test_wrapcontents():
@@ -73,7 +78,10 @@ def test_wrapcontents():
7378
rebased = hasattr(pymupdf, 'mupdf')
7479
if rebased:
7580
wt = pymupdf.TOOLS.mupdf_warnings()
76-
assert wt == 'PDF stream Length incorrect'
81+
if pymupdf.mupdf_version_tuple >= (1, 26, 0):
82+
assert wt == 'bogus font ascent/descent values (0 / 0)\nPDF stream Length incorrect'
83+
else:
84+
assert wt == 'PDF stream Length incorrect'
7785

7886

7987
def test_page_clean_contents():
@@ -240,6 +248,11 @@ def test_get_text_dict():
240248
blocks=page.get_text("dict")["blocks"]
241249
# Check no opaque types in `blocks`.
242250
json.dumps( blocks, indent=4)
251+
wt = pymupdf.TOOLS.mupdf_warnings()
252+
if pymupdf.mupdf_version_tuple >= (1, 26, 0):
253+
assert wt == 'bogus font ascent/descent values (0 / 0)'
254+
else:
255+
assert not wt
243256

244257
def test_font():
245258
font = pymupdf.Font()

tests/test_pixmap.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ def product(x, y):
200200
else:
201201
assert rms == 0
202202
wt = pymupdf.TOOLS.mupdf_warnings()
203-
assert wt == 'PDF stream Length incorrect'
203+
if pymupdf.mupdf_version_tuple >= (1, 26, 0):
204+
assert wt == 'bogus font ascent/descent values (0 / 0)\nPDF stream Length incorrect'
205+
else:
206+
assert wt == 'PDF stream Length incorrect'
204207

205208
def test_3058():
206209
doc = pymupdf.Document(os.path.abspath(f'{__file__}/../../tests/resources/test_3058.pdf'))

tests/test_tables.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ def test_2979():
180180
pymupdf.TOOLS.set_small_glyph_heights() is False
181181
), f"{pymupdf.TOOLS.set_small_glyph_heights()=}"
182182

183+
wt = pymupdf.TOOLS.mupdf_warnings()
184+
if pymupdf.mupdf_version_tuple >= (1, 26, 0):
185+
assert wt == 'bogus font ascent/descent values (3117 / -2463)\n... repeated 2 times...'
186+
else:
187+
assert not wt
188+
183189

184190
def test_3062():
185191
"""Tests the fix for #3062.

0 commit comments

Comments
 (0)