MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_3854

Function test_3854

tests/test_pixmap.py:418–438  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

416
417
418def test_3854():
419 path = os.path.normpath(f'{__file__}/../../tests/resources/test_3854.pdf')
420 with pymupdf.open(path) as document:
421 page = document[0]
422 pixmap = page.get_pixmap()
423 pixmap.save(os.path.normpath(f'{__file__}/../../tests/test_3854_out.png'))
424
425 # 2024-11-29: this is the incorrect expected output.
426 path_expected_png = os.path.normpath(f'{__file__}/../../tests/resources/test_3854_expected.png')
427 pixmap_expected = pymupdf.Pixmap(path_expected_png)
428 pixmap_diff = gentle_compare.pixmaps_diff(pixmap_expected, pixmap)
429 path_diff = os.path.normpath(f'{__file__}/../../tests/resources/test_3854_diff.png')
430 pixmap_diff.save(path_diff)
431 rms = gentle_compare.pixmaps_rms(pixmap, pixmap_expected)
432 print(f'{rms=}.')
433 if os.environ.get('PYMUPDF_SYSINSTALL_TEST') == '1':
434 # MuPDF using external third-party libs gives slightly different
435 # behaviour.
436 assert rms < 2
437 else:
438 assert rms == 0
439
440
441def test_4155():

Callers

nothing calls this directly

Calls 3

get_pixmapMethod · 0.45
saveMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…