Copy field flags to Parent widget and all of its kids.
()
| 3 | |
| 4 | |
| 5 | def test_4505(): |
| 6 | """Copy field flags to Parent widget and all of its kids.""" |
| 7 | path = os.path.abspath(f"{__file__}/../../tests/resources/test_4505.pdf") |
| 8 | doc = pymupdf.open(path) |
| 9 | page = doc[0] |
| 10 | text1_flags_before = {} |
| 11 | text1_flags_after = {} |
| 12 | # extract all widgets having the same field name |
| 13 | for w in page.widgets(): |
| 14 | if w.field_name != "text_1": |
| 15 | continue |
| 16 | text1_flags_before[w.xref] = w.field_flags |
| 17 | # expected exiting field flags |
| 18 | assert text1_flags_before == {8: 1, 10: 0, 33: 0} |
| 19 | w = page.load_widget(8) # first of these widgets |
| 20 | # give all connected widgets that field flags value |
| 21 | w.update(sync_flags=True) |
| 22 | # confirm that all connected widgets have the same field flags |
| 23 | for w in page.widgets(): |
| 24 | if w.field_name != "text_1": |
| 25 | continue |
| 26 | text1_flags_after[w.xref] = w.field_flags |
| 27 | assert text1_flags_after == {8: 1, 10: 1, 33: 1} |
nothing calls this directly
no test coverage detected
searching dependent graphs…