()
| 45 | |
| 46 | |
| 47 | def test_checkbox(): |
| 48 | doc = pymupdf.open() |
| 49 | page = doc.new_page() |
| 50 | widget = pymupdf.Widget() |
| 51 | widget.border_style = "b" |
| 52 | widget.field_name = "Button-1" |
| 53 | widget.field_label = "a simple check box button" |
| 54 | widget.field_type = pymupdf.PDF_WIDGET_TYPE_CHECKBOX |
| 55 | widget.fill_color = gold |
| 56 | widget.rect = rect |
| 57 | widget.text_color = blue |
| 58 | widget.text_font = "ZaDb" |
| 59 | widget.field_value = True |
| 60 | page.add_widget(widget) # create the field |
| 61 | field = page.first_widget |
| 62 | assert field.field_type_string == "CheckBox" |
| 63 | |
| 64 | # Check #2350 - setting checkbox to readonly. |
| 65 | # |
| 66 | widget.field_flags |= pymupdf.PDF_FIELD_IS_READ_ONLY |
| 67 | widget.update() |
| 68 | path = f"{scriptdir}/test_checkbox.pdf" |
| 69 | doc.save(path) |
| 70 | |
| 71 | doc = pymupdf.open(path) |
| 72 | page = doc[0] |
| 73 | widget = page.first_widget |
| 74 | assert widget |
| 75 | assert widget.field_flags == pymupdf.PDF_FIELD_IS_READ_ONLY |
| 76 | |
| 77 | |
| 78 | def test_listbox(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…