diff options
Diffstat (limited to 'tests/focus.test')
| -rw-r--r-- | tests/focus.test | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/tests/focus.test b/tests/focus.test index 03563bc..e1cfe58 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -19,8 +19,8 @@ proc focusSetup {} { toplevel .t wm geom .t +0+0 foreach i {b1 b2 b3 b4} { - button .t.$i -text .t.$i -relief raised -bd 2 - pack .t.$i + button .t.$i -text .t.$i -relief raised -bd 2 + pack .t.$i } tkwait visibility .t.b4 } @@ -43,10 +43,8 @@ proc focusSetupAlt {} { # the X server and possibly also the window manager. proc focusClear {} { - global x; - after 200 {set x 1} - tkwait variable x - dobg {focus -force .; update} + dobg {after 200; focus -force .; update} + after 400 update } @@ -82,7 +80,7 @@ test focus-1.1 {Tk_FocusCmd procedure} -constraints unix -body { focus } -result {} test focus-1.2 {Tk_FocusCmd procedure} -constraints { - unix altDisplay + unix altDisplay } -body { focus .alt.b focus @@ -108,7 +106,7 @@ test focus-1.7 {Tk_FocusCmd procedure} -constraints unix -body { focus .gorp a } -returnCodes error -result {bad option ".gorp": must be -displayof, -force, or -lastfor} test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} -constraints { - unix + unix } -setup { destroy .t2 } -body { @@ -134,36 +132,36 @@ test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} -constraints { destroy .t2 } -result {.t2.f2 .t2 .t2} test focus-1.9 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focus -displayof } -returnCodes error -result {wrong # args: should be "focus -displayof window"} test focus-1.10 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focus -displayof a b } -returnCodes error -result {wrong # args: should be "focus -displayof window"} test focus-1.11 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focus -displayof .lousy } -returnCodes error -result {bad window path name ".lousy"} test focus-1.12 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focusClear focus .t focus -displayof .t.b3 } -result {} test focus-1.13 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix + unix } -body { focusClear focus -force .t focus -displayof .t.b3 } -result {.t} test focus-1.14 {Tk_FocusCmd procedure, -displayof option} -constraints { - unix altDisplay + unix altDisplay } -body { focusClear focus -force .alt.c @@ -227,7 +225,7 @@ test focus-1.25 {Tk_FocusCmd procedure} -constraints unix -body { focusSetup test focus-2.1 {TkFocusFilterEvent procedure} -constraints { - unix nonPortable testwrapper + unix nonPortable testwrapper } -body { focusClear focus -force .b @@ -239,7 +237,7 @@ test focus-2.1 {TkFocusFilterEvent procedure} -constraints { return $focusInfo } -result {} test focus-2.2 {TkFocusFilterEvent procedure} -constraints { - unix nonPortable testwrapper + unix nonPortable testwrapper } -body { focusClear focus -force .b @@ -251,7 +249,7 @@ test focus-2.2 {TkFocusFilterEvent procedure} -constraints { } -result {{in .t NotifyAncestor } .b} test focus-2.3 {TkFocusFilterEvent procedure} -constraints { - unix nonPortable testwrapper + unix nonPortable testwrapper } -body { focusClear focus -force .b @@ -330,10 +328,10 @@ test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} -constraints { foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear NotifyNonlinearVirtual NotifyPointer NotifyPointerRoot NotifyVirtual} { - focus -force .t.b1 - event gen [testwrapper .t] <FocusOut> -detail $detail - update - lappend result [focus] + focus -force .t.b1 + event gen [testwrapper .t] <FocusOut> -detail $detail + update + lappend result [focus] } return $result } -result {{} .t.b1 {} {} .t.b1 .t.b1 {}} @@ -358,12 +356,12 @@ test focus-2.10 {TkFocusFilterEvent procedure, Enter events} -constraints { focus .t.b1 focusClear foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear - NotifyNonlinearVirtual NotifyVirtual} { - event gen [testwrapper .t] <Enter> -detail $detail -focus 1 - update - lappend result [focus] - event gen [testwrapper .t] <Leave> -detail NotifyAncestor - update + NotifyNonlinearVirtual NotifyVirtual} { + event gen [testwrapper .t] <Enter> -detail $detail -focus 1 + update + lappend result [focus] + event gen [testwrapper .t] <Leave> -detail NotifyAncestor + update } return $result } -result {.t.b1 {} .t.b1 .t.b1 .t.b1} @@ -399,7 +397,7 @@ test focus-2.13 {TkFocusFilterEvent procedure, Enter events} -constraints { in .t.b1 NotifyAncestor } test focus-2.14 {TkFocusFilterEvent procedure, Enter events, ignore errors when setting focus due to implicit focus} -constraints { - unix testwrapper + unix testwrapper } -setup { destroy .t2 set focusInfo {} @@ -420,12 +418,12 @@ test focus-2.15 {TkFocusFilterEvent procedure, Leave events} -constraints { focus .t.b1 foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear NotifyNonlinearVirtual NotifyVirtual} { - focusClear - event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1 - update - event gen [testwrapper .t] <Leave> -detail $detail - update - lappend result [focus] + focusClear + event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1 + update + event gen [testwrapper .t] <Leave> -detail $detail + update + lappend result [focus] } return $result } -result {{} .t.b1 {} {} {}} @@ -476,7 +474,7 @@ test focus-3.1 {SetFocus procedure, create record on focus} -constraints { # error if Tk forgets to make the window exist before focussing # on it. test focus-3.2 {SetFocus procedure, making window exist} -constraints { - unix testwrapper + unix testwrapper } -body { update button .b2 -text "Another button" @@ -512,7 +510,7 @@ test focus-3.4 {SetFocus procedure, delaying claim of X focus} -constraints { destroy .t2 } -result {} test focus-3.5 {SetFocus procedure, generating events} -constraints { - unix testwrapper + unix testwrapper } -body { focusSetup focusClear @@ -524,7 +522,7 @@ test focus-3.5 {SetFocus procedure, generating events} -constraints { in .t.b2 NotifyAncestor } test focus-3.6 {SetFocus procedure, generating events} -constraints { - unix testwrapper + unix testwrapper } -body { focusSetup focus -force .b @@ -552,7 +550,7 @@ unix nonPortable testwrapper test focus-4.1 {TkFocusDeadWindow procedure} -constraints { - unix testwrapper + unix testwrapper } -body { focusSetup update @@ -562,7 +560,7 @@ test focus-4.1 {TkFocusDeadWindow procedure} -constraints { focus } -result {.b} test focus-4.2 {TkFocusDeadWindow procedure} -constraints { - unix testwrapper + unix testwrapper } -body { focusSetup update @@ -576,7 +574,7 @@ test focus-4.2 {TkFocusDeadWindow procedure} -constraints { # Non-portable due to wm-specific redirection of input focus when # windows are deleted: test focus-4.3 {TkFocusDeadWindow procedure} -constraints { - unix nonPortable testwrapper + unix nonPortable testwrapper } -body { focusSetup update @@ -587,7 +585,7 @@ test focus-4.3 {TkFocusDeadWindow procedure} -constraints { focus } -result {} test focus-4.4 {TkFocusDeadWindow procedure} -constraints { - unix testwrapper + unix testwrapper } -body { focusSetup focus -force .t.b2 @@ -643,11 +641,11 @@ test focus-6.1 {miscellaneous - embedded application in same process} -constrain child eval "set argv {-use [winfo id .t.f1]}" load {} Tk child child eval { - entry .e1 -bg lightBlue - pack .e1 - bind all <FocusIn> {lappend x "focus in %W %d"} - bind all <FocusOut> {lappend x "focus out %W %d"} - set x {} + entry .e1 -bg lightBlue + pack .e1 + bind all <FocusIn> {lappend x "focus in %W %d"} + bind all <FocusOut> {lappend x "focus out %W %d"} + set x {} } # Claim the focus and wait long enough for it to really arrive. @@ -696,11 +694,11 @@ test focus-6.2 {miscellaneous - embedded application in different process} -cons bind all <FocusOut> {lappend x "focus out %W %d"} setupbg -use [winfo id .t.f1] dobg { - entry .e1 -bg lightBlue - pack .e1 - bind all <FocusIn> {lappend x "focus in %W %d"} - bind all <FocusOut> {lappend x "focus out %W %d"} - set x {} + entry .e1 -bg lightBlue + pack .e1 + bind all <FocusIn> {lappend x "focus in %W %d"} + bind all <FocusOut> {lappend x "focus out %W %d"} + set x {} } # Claim the focus and wait long enough for it to really arrive. |
