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