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

Function test_4505

tests/test_4505.py:5–27  ·  view source on GitHub ↗

Copy field flags to Parent widget and all of its kids.

()

Source from the content-addressed store, hash-verified

3
4
5def 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}

Callers

nothing calls this directly

Calls 3

widgetsMethod · 0.80
load_widgetMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…