diff options
Diffstat (limited to 'tests/focus.test')
| -rw-r--r-- | tests/focus.test | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/tests/focus.test b/tests/focus.test index add0f37..4c7d3bb 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -10,14 +10,14 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test + +# Import utility procs for specific functional areas +testutils import child + if {[tk windowingsystem] eq "aqua"} { - interp create childInterp - load {} Tk childInterp + childTkInterp childInterp } -testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] -testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] - proc focusSetup {} { destroy .t toplevel .t @@ -62,7 +62,7 @@ if {[tk windowingsystem] eq "aqua"} { } } else { proc focusClear {} { - dobg {after 200; focus -force .; update} + childTkProcess eval {after 200; focus -force .; update} after 400 update } @@ -76,8 +76,8 @@ pack .b # Make sure the window manager knows who has focus catch {fixfocus} -# cleanupbg will be after 4.3 test -setupbg +# childTkProcess exit will be after 4.3 test +childTkProcess create update bind all <FocusIn> { append focusInfo "in %W %d\n" @@ -169,7 +169,7 @@ test focus-1.11 {Tk_FocusCmd procedure, -displayof option} -constraints { test focus-1.12 {Tk_FocusCmd procedure, -displayof option} -constraints { unix } -body { - # Move focus to the root window in the child or bg interpreter. + # Move focus to the root window in the child process/interpreter. focusClear # The main application does not have focus, so this has no effect now. focus .t @@ -332,7 +332,7 @@ in .t.b1 NotifyNonlinear } .t.b1} test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints { - unix testwrapper failsOnUbuntu failsOnXQuarz + unix testwrapper failsOnUbuntu failsOnXQuartz } -body { focus .t.b1 focus . @@ -344,7 +344,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints { list $x $focusInfo } -result {.t.b1 {press .t.b1 x}} test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} -constraints { - unix testwrapper failsOnUbuntu failsOnXQuarz + unix testwrapper failsOnUbuntu failsOnXQuartz } -body { set result {} foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear @@ -365,7 +365,7 @@ test focus-2.8 {TkFocusFilterEvent procedure, FocusOut events} -constraints { focus } -result {.t.b1} test focus-2.9 {TkFocusFilterEvent procedure, FocusOut events} -constraints { - unix testwrapper failsOnUbuntu failsOnXQuarz + unix testwrapper failsOnUbuntu failsOnXQuartz } -body { focus .t.b1 event gen [testwrapper .] <FocusOut> -detail NotifyAncestor @@ -615,7 +615,7 @@ test focus-4.4 {TkFocusDeadWindow procedure} -constraints { destroy .t.b2 focus } -result {.t} -cleanupbg +childTkProcess exit # I don't know how to test most of the remaining procedures of this file @@ -623,20 +623,20 @@ cleanupbg # Test 5.1 fails (before and after update) test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} -constraints { - unix testwrapper secureserver failsOnUbuntu failsOnXQuarz + unix testwrapper secureserver failsOnUbuntu failsOnXQuartz } -body { - setupbg + childTkProcess create focusSetup focus -force .t update set result [focus] - send [dobg {tk appname}] {focus -force .; update} + send [childTkProcess eval {tk appname}] {focus -force .; update} lappend result [focus] focus .t.b2 update lappend result [focus] } -cleanup { - cleanupbg + childTkProcess exit } -result {.t {} {}} destroy .t bind all <FocusIn> {} @@ -704,7 +704,7 @@ test focus-6.1 {miscellaneous - embedded application in same process} -constrain test focus-6.2 {miscellaneous - embedded application in different process} -constraints { unix testwrapper } -body { - setupbg + childTkProcess create toplevel .t wm geometry .t +0+0 frame .t.f1 -container 1 @@ -714,8 +714,8 @@ test focus-6.2 {miscellaneous - embedded application in different process} -cons pack .t.f2.e1 bind all <FocusIn> {lappend x "focus in %W %d"} bind all <FocusOut> {lappend x "focus out %W %d"} - setupbg -use [winfo id .t.f1] - dobg { + childTkProcess create -use [winfo id .t.f1] + childTkProcess eval { entry .e1 -bg lightBlue pack .e1 bind all <FocusIn> {lappend x "focus in %W %d"} @@ -729,27 +729,27 @@ test focus-6.2 {miscellaneous - embedded application in different process} -cons after 300 {set timer 1} vwait timer set x {} - lappend x [focus] [dobg focus] + lappend x [focus] [childTkProcess eval focus] # See if a "focus" command will move the focus to the embedded # application. - dobg {focus .e1} + childTkProcess eval {focus .e1} after 300 {set timer 1} vwait timer lappend x | - dobg {lappend x |} + childTkProcess eval {lappend x |} # Bring the focus back to the main application. focus .t.f2.e1 after 300 {set timer 1} vwait timer - set result [list $x [dobg {set x}]] + set result [list $x [childTkProcess eval {set x}]] return $result } -cleanup { destroy .t - cleanupbg + childTkProcess exit bind all <FocusIn> {} bind all <FocusOut> {} } -result {{.t.f2.e1 {} {focus out .t.f2.e1 NotifyNonlinear} {focus out .t.f2 NotifyNonlinearVirtual} {focus in .t.f1 NotifyNonlinear} | {focus out .t.f1 NotifyNonlinear} {focus in .t.f2 NotifyNonlinearVirtual} {focus in .t.f2.e1 NotifyNonlinear}} {{focus in . NotifyVirtual} {focus in .e1 NotifyAncestor} | {focus out .e1 NotifyAncestor} {focus out . NotifyVirtual}}} @@ -799,9 +799,12 @@ test focus-8.1 {fdc0ed342d - segfault on focus -force} -body { crashit } -result {Reached} -deleteWindows +# +# CLEANUP +# -# cleanup +deleteWindows +testutils forget child cleanupTests if {[tk windowingsystem] eq "aqua"} { interp delete childInterp |
