Skip to content

Commit 4022707

Browse files
committed
Add initial TextBox widget testing
1 parent 833658b commit 4022707

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,27 @@ def test_CheckButtons():
254254
check.disconnect(cid)
255255

256256

257+
def check_TextBox():
258+
def submit(text):
259+
tool.set_val('x**1')
260+
261+
def change(text):
262+
tool.color = '1.0'
263+
ax = get_ax()
264+
tool = widgets.TextBox(ax, 'Evaluate', color='.95', initial='x**2')
265+
assert tool.text == 'x**2'
266+
tool.on_submit(submit)
267+
tool.on_text_change(change)
268+
tool.begin_typing(tool.text)
269+
tool.stop_typing()
270+
assert tool.text == 'x**1'
271+
assert tool.color == '1.0'
272+
273+
274+
def test_TextBox():
275+
check_TextBox()
276+
277+
257278
@image_comparison(['check_radio_buttons.png'], style='mpl20', remove_text=True)
258279
def test_check_radio_buttons_image():
259280
# Remove this line when this test image is regenerated.

0 commit comments

Comments
 (0)