File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,31 @@ def test_CheckButtons():
254254 check .disconnect (cid )
255255
256256
257+ def test_TextBox ():
258+ from unittest .mock import Mock
259+ submit_event = Mock ()
260+ text_change_event = Mock ()
261+ ax = get_ax ()
262+
263+ tool = widgets .TextBox (ax , 'Evaluate' )
264+ tool .on_submit (submit_event )
265+ tool .on_text_change (text_change_event )
266+ tool .set_val ('x**2' )
267+
268+ assert tool .text == 'x**2'
269+ assert text_change_event .call_count == 1
270+
271+ tool .begin_typing (tool .text )
272+ tool .stop_typing ()
273+
274+ assert submit_event .call_count == 2
275+ do_event (tool , '_click' )
276+ do_event (tool , '_keypress' , key = '+' )
277+ do_event (tool , '_keypress' , key = '5' )
278+
279+ assert text_change_event .call_count == 3
280+
281+
257282@image_comparison (['check_radio_buttons.png' ], style = 'mpl20' , remove_text = True )
258283def test_check_radio_buttons_image ():
259284 # Remove this line when this test image is regenerated.
You can’t perform that action at this time.
0 commit comments