Mercurial > hgrepos > Python2 > PyMuPDF
view tests/test_4505.py @ 46:7ee69f120f19 default tip
>>>>> tag v1.26.5+1 for changeset b74429b0f5c4
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 11 Oct 2025 17:17:30 +0200 |
| parents | 1d09e1dec1d9 |
| children |
line wrap: on
line source
import pymupdf import os.path def test_4505(): """Copy field flags to Parent widget and all of its kids.""" path = os.path.abspath(f"{__file__}/../../tests/resources/test_4505.pdf") doc = pymupdf.open(path) page = doc[0] text1_flags_before = {} text1_flags_after = {} # extract all widgets having the same field name for w in page.widgets(): if w.field_name != "text_1": continue text1_flags_before[w.xref] = w.field_flags # expected exiting field flags assert text1_flags_before == {8: 1, 10: 0, 33: 0} w = page.load_widget(8) # first of these widgets # give all connected widgets that field flags value w.update(sync_flags=True) # confirm that all connected widgets have the same field flags for w in page.widgets(): if w.field_name != "text_1": continue text1_flags_after[w.xref] = w.field_flags assert text1_flags_after == {8: 1, 10: 1, 33: 1}
