summaryrefslogtreecommitdiffstats
path: root/tests/focus.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/focus.test')
-rw-r--r--tests/focus.test135
1 files changed, 58 insertions, 77 deletions
diff --git a/tests/focus.test b/tests/focus.test
index 474f49a..5cc3abe 100644
--- a/tests/focus.test
+++ b/tests/focus.test
@@ -7,10 +7,7 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
button .b -text .b -relief raised -bd 2
@@ -71,35 +68,35 @@ bind all <KeyPress> {
append focusInfo "press %W %K"
}
-test focus-1.1 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.1 {Tk_FocusCmd procedure} unix {
focusClear
focus
} {}
-test focus-1.2 {Tk_FocusCmd procedure} {unixOnly altDisplay} {
+test focus-1.2 {Tk_FocusCmd procedure} {unix altDisplay} {
focus .alt.b
focus
} {}
-test focus-1.3 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.3 {Tk_FocusCmd procedure} unix {
focusClear
focus .t.b3
focus
} {}
-test focus-1.4 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.4 {Tk_FocusCmd procedure} unix {
list [catch {focus ""} msg] $msg
} {0 {}}
-test focus-1.5 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.5 {Tk_FocusCmd procedure} unix {
focusClear
focus -force .t
focus .t.b3
focus
} {.t.b3}
-test focus-1.6 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.6 {Tk_FocusCmd procedure} unix {
list [catch {focus .gorp} msg] $msg
} {1 {bad window path name ".gorp"}}
-test focus-1.7 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.7 {Tk_FocusCmd procedure} unix {
list [catch {focus .gorp a} msg] $msg
} {1 {bad option ".gorp": must be -displayof, -force, or -lastfor}}
-test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} {unixOnly} {
+test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} unix {
toplevel .t2
wm geom .t2 +10+10
frame .t2.f -width 200 -height 100 -bd 2 -relief raised
@@ -118,73 +115,73 @@ test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} {unixOnly} {
destroy .t2
set x
} {.t2.f2 .t2 .t2}
-test focus-1.9 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.9 {Tk_FocusCmd procedure, -displayof option} unix {
list [catch {focus -displayof} msg] $msg
} {1 {wrong # args: should be "focus -displayof window"}}
-test focus-1.10 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.10 {Tk_FocusCmd procedure, -displayof option} unix {
list [catch {focus -displayof a b} msg] $msg
} {1 {wrong # args: should be "focus -displayof window"}}
-test focus-1.11 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.11 {Tk_FocusCmd procedure, -displayof option} unix {
list [catch {focus -displayof .lousy} msg] $msg
} {1 {bad window path name ".lousy"}}
-test focus-1.12 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.12 {Tk_FocusCmd procedure, -displayof option} unix {
focusClear
focus .t
focus -displayof .t.b3
} {}
-test focus-1.13 {Tk_FocusCmd procedure, -displayof option} {unixOnly} {
+test focus-1.13 {Tk_FocusCmd procedure, -displayof option} unix {
focusClear
focus -force .t
focus -displayof .t.b3
} {.t}
-test focus-1.14 {Tk_FocusCmd procedure, -displayof option} {unixOnly altDisplay} {
+test focus-1.14 {Tk_FocusCmd procedure, -displayof option} {unix altDisplay} {
focus -force .alt.c
focus -displayof .alt
} {.alt.c}
-test focus-1.15 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.15 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force} msg] $msg
} {1 {wrong # args: should be "focus -force window"}}
-test focus-1.16 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.16 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force a b} msg] $msg
} {1 {wrong # args: should be "focus -force window"}}
-test focus-1.17 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.17 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force foo} msg] $msg
} {1 {bad window path name "foo"}}
-test focus-1.18 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.18 {Tk_FocusCmd procedure, -force option} unix {
list [catch {focus -force ""} msg] $msg
} {0 {}}
-test focus-1.19 {Tk_FocusCmd procedure, -force option} {unixOnly} {
+test focus-1.19 {Tk_FocusCmd procedure, -force option} unix {
focusClear
focus .t.b1
set x [list [focus]]
focus -force .t.b1
lappend x [focus]
} {{} .t.b1}
-test focus-1.20 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.20 {Tk_FocusCmd procedure, -lastfor option} unix {
list [catch {focus -lastfor} msg] $msg
} {1 {wrong # args: should be "focus -lastfor window"}}
-test focus-1.21 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.21 {Tk_FocusCmd procedure, -lastfor option} unix {
list [catch {focus -lastfor 1 2} msg] $msg
} {1 {wrong # args: should be "focus -lastfor window"}}
-test focus-1.22 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.22 {Tk_FocusCmd procedure, -lastfor option} unix {
list [catch {focus -lastfor who_knows?} msg] $msg
} {1 {bad window path name "who_knows?"}}
-test focus-1.23 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.23 {Tk_FocusCmd procedure, -lastfor option} unix {
focus .b
focus .t.b1
list [focus -lastfor .] [focus -lastfor .t.b3]
} {.b .t.b1}
-test focus-1.24 {Tk_FocusCmd procedure, -lastfor option} {unixOnly} {
+test focus-1.24 {Tk_FocusCmd procedure, -lastfor option} unix {
destroy .t
focusSetup
update
focus -lastfor .t.b2
} {.t}
-test focus-1.25 {Tk_FocusCmd procedure} {unixOnly} {
+test focus-1.25 {Tk_FocusCmd procedure} unix {
list [catch {focus -unknown} msg] $msg
} {1 {bad option "-unknown": must be -displayof, -force, or -lastfor}}
-test focus-2.1 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper} {
+test focus-2.1 {TkFocusFilterEvent procedure} {unix nonPortable testwrapper} {
focus -force .b
destroy .t
focusSetup
@@ -194,7 +191,7 @@ test focus-2.1 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper}
-sendevent 0x54217567
list $focusInfo
} {{}}
-test focus-2.2 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper} {
+test focus-2.2 {TkFocusFilterEvent procedure} {unix nonPortable testwrapper} {
focus -force .b
destroy .t
focusSetup
@@ -204,7 +201,7 @@ test focus-2.2 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper}
list $focusInfo [focus]
} {{in .t NotifyAncestor
} .b}
-test focus-2.3 {TkFocusFilterEvent procedure} {unixOnly nonPortable testwrapper} {
+test focus-2.3 {TkFocusFilterEvent procedure} {unix nonPortable testwrapper} {
focus -force .b
destroy .t
focusSetup
@@ -218,7 +215,7 @@ out . NotifyNonlinearVirtual
in .t NotifyNonlinear
} .t}
test focus-2.4 {TkFocusFilterEvent procedure, FocusIn events} \
- {unixOnly nonPortable testwrapper} {
+ {unix nonPortable testwrapper} {
set result {}
focus .t.b1
# Important to end with NotifyAncestor, which is an
@@ -249,7 +246,7 @@ in .t NotifyNonlinearVirtual
in .t.b1 NotifyNonlinear
}}
test focus-2.5 {TkFocusFilterEvent procedure, creating FocusInfo struct} \
- {unixOnly nonPortable testwrapper} {
+ {unix nonPortable testwrapper} {
focusSetup
focus .t.b1
update
@@ -260,7 +257,7 @@ in .t NotifyNonlinearVirtual
in .t.b1 NotifyNonlinear
} .t.b1}
test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus .t.b1
focus .
update
@@ -271,7 +268,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} \
list $x $focusInfo
} {.t.b1 {press .t.b1 x}}
test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear
NotifyNonlinearVirtual NotifyPointer NotifyPointerRoot
@@ -284,19 +281,19 @@ test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} \
set result
} {{} .t.b1 {} {} .t.b1 .t.b1 {}}
test focus-2.8 {TkFocusFilterEvent procedure, FocusOut events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus -force .t.b1
event gen .t.b1 <FocusOut> -detail NotifyAncestor
focus
} {.t.b1}
test focus-2.9 {TkFocusFilterEvent procedure, FocusOut events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus .t.b1
event gen [testwrapper .] <FocusOut> -detail NotifyAncestor
focus
} {}
test focus-2.10 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
focusClear
@@ -311,7 +308,7 @@ test focus-2.10 {TkFocusFilterEvent procedure, Enter events} \
set result
} {.t.b1 {} .t.b1 .t.b1 .t.b1}
test focus-2.11 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focusClear
set focusInfo {}
event gen [testwrapper .t] <Enter> -detail NotifyAncestor
@@ -319,7 +316,7 @@ test focus-2.11 {TkFocusFilterEvent procedure, Enter events} \
set focusInfo
} {}
test focus-2.12 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus -force .b
update
set focusInfo {}
@@ -328,7 +325,7 @@ test focus-2.12 {TkFocusFilterEvent procedure, Enter events} \
set focusInfo
} {}
test focus-2.13 {TkFocusFilterEvent procedure, Enter events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focus .t.b1
focusClear
event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1
@@ -338,7 +335,7 @@ test focus-2.13 {TkFocusFilterEvent procedure, Enter events} \
} {in .t NotifyVirtual
in .t.b1 NotifyAncestor
}
-test focus-2.14 {TkFocusFilterEvent procedure, Enter events, ignore errors when setting focus due to implicit focus} {unixOnly testwrapper} {
+test focus-2.14 {TkFocusFilterEvent procedure, Enter events, ignore errors when setting focus due to implicit focus} {unix testwrapper} {
focusClear
catch {destroy .t2}
toplevel .t2
@@ -350,7 +347,7 @@ test focus-2.14 {TkFocusFilterEvent procedure, Enter events, ignore errors when
destroy .t2
} {}
test focus-2.15 {TkFocusFilterEvent procedure, Leave events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear
@@ -365,7 +362,7 @@ test focus-2.15 {TkFocusFilterEvent procedure, Leave events} \
set result
} {{} .t.b1 {} {} {}}
test focus-2.16 {TkFocusFilterEvent procedure, Leave events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1
@@ -378,7 +375,7 @@ test focus-2.16 {TkFocusFilterEvent procedure, Leave events} \
out .t NotifyVirtual
}
test focus-2.17 {TkFocusFilterEvent procedure, Leave events} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
set result {}
focus .t.b1
event gen [testwrapper .t] <Enter> -detail NotifyAncestor -focus 1
@@ -393,7 +390,7 @@ out .t NotifyVirtual
} {}}
test focus-3.1 {SetFocus procedure, create record on focus} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
toplevel .t2 -width 250 -height 100
wm geometry .t2 +0+0
update
@@ -405,8 +402,7 @@ catch {destroy .t2}
# This test produces no result, but it will generate a protocol
# error if Tk forgets to make the window exist before focussing
# on it.
-test focus-3.2 {SetFocus procedure, making window exist} \
- {unixOnly testwrapper} {
+test focus-3.2 {SetFocus procedure, making window exist} {unix testwrapper} {
update
button .b2 -text "Another button"
focus .b2
@@ -417,13 +413,13 @@ update
# The following test doesn't produce a check-able result, but if
# there are bugs it may generate an X protocol error.
test focus-3.3 {SetFocus procedure, delaying claim of X focus} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focusSetup
focus -force .t.b2
update
} {}
test focus-3.4 {SetFocus procedure, delaying claim of X focus} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
focusSetup
wm withdraw .t
focus -force .t.b2
@@ -436,8 +432,7 @@ test focus-3.4 {SetFocus procedure, delaying claim of X focus} \
wm deiconify .t
} {}
catch {destroy .t2}
-test focus-3.5 {SetFocus procedure, generating events} \
- {unixOnly testwrapper} {
+test focus-3.5 {SetFocus procedure, generating events} {unix testwrapper} {
focusSetup
focusClear
set focusInfo {}
@@ -447,8 +442,7 @@ test focus-3.5 {SetFocus procedure, generating events} \
} {in .t NotifyVirtual
in .t.b2 NotifyAncestor
}
-test focus-3.6 {SetFocus procedure, generating events} \
- {unixOnly testwrapper} {
+test focus-3.6 {SetFocus procedure, generating events} {unix testwrapper} {
focusSetup
focus -force .b
update
@@ -462,7 +456,7 @@ in .t NotifyNonlinearVirtual
in .t.b2 NotifyNonlinear
}
test focus-3.7 {SetFocus procedure, generating events} \
- {unixOnly nonPortable testwrapper} {
+ {unix nonPortable testwrapper} {
# Non-portable because some platforms generate extra events.
focusSetup
@@ -473,7 +467,7 @@ test focus-3.7 {SetFocus procedure, generating events} \
set focusInfo
} {}
-test focus-4.1 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
+test focus-4.1 {TkFocusDeadWindow procedure} {unix testwrapper} {
focusSetup
update
focus -force .b
@@ -481,7 +475,7 @@ test focus-4.1 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
destroy .t
focus
} {.b}
-test focus-4.2 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
+test focus-4.2 {TkFocusDeadWindow procedure} {unix testwrapper} {
focusSetup
update
focus -force .t.b2
@@ -495,7 +489,7 @@ test focus-4.2 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
# Non-portable due to wm-specific redirection of input focus when
# windows are deleted:
-test focus-4.3 {TkFocusDeadWindow procedure} {unixOnly nonPortable testwrapper} {
+test focus-4.3 {TkFocusDeadWindow procedure} {unix nonPortable testwrapper} {
focusSetup
update
focus .t
@@ -504,7 +498,7 @@ test focus-4.3 {TkFocusDeadWindow procedure} {unixOnly nonPortable testwrapper}
update
focus
} {}
-test focus-4.4 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
+test focus-4.4 {TkFocusDeadWindow procedure} {unix testwrapper} {
focusSetup
focus -force .t.b2
update
@@ -517,7 +511,7 @@ test focus-4.4 {TkFocusDeadWindow procedure} {unixOnly testwrapper} {
setupbg
test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} \
- {unixOnly testwrapper secureserver} {
+ {unix testwrapper secureserver} {
focusSetup
focus -force .t
update
@@ -537,7 +531,7 @@ cleanupbg
fixfocus
test focus-6.1 {miscellaneous - embedded application in same process} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
eval interp delete [interp slaves]
catch {destroy .t}
toplevel .t
@@ -587,7 +581,7 @@ test focus-6.1 {miscellaneous - embedded application in same process} \
set 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}}}
test focus-6.2 {miscellaneous - embedded application in different process} \
- {unixOnly testwrapper} {
+ {unix testwrapper} {
eval interp delete [interp slaves]
catch {destroy .t}
setupbg
@@ -641,18 +635,5 @@ bind all <FocusIn> {}
bind all <FocusOut> {}
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-