@@ -446,6 +446,48 @@ def test_tk_bisque(self):
446446 self .assertEqual (root ['background' ], '#ffe4c4' )
447447 self .assertRaises (TypeError , root .tk_bisque , 'x' )
448448
449+ def test_wait_variable (self ):
450+ var = tkinter .StringVar (self .root )
451+ self .assertEqual (self .root .waitvar , self .root .wait_variable )
452+ self .root .after (1 , var .set , 'done' )
453+ self .root .wait_variable (var ) # Returns once the variable is set.
454+ self .assertEqual (var .get (), 'done' )
455+
456+ def test_wait_window (self ):
457+ top = tkinter .Toplevel (self .root )
458+ self .root .after (1 , top .destroy )
459+ self .root .wait_window (top ) # Returns once the window is destroyed.
460+ self .assertFalse (top .winfo_exists ())
461+
462+ def test_tk_focusFollowsMouse (self ):
463+ self .root .tk_focusFollowsMouse () # No exception.
464+
465+ def test_selection_handle (self ):
466+ f = tkinter .Frame (self .root )
467+ def handler (offset , length ):
468+ return 'PAYLOAD' [int (offset ):int (offset ) + int (length )]
469+ f .selection_handle (handler )
470+ f .selection_own ()
471+ self .assertEqual (f .selection_get (), 'PAYLOAD' )
472+
473+ def test_grab_set_global (self ):
474+ # A successful global grab directs all events on the display to this
475+ # application, so only the error paths are tested here.
476+ self .assertRaises (TypeError , self .root .grab_set_global , 'extra' )
477+ with self .subTest ('non-viewable window' ):
478+ if self .root ._windowingsystem != 'x11' :
479+ # Grabbing a non-viewable window fails only on X11; elsewhere
480+ # it would actually grab the whole display.
481+ self .skipTest ('only X11 fails the grab' )
482+ f = tkinter .Frame (self .root ) # not yet viewable
483+ self .assertRaisesRegex (TclError , 'grab failed' , f .grab_set_global )
484+
485+ def test_send (self ):
486+ if self .root ._windowingsystem != 'x11' :
487+ self .skipTest ('send is only supported on X11' )
488+ self .assertRaisesRegex (TclError , 'no application named' ,
489+ self .root .send , 'no_such_interp_xyzzy' , 'set x 1' )
490+
449491 def test_event_repr_defaults (self ):
450492 e = tkinter .Event ()
451493 e .serial = 12345
@@ -891,6 +933,35 @@ def test_wm_iconname(self):
891933 t .iconname ('Icon' )
892934 self .assertIn (t .iconname (), ('Icon' , '' ))
893935
936+ def test_wm_iconposition (self ):
937+ t = tkinter .Toplevel (self .root )
938+ t .wm_iconposition (3 , 4 ) # An X11 hint; may be a no-op elsewhere.
939+ if t ._windowingsystem == 'x11' :
940+ self .assertEqual (t .wm_iconposition (), (3 , 4 ))
941+
942+ def test_wm_iconmask_iconwindow (self ):
943+ if self .root ._windowingsystem != 'x11' :
944+ self .skipTest ('iconmask and iconwindow are X11-specific' )
945+ t = tkinter .Toplevel (self .root )
946+ t .wm_iconmask ('gray50' ) # No exception.
947+ icon = tkinter .Toplevel (self .root )
948+ t .wm_iconwindow (icon )
949+ self .assertEqual (str (t .wm_iconwindow ()), str (icon ))
950+
951+ def test_wm_colormapwindows (self ):
952+ if self .root ._windowingsystem != 'x11' :
953+ self .skipTest ('colormapwindows is X11-specific' )
954+ t = tkinter .Toplevel (self .root )
955+ self .assertEqual (t .wm_colormapwindows (), [])
956+ f = tkinter .Frame (t )
957+ t .wm_colormapwindows (f )
958+ self .assertEqual ([str (w ) for w in t .wm_colormapwindows ()], [str (f )])
959+
960+ def test_wm_manage_forget (self ):
961+ f = tkinter .Frame (self .root )
962+ self .root .wm_manage (f ) # Make the frame a top-level window.
963+ self .root .wm_forget (f ) # Revert it; no exception either way.
964+
894965 def test_wm_client_command (self ):
895966 t = tkinter .Toplevel (self .root )
896967 t .client ('myhost' )
0 commit comments