https://bugs.ghostscript.com/show_bug.cgi?id=707560 Ensure that redactions also remove characters with an empty width bbox.
()
| 843 | |
| 844 | |
| 845 | def test_707560(): |
| 846 | """https://bugs.ghostscript.com/show_bug.cgi?id=707560 |
| 847 | Ensure that redactions also remove characters with an empty width bbox. |
| 848 | """ |
| 849 | # Make text that will contain characters with an empty bbox. |
| 850 | |
| 851 | greetings = ( |
| 852 | "Hello, World!", # english |
| 853 | "Hallo, Welt!", # german |
| 854 | "سلام دنیا!", # persian |
| 855 | "வணக்கம், உலகம்!", # tamil |
| 856 | "สวัสดีชาวโลก!", # thai |
| 857 | "Привіт Світ!", # ucranian |
| 858 | "שלום עולם!", # hebrew |
| 859 | "ওহে বিশ্ব!", # bengali |
| 860 | "你好世界!", # chinese |
| 861 | "こんにちは世界!", # japanese |
| 862 | "안녕하세요, 월드!", # korean |
| 863 | "नमस्कार, विश्व !", # sanskrit |
| 864 | "हैलो वर्ल्ड!", # hindi |
| 865 | ) |
| 866 | text = " ... ".join([g for g in greetings]) |
| 867 | where = (50, 50, 400, 500) |
| 868 | story = pymupdf.Story(text) |
| 869 | bio = io.BytesIO() |
| 870 | writer = pymupdf.DocumentWriter(bio) |
| 871 | more = True |
| 872 | while more: |
| 873 | dev = writer.begin_page(pymupdf.paper_rect("a4")) |
| 874 | more, _ = story.place(where) |
| 875 | story.draw(dev) |
| 876 | writer.end_page() |
| 877 | writer.close() |
| 878 | doc = pymupdf.open("pdf", bio) |
| 879 | page = doc[0] |
| 880 | text = page.get_text() |
| 881 | assert text, "Unexpected: test page has no text." |
| 882 | page.add_redact_annot(page.rect) |
| 883 | page.apply_redactions() |
| 884 | assert not page.get_text(), "Unexpected: text not fully redacted." |
| 885 | |
| 886 | |
| 887 | def test_3070(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…