@@ -461,6 +461,48 @@ def test_tk_bisque(self):
461461 self .assertEqual (root ['background' ], '#ffe4c4' )
462462 self .assertRaises (TypeError , root .tk_bisque , 'x' )
463463
464+ def test_wait_variable (self ):
465+ var = tkinter .StringVar (self .root )
466+ self .assertEqual (self .root .waitvar , self .root .wait_variable )
467+ self .root .after (1 , var .set , 'done' )
468+ self .root .wait_variable (var ) # Returns once the variable is set.
469+ self .assertEqual (var .get (), 'done' )
470+
471+ def test_wait_window (self ):
472+ top = tkinter .Toplevel (self .root )
473+ self .root .after (1 , top .destroy )
474+ self .root .wait_window (top ) # Returns once the window is destroyed.
475+ self .assertFalse (top .winfo_exists ())
476+
477+ def test_tk_focusFollowsMouse (self ):
478+ self .root .tk_focusFollowsMouse () # No exception.
479+
480+ def test_selection_handle (self ):
481+ f = tkinter .Frame (self .root )
482+ def handler (offset , length ):
483+ return 'PAYLOAD' [int (offset ):int (offset ) + int (length )]
484+ f .selection_handle (handler )
485+ f .selection_own ()
486+ self .assertEqual (f .selection_get (), 'PAYLOAD' )
487+
488+ def test_grab_set_global (self ):
489+ # A successful global grab directs all events on the display to this
490+ # application, so only the error paths are tested here.
491+ self .assertRaises (TypeError , self .root .grab_set_global , 'extra' )
492+ with self .subTest ('non-viewable window' ):
493+ if self .root ._windowingsystem != 'x11' :
494+ # Grabbing a non-viewable window fails only on X11; elsewhere
495+ # it would actually grab the whole display.
496+ self .skipTest ('only X11 fails the grab' )
497+ f = tkinter .Frame (self .root ) # not yet viewable
498+ self .assertRaisesRegex (TclError , 'grab failed' , f .grab_set_global )
499+
500+ def test_send (self ):
501+ if self .root ._windowingsystem != 'x11' :
502+ self .skipTest ('send is only supported on X11' )
503+ self .assertRaisesRegex (TclError , 'no application named' ,
504+ self .root .send , 'no_such_interp_xyzzy' , 'set x 1' )
505+
464506 def test_event_repr_defaults (self ):
465507 e = tkinter .Event ()
466508 e .serial = 12345
@@ -917,6 +959,35 @@ def test_wm_iconname(self):
917959 t .iconname ('Icon' )
918960 self .assertIn (t .iconname (), ('Icon' , '' ))
919961
962+ def test_wm_iconposition (self ):
963+ t = tkinter .Toplevel (self .root )
964+ t .wm_iconposition (3 , 4 ) # An X11 hint; may be a no-op elsewhere.
965+ if t ._windowingsystem == 'x11' :
966+ self .assertEqual (t .wm_iconposition (), (3 , 4 ))
967+
968+ def test_wm_iconmask_iconwindow (self ):
969+ if self .root ._windowingsystem != 'x11' :
970+ self .skipTest ('iconmask and iconwindow are X11-specific' )
971+ t = tkinter .Toplevel (self .root )
972+ t .wm_iconmask ('gray50' ) # No exception.
973+ icon = tkinter .Toplevel (self .root )
974+ t .wm_iconwindow (icon )
975+ self .assertEqual (str (t .wm_iconwindow ()), str (icon ))
976+
977+ def test_wm_colormapwindows (self ):
978+ if self .root ._windowingsystem != 'x11' :
979+ self .skipTest ('colormapwindows is X11-specific' )
980+ t = tkinter .Toplevel (self .root )
981+ self .assertEqual (t .wm_colormapwindows (), [])
982+ f = tkinter .Frame (t )
983+ t .wm_colormapwindows (f )
984+ self .assertEqual ([str (w ) for w in t .wm_colormapwindows ()], [str (f )])
985+
986+ def test_wm_manage_forget (self ):
987+ f = tkinter .Frame (self .root )
988+ self .root .wm_manage (f ) # Make the frame a top-level window.
989+ self .root .wm_forget (f ) # Revert it; no exception either way.
990+
920991 def test_wm_client_command (self ):
921992 t = tkinter .Toplevel (self .root )
922993 t .client ('myhost' )
0 commit comments