summaryrefslogtreecommitdiffstats
path: root/tests/focusTcl.test
diff options
context:
space:
mode:
authorandreask <andreask>2013-01-22 19:30:43 (GMT)
committerandreask <andreask>2013-01-22 19:30:43 (GMT)
commit48c9fcb7281cc6aa076113db874c7ae0e105795d (patch)
tree7187940ff056462bfa41705a2ce04d0ed07d424e /tests/focusTcl.test
parent41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff)
downloadtk-contrib_patrick_fradin_code_cleanup.zip
tk-contrib_patrick_fradin_code_cleanup.tar.gz
tk-contrib_patrick_fradin_code_cleanup.tar.bz2
Contribution by Patrick Fradin <patrick.fradin@planar.com>contrib_patrick_fradin_code_cleanup
Quoting his mail: <pre> ========================================================== Hi Jeff, I spent some of my time to contribute to the TclTk community ! I'm in late for Christmas gift but like we said in French : "Mieux vaut tard que jamais". ;-) I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and Tk library directories (library, tools and tests) to correct a lot of warnings and few errors. (encapsulate some expr, use 'chan xxx' instead of fconfigure, fileevent...) I've made some improvements too : Examples : - Use 'lassign' instead of many 'lindex' of 'foreach/break' loop. - Use 'in' or 'ni' operators instead of 'lsearch -exact' or to factorise some eq/ne && / || tests. - Use 'eq' or 'ne' to tests strings instead of '==' or '!='. - Use 'unset -nocomplain' to avoid 'catch {unset...}'. - Remove some useless catch around 'destroy' calls. - Use expand {*} instead of 'eval'. Don't touch a lot of code because I don't know all structs and lists. I think it could be a greater improvement to reduce 'eval' calls. Due to previous experience, I dot not change any indentation ! ;-) ========================================================== </pre>
Diffstat (limited to 'tests/focusTcl.test')
-rw-r--r--tests/focusTcl.test20
1 files changed, 7 insertions, 13 deletions
diff --git a/tests/focusTcl.test b/tests/focusTcl.test
index ef848bb..9f93ebe 100644
--- a/tests/focusTcl.test
+++ b/tests/focusTcl.test
@@ -16,13 +16,13 @@ option add *takeFocus 1
option add *highlightThickness 2
. configure -takefocus 1 -highlightthickness 2
-proc setup1 w {
- if {$w == "."} {
+proc setup1 {w} {
+ if {$w eq "."} {
set w ""
}
foreach i {a b c d} {
destroy $w.$i
- frame $w.$i -width 200 -height 50 -bd 2 -relief raised
+ frame $w.$i -width 200 -height 50 -borderwidth 2 -relief raised
pack $w.$i
}
.b configure -width 0 -height 0
@@ -36,8 +36,8 @@ proc setup1 w {
}
}
-proc cleanup1 w {
- if {$w == "."} {
+proc cleanup1 {w} {
+ if {$w eq "."} {
set w ""
}
foreach i {a b c d} {
@@ -48,7 +48,6 @@ proc cleanup1 w {
}
}
-
test focusTcl-1.1 {tk_focusNext procedure, no children} -body {
tk_focusNext .
} -result {.}
@@ -133,7 +132,6 @@ test focusTcl-1.12 {tk_focusNext procedure, basic tree traversal} -body {
cleanup1 .
} -result {.a}
-
test focusTcl-2.1 {tk_focusNext procedure, toplevels} -setup {
deleteWindows
} -body {
@@ -209,7 +207,6 @@ test focusTcl-2.5 {tk_focusNext procedure, toplevels} -setup {
deleteWindows
} -result {.t}
-
test focusTcl-3.1 {tk_focusPrev procedure, no children} -body {
tk_focusPrev .
} -result {.}
@@ -263,7 +260,6 @@ test focusTcl-3.9 {tk_focusPrev procedure, basic tree traversal} -body {
cleanup1 .
} -result {.}
-
deleteWindows
setup1 .
toplevel .t
@@ -351,7 +347,6 @@ test focusTcl-4.5 {tk_focusPrev procedure, toplevels} -setup {
deleteWindows
} -result {.t.b.z}
-
test focusTcl-5.1 {tkFocusOK procedure, -takefocus 0} -body {
setup1 .
.b.x configure -takefocus 0
@@ -372,9 +367,9 @@ test focusTcl-5.2 {tkFocusOK procedure, -takefocus 1} -body {
} -result {.c .c}
test focusTcl-5.3 {tkFocusOK procedure, -takefocus procedure} -body {
proc t w {
- if {$w == ".b.x"} {
+ if {$w eq ".b.x"} {
return 1
- } elseif {$w == ".b.y"} {
+ } elseif {$w eq ".b.y"} {
return ""
}
return 0
@@ -473,7 +468,6 @@ test focusTcl-5.11 {tkFocusOK procedure, -takefocus "", check for bindings} -bod
bind Frame <Key> {}
} -result {.a .b}
-
. configure -takefocus 0 -highlightthickness 0
option clear