Skip to content

Commit a0e5b06

Browse files
committed
Adress 4479
Ensure that layer states are correctly reported and can selectively be set.
1 parent 104051b commit a0e5b06

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/resources/test-4479.pdf

156 KB
Binary file not shown.

tests/test_4479.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pymupdf
2+
3+
4+
def test_4479():
5+
if pymupdf.mupdf_version_tuple < (1, 26, 0):
6+
print("Skipping test_4479: requires MuPDF 1.26.0 or later")
7+
return
8+
path = os.path.abspath(f"{__file__}/../../tests/resources/test-4479.pdf")
9+
doc = pymupdf.open(path)
10+
11+
for layer in doc.layer_ui_configs():
12+
if layer["text"] == "layer_2":
13+
assert not layer["on"]
14+
else:
15+
assert layer["on"]
16+
doc.set_layer_ui_config("layer_7", action=pymupdf.PDF_OC_TOGGLE)
17+
for layer in doc.layer_ui_configs():
18+
if layer["text"] in ("layer_2", "layer_7"):
19+
assert not layer["on"]
20+
else:
21+
assert layer["on"]

0 commit comments

Comments
 (0)