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

Function test_4479

tests/test_general.py:1906–1942  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1904
1905
1906def test_4479():
1907 # This passes with pymupdf-1.24.14, fails with pymupdf==1.25.*, passes with
1908 # pymupdf-1.26.0.
1909 print()
1910 path = os.path.normpath(f'{__file__}/../../tests/resources/test_4479.pdf')
1911 with pymupdf.open(path) as document:
1912
1913 def show(items):
1914 for item in items:
1915 print(f' {repr(item)}')
1916
1917 items = document.layer_ui_configs()
1918 show(items)
1919 assert items == [
1920 {'depth': 0, 'locked': 0, 'number': 0, 'on': 1, 'text': 'layer_0', 'type': 'checkbox'},
1921 {'depth': 0, 'locked': 0, 'number': 1, 'on': 1, 'text': 'layer_1', 'type': 'checkbox'},
1922 {'depth': 0, 'locked': 0, 'number': 2, 'on': 0, 'text': 'layer_2', 'type': 'checkbox'},
1923 {'depth': 0, 'locked': 0, 'number': 3, 'on': 1, 'text': 'layer_3', 'type': 'checkbox'},
1924 {'depth': 0, 'locked': 0, 'number': 4, 'on': 1, 'text': 'layer_4', 'type': 'checkbox'},
1925 {'depth': 0, 'locked': 0, 'number': 5, 'on': 1, 'text': 'layer_5', 'type': 'checkbox'},
1926 {'depth': 0, 'locked': 0, 'number': 6, 'on': 1, 'text': 'layer_6', 'type': 'checkbox'},
1927 {'depth': 0, 'locked': 0, 'number': 7, 'on': 1, 'text': 'layer_7', 'type': 'checkbox'},
1928 ]
1929
1930 document.set_layer_ui_config(0, pymupdf.PDF_OC_OFF)
1931 items = document.layer_ui_configs()
1932 show(items)
1933 assert items == [
1934 {'depth': 0, 'locked': 0, 'number': 0, 'on': 0, 'text': 'layer_0', 'type': 'checkbox'},
1935 {'depth': 0, 'locked': 0, 'number': 1, 'on': 1, 'text': 'layer_1', 'type': 'checkbox'},
1936 {'depth': 0, 'locked': 0, 'number': 2, 'on': 0, 'text': 'layer_2', 'type': 'checkbox'},
1937 {'depth': 0, 'locked': 0, 'number': 3, 'on': 1, 'text': 'layer_3', 'type': 'checkbox'},
1938 {'depth': 0, 'locked': 0, 'number': 4, 'on': 1, 'text': 'layer_4', 'type': 'checkbox'},
1939 {'depth': 0, 'locked': 0, 'number': 5, 'on': 1, 'text': 'layer_5', 'type': 'checkbox'},
1940 {'depth': 0, 'locked': 0, 'number': 6, 'on': 1, 'text': 'layer_6', 'type': 'checkbox'},
1941 {'depth': 0, 'locked': 0, 'number': 7, 'on': 1, 'text': 'layer_7', 'type': 'checkbox'},
1942 ]
1943
1944
1945def test_4533():

Callers

nothing calls this directly

Calls 3

layer_ui_configsMethod · 0.80
set_layer_ui_configMethod · 0.80
showFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…