Mercurial > hgrepos > Python2 > PyMuPDF
comparison tests/test_4505.py @ 1:1d09e1dec1d9 upstream
ADD: PyMuPDF v1.26.4: the original sdist.
It does not yet contain MuPDF. This normally will be downloaded when
building PyMuPDF.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:37:51 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 1:1d09e1dec1d9 |
|---|---|
| 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} |
