()
| 504 | |
| 505 | |
| 506 | def test_4435(): |
| 507 | print(f'{pymupdf.version=}') |
| 508 | path = os.path.normpath(f'{__file__}/../../tests/resources/test_4435.pdf') |
| 509 | with pymupdf.open(path) as document: |
| 510 | page = document[2] |
| 511 | print(f'Calling page.get_pixmap().', flush=1) |
| 512 | if ( |
| 513 | pymupdf.mupdf_version_tuple >= (1, 27) |
| 514 | and ( |
| 515 | os.environ.get('PYODIDE_ROOT') |
| 516 | or (platform.system() == 'Windows' and sys.maxsize.bit_length()+1 == 32) |
| 517 | ) |
| 518 | ): |
| 519 | # 2025-11-07: Expect alloc failure. |
| 520 | try: |
| 521 | pixmap = page.get_pixmap(alpha=False, dpi=120) |
| 522 | except Exception as e: |
| 523 | print(f'Received exception: {type(e)=}: {e}') |
| 524 | assert isinstance(e, pymupdf.mupdf.FzErrorSystem), f'Unrecognised {type(e)=}' |
| 525 | m = re.match('code=2: malloc [(][0-9]+ bytes[)] failed', str(e)) |
| 526 | assert m, f'Unrecognised exception text: {e}' |
| 527 | return |
| 528 | else: |
| 529 | # Hopefully this means that mupdf has been fixed. |
| 530 | assert 0, 'Expected alloc failure on pyodide' |
| 531 | else: |
| 532 | pixmap = page.get_pixmap(alpha=False, dpi=120) |
| 533 | print(f'Called page.get_pixmap().', flush=1) |
| 534 | if pymupdf.mupdf_version_tuple < (1, 27): |
| 535 | assert pymupdf.TOOLS.mupdf_warnings() == 'bogus font ascent/descent values (0 / 0)\n... repeated 9 times...' |
| 536 | |
| 537 | |
| 538 | def test_4423(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…