@@ -463,6 +463,48 @@ def test_tk_bisque(self):
463463 self .assertEqual (root ['background' ], '#ffe4c4' )
464464 self .assertRaises (TypeError , root .tk_bisque , 'x' )
465465
466+ def test_wait_variable (self ):
467+ var = tkinter .StringVar (self .root )
468+ self .assertEqual (self .root .waitvar , self .root .wait_variable )
469+ self .root .after (1 , var .set , 'done' )
470+ self .root .wait_variable (var ) # Returns once the variable is set.
471+ self .assertEqual (var .get (), 'done' )
472+
473+ def test_wait_window (self ):
474+ top = tkinter .Toplevel (self .root )
475+ self .root .after (1 , top .destroy )
476+ self .root .wait_window (top ) # Returns once the window is destroyed.
477+ self .assertFalse (top .winfo_exists ())
478+
479+ def test_tk_focusFollowsMouse (self ):
480+ self .root .tk_focusFollowsMouse () # No exception.
481+
482+ def test_selection_handle (self ):
483+ f = tkinter .Frame (self .root )
484+ def handler (offset , length ):
485+ return 'PAYLOAD' [int (offset ):int (offset ) + int (length )]
486+ f .selection_handle (handler )
487+ f .selection_own ()
488+ self .assertEqual (f .selection_get (), 'PAYLOAD' )
489+
490+ def test_grab_set_global (self ):
491+ # A successful global grab directs all events on the display to this
492+ # application, so only the error paths are tested here.
493+ self .assertRaises (TypeError , self .root .grab_set_global , 'extra' )
494+ with self .subTest ('non-viewable window' ):
495+ if self .root ._windowingsystem != 'x11' :
496+ # Grabbing a non-viewable window fails only on X11; elsewhere
497+ # it would actually grab the whole display.
498+ self .skipTest ('only X11 fails the grab' )
499+ f = tkinter .Frame (self .root ) # not yet viewable
500+ self .assertRaisesRegex (TclError , 'grab failed' , f .grab_set_global )
501+
502+ def test_send (self ):
503+ if self .root ._windowingsystem != 'x11' :
504+ self .skipTest ('send is only supported on X11' )
505+ self .assertRaisesRegex (TclError , 'no application named' ,
506+ self .root .send , 'no_such_interp_xyzzy' , 'set x 1' )
507+
466508 def test_event_repr_defaults (self ):
467509 e = tkinter .Event ()
468510 e .serial = 12345
@@ -934,6 +976,35 @@ def test_wm_iconname(self):
934976 t .iconname ('Icon' )
935977 self .assertIn (t .iconname (), ('Icon' , '' ))
936978
979+ def test_wm_iconposition (self ):
980+ t = tkinter .Toplevel (self .root )
981+ t .wm_iconposition (3 , 4 ) # An X11 hint; may be a no-op elsewhere.
982+ if t ._windowingsystem == 'x11' :
983+ self .assertEqual (t .wm_iconposition (), (3 , 4 ))
984+
985+ def test_wm_iconmask_iconwindow (self ):
986+ if self .root ._windowingsystem != 'x11' :
987+ self .skipTest ('iconmask and iconwindow are X11-specific' )
988+ t = tkinter .Toplevel (self .root )
989+ t .wm_iconmask ('gray50' ) # No exception.
990+ icon = tkinter .Toplevel (self .root )
991+ t .wm_iconwindow (icon )
992+ self .assertEqual (str (t .wm_iconwindow ()), str (icon ))
993+
994+ def test_wm_colormapwindows (self ):
995+ if self .root ._windowingsystem != 'x11' :
996+ self .skipTest ('colormapwindows is X11-specific' )
997+ t = tkinter .Toplevel (self .root )
998+ self .assertEqual (t .wm_colormapwindows (), [])
999+ f = tkinter .Frame (t )
1000+ t .wm_colormapwindows (f )
1001+ self .assertEqual ([str (w ) for w in t .wm_colormapwindows ()], [str (f )])
1002+
1003+ def test_wm_manage_forget (self ):
1004+ f = tkinter .Frame (self .root )
1005+ self .root .wm_manage (f ) # Make the frame a top-level window.
1006+ self .root .wm_forget (f ) # Revert it; no exception either way.
1007+
9371008 def test_wm_client_command (self ):
9381009 t = tkinter .Toplevel (self .root )
9391010 t .client ('myhost' )
0 commit comments