()
| 496 | |
| 497 | |
| 498 | def test_4245(): |
| 499 | path = os.path.normpath(f'{__file__}/../../tests/resources/test_4245.pdf') |
| 500 | with pymupdf.open(path) as document: |
| 501 | page = document[0] |
| 502 | regions = page.search_for('Bart Simpson') |
| 503 | print(f'{regions=}') |
| 504 | page.add_highlight_annot(regions) |
| 505 | with pymupdf.open(path) as document: |
| 506 | page = document[0] |
| 507 | regions = page.search_for('Bart Simpson') |
| 508 | for region in regions: |
| 509 | highlight = page.add_highlight_annot(region) |
| 510 | highlight.update() |
| 511 | pixmap = page.get_pixmap() |
| 512 | path_out = os.path.normpath(f'{__file__}/../../tests/resources/test_4245_out.png') |
| 513 | pixmap.save(path_out) |
| 514 | |
| 515 | path_expected = os.path.normpath(f'{__file__}/../../tests/resources/test_4245_expected.png') |
| 516 | rms = gentle_compare.pixmaps_rms(path_expected, pixmap) |
| 517 | pixmap_diff = gentle_compare.pixmaps_diff(path_expected, pixmap) |
| 518 | path_diff = os.path.normpath(f'{__file__}/../../tests/resources/test_4245_diff.png') |
| 519 | pixmap_diff.save(path_diff) |
| 520 | print(f'{rms=}') |
| 521 | assert rms < 0.01 |
| 522 | |
| 523 | |
| 524 | def test_4180(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…