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

Function test_4415

tests/test_general.py:1880–1894  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1878 print(f'test_3886(): {rms_0=} {rms_1=}')
1879
1880def test_4415():
1881 path = os.path.normpath(f'{__file__}/../../tests/resources/test_4415.pdf')
1882 path_out = os.path.normpath(f'{__file__}/../../tests/resources/test_4415_out.png')
1883 path_out_expected = os.path.normpath(f'{__file__}/../../tests/resources/test_4415_out_expected.png')
1884 with pymupdf.open(path) as document:
1885 page = document[0]
1886 rot = page.rotation
1887 orig = pymupdf.Point(100, 100) # apparent insertion point
1888 text = 'Text at Top-Left'
1889 mrot = page.derotation_matrix # matrix annihilating page rotation
1890 page.insert_text(orig * mrot, text, fontsize=60, rotate=rot)
1891 pixmap = page.get_pixmap()
1892 pixmap.save(path_out)
1893 rms = gentle_compare.pixmaps_rms(path_out_expected, path_out)
1894 assert rms == 0, f'{rms=}'
1895
1896def test_4466():
1897 path = os.path.normpath(f'{__file__}/../../tests/test_4466.pdf')

Callers

nothing calls this directly

Calls 3

insert_textMethod · 0.45
get_pixmapMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…