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

Function test_combobox

tests/test_widgets.py:107–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105
106
107def test_combobox():
108 doc = pymupdf.open()
109 page = doc.new_page()
110 widget = pymupdf.Widget()
111 widget.field_name = "ComboBox-1"
112 widget.field_label = "an editable combo box ..."
113 widget.field_type = pymupdf.PDF_WIDGET_TYPE_COMBOBOX
114 widget.field_flags = (
115 pymupdf.PDF_CH_FIELD_IS_COMMIT_ON_SEL_CHANGE | pymupdf.PDF_CH_FIELD_IS_EDIT
116 )
117 widget.fill_color = gold
118 widget.choice_values = (
119 "Spanien",
120 "Frankreich",
121 "Holland",
122 "Dänemark",
123 "Schweden",
124 "Norwegen",
125 "England",
126 "Polen",
127 "Russland",
128 "Italien",
129 "Portugal",
130 "Griechenland",
131 )
132 widget.rect = rect
133 widget.text_color = blue
134 widget.text_fontsize = fontsize
135 widget.field_value = widget.choice_values[-1]
136 page.add_widget(widget) # create the field
137 field = page.first_widget
138 assert field.field_type_string == "ComboBox"
139
140
141def test_text2():

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…