Mercurial > hgrepos > Python2 > PyMuPDF
comparison tests/test_4505.py @ 3:2c135c81b16c
MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:44:09 +0200 |
| parents | 1d09e1dec1d9 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:6015a75abc2d | 3:2c135c81b16c |
|---|---|
| 1 import pymupdf | |
| 2 import os.path | |
| 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} |
