Mercurial > hgrepos > Python2 > PyMuPDF
diff tests/test_pixmap.py @ 39:a6bc019ac0b2 upstream
ADD: PyMuPDF v1.26.5: the original sdist.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 11 Oct 2025 11:19:58 +0200 |
| parents | 1d09e1dec1d9 |
| children |
line wrap: on
line diff
--- a/tests/test_pixmap.py Mon Sep 15 11:43:07 2025 +0200 +++ b/tests/test_pixmap.py Sat Oct 11 11:19:58 2025 +0200 @@ -70,7 +70,7 @@ pix2 = pymupdf.Pixmap(stream) assert repr(pix1) == repr(pix2) except ModuleNotFoundError: - assert platform.system() == 'Windows' and sys.maxsize == 2**31 - 1 + assert platform.system() in ('Windows', 'Emscripten') and sys.maxsize == 2**31 - 1 def test_save(tmpdir): @@ -556,6 +556,9 @@ def test_4445(): + if os.environ.get('PYODIDE_ROOT'): + print('test_4445(): not running on Pyodide - cannot run child processes.') + return print() # Test case is large so we download it instead of having it in PyMuPDF # git. We put it in `cache/` directory do it is not removed by `git clean` @@ -628,3 +631,22 @@ assert rms == 0 else: assert rms >= 10 + + +def test_4699(): + path = os.path.normpath(f'{__file__}/../../tests/resources/test_4699.pdf') + path_png_expected = os.path.normpath(f'{__file__}/../../tests/resources/test_4699.png') + path_png_actual = os.path.normpath(f'{__file__}/../../tests/test_4699.png') + with pymupdf.open(path) as document: + page = document[0] + pixmap = page.get_pixmap() + pixmap.save(path_png_actual) + print(f'Have saved to {path_png_actual=}.') + rms = gentle_compare.pixmaps_rms(path_png_expected, pixmap) + print(f'test_4699(): {rms=}') + if pymupdf.mupdf_version_tuple >= (1, 27): + assert rms == 0 + else: + wt = pymupdf.TOOLS.mupdf_warnings() + assert 'syntax error: cannot find ExtGState resource' in wt + assert rms > 20
