@@ -463,6 +463,43 @@ 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+ f = tkinter .Frame (self .root ) # not yet viewable
494+ self .assertRaisesRegex (TclError , 'grab failed' , f .grab_set_global )
495+ self .assertRaises (TypeError , self .root .grab_set_global , 'extra' )
496+
497+ def test_send (self ):
498+ if self .root ._windowingsystem != 'x11' :
499+ self .skipTest ('send is only supported on X11' )
500+ self .assertRaisesRegex (TclError , 'no application named' ,
501+ self .root .send , 'no_such_interp_xyzzy' , 'set x 1' )
502+
466503 def test_event_repr_defaults (self ):
467504 e = tkinter .Event ()
468505 e .serial = 12345
@@ -934,6 +971,35 @@ def test_wm_iconname(self):
934971 t .iconname ('Icon' )
935972 self .assertIn (t .iconname (), ('Icon' , '' ))
936973
974+ def test_wm_iconposition (self ):
975+ t = tkinter .Toplevel (self .root )
976+ t .wm_iconposition (3 , 4 ) # An X11 hint; may be a no-op elsewhere.
977+ if t ._windowingsystem == 'x11' :
978+ self .assertEqual (t .wm_iconposition (), (3 , 4 ))
979+
980+ def test_wm_iconmask_iconwindow (self ):
981+ if self .root ._windowingsystem != 'x11' :
982+ self .skipTest ('iconmask and iconwindow are X11-specific' )
983+ t = tkinter .Toplevel (self .root )
984+ t .wm_iconmask ('gray50' ) # No exception.
985+ icon = tkinter .Toplevel (self .root )
986+ t .wm_iconwindow (icon )
987+ self .assertEqual (str (t .wm_iconwindow ()), str (icon ))
988+
989+ def test_wm_colormapwindows (self ):
990+ if self .root ._windowingsystem != 'x11' :
991+ self .skipTest ('colormapwindows is X11-specific' )
992+ t = tkinter .Toplevel (self .root )
993+ self .assertEqual (t .wm_colormapwindows (), [])
994+ f = tkinter .Frame (t )
995+ t .wm_colormapwindows (f )
996+ self .assertEqual ([str (w ) for w in t .wm_colormapwindows ()], [str (f )])
997+
998+ def test_wm_manage_forget (self ):
999+ f = tkinter .Frame (self .root )
1000+ self .root .wm_manage (f ) # Make the frame a top-level window.
1001+ self .root .wm_forget (f ) # Revert it; no exception either way.
1002+
9371003 def test_wm_client_command (self ):
9381004 t = tkinter .Toplevel (self .root )
9391005 t .client ('myhost' )
0 commit comments