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

Function test_listbox

tests/test_widgets.py:78–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77
78def test_listbox():
79 doc = pymupdf.open()
80 page = doc.new_page()
81 widget = pymupdf.Widget()
82 widget.field_name = "ListBox-1"
83 widget.field_label = "is not a drop down: scroll with cursor in field"
84 widget.field_type = pymupdf.PDF_WIDGET_TYPE_LISTBOX
85 widget.field_flags = pymupdf.PDF_CH_FIELD_IS_COMMIT_ON_SEL_CHANGE
86 widget.fill_color = gold
87 widget.choice_values = (
88 "Frankfurt",
89 "Hamburg",
90 "Stuttgart",
91 "Hannover",
92 "Berlin",
93 "München",
94 "Köln",
95 "Potsdam",
96 )
97 widget.rect = rect
98 widget.text_color = blue
99 widget.text_fontsize = fontsize
100 widget.field_value = widget.choice_values[-1]
101 print("About to add '%s'" % widget.field_name)
102 page.add_widget(widget) # create the field
103 field = page.first_widget
104 assert field.field_type_string == "ListBox"
105
106
107def test_combobox():

Callers

nothing calls this directly

Calls 2

new_pageMethod · 0.80
add_widgetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…