(ax, toolbar)
| 1068 | |
| 1069 | @pytest.mark.parametrize("toolbar", ["none", "toolbar2", "toolmanager"]) |
| 1070 | def test_TextBox(ax, toolbar): |
| 1071 | # Avoid "toolmanager is provisional" warning. |
| 1072 | plt.rcParams._set("toolbar", toolbar) |
| 1073 | |
| 1074 | submit_event = mock.Mock(spec=noop, return_value=None) |
| 1075 | text_change_event = mock.Mock(spec=noop, return_value=None) |
| 1076 | tool = widgets.TextBox(ax, '') |
| 1077 | tool.on_submit(submit_event) |
| 1078 | tool.on_text_change(text_change_event) |
| 1079 | |
| 1080 | assert tool.text == '' |
| 1081 | |
| 1082 | MouseEvent._from_ax_coords("button_press_event", ax, (.5, .5), 1)._process() |
| 1083 | |
| 1084 | tool.set_val('x**2') |
| 1085 | |
| 1086 | assert tool.text == 'x**2' |
| 1087 | assert text_change_event.call_count == 1 |
| 1088 | |
| 1089 | tool.begin_typing() |
| 1090 | tool.stop_typing() |
| 1091 | |
| 1092 | assert submit_event.call_count == 2 |
| 1093 | |
| 1094 | MouseEvent._from_ax_coords("button_press_event", ax, (.5, .5), 1)._process() |
| 1095 | KeyEvent("key_press_event", ax.figure.canvas, "+")._process() |
| 1096 | KeyEvent("key_press_event", ax.figure.canvas, "5")._process() |
| 1097 | |
| 1098 | assert text_change_event.call_count == 3 |
| 1099 | |
| 1100 | |
| 1101 | def test_RadioButtons(ax): |
nothing calls this directly
no test coverage detected
searching dependent graphs…