summaryrefslogtreecommitdiffstats
path: root/tests/raise.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/raise.test
parent41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff)
downloadtk-48c9fcb7281cc6aa076113db874c7ae0e105795d.zip
tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.gz
tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.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/raise.test')
-rw-r--r--tests/raise.test25
1 files changed, 9 insertions, 16 deletions
diff --git a/tests/raise.test b/tests/raise.test
index 461ccbf..95fd11c 100644
--- a/tests/raise.test
+++ b/tests/raise.test
@@ -21,7 +21,7 @@ proc raise_setup {} {
destroy $i
}
foreach i {a b c d e} {
- label .raise.$i -text $i -relief raised -bd 2
+ label .raise.$i -text $i -relief raised -borderwidth 2
}
place .raise.a -x 20 -y 60 -width 60 -height 80
place .raise.b -x 60 -y 60 -width 60 -height 80
@@ -36,14 +36,14 @@ proc raise_setup {} {
proc raise_getOrder {} {
set x [winfo rootx .raise]
set y [winfo rooty .raise]
- list [winfo name [winfo containing [expr $x+50] [expr $y+70]]] \
- [winfo name [winfo containing [expr $x+90] [expr $y+70]]] \
- [winfo name [winfo containing [expr $x+130] [expr $y+70]]] \
- [winfo name [winfo containing [expr $x+70] [expr $y+100]]] \
- [winfo name [winfo containing [expr $x+110] [expr $y+100]]] \
- [winfo name [winfo containing [expr $x+50] [expr $y+130]]] \
- [winfo name [winfo containing [expr $x+90] [expr $y+130]]] \
- [winfo name [winfo containing [expr $x+130] [expr $y+130]]]
+ list [winfo name [winfo containing [expr {$x + 50}] [expr {$y + 70}]]] \
+ [winfo name [winfo containing [expr {$x + 90}] [expr {$y + 70}]]] \
+ [winfo name [winfo containing [expr {$x + 130}] [expr {$y + 70}]]] \
+ [winfo name [winfo containing [expr {$x + 70}] [expr {$y + 100}]]] \
+ [winfo name [winfo containing [expr {$x + 110}] [expr {$y + 100}]]] \
+ [winfo name [winfo containing [expr {$x + 50}] [expr {$y + 130}]]] \
+ [winfo name [winfo containing [expr {$x + 90}] [expr {$y + 130}]]] \
+ [winfo name [winfo containing [expr {$x + 130}] [expr {$y + 130}]]]
}
# Procedure to set up a collection of top-level windows
@@ -60,7 +60,6 @@ proc raise_makeToplevels {} {
toplevel .raise
wm geom .raise 250x200+0+0
-
test raise-1.1 {preserve creation order} -body {
raise_setup
tkwait visibility .raise.e
@@ -91,7 +90,6 @@ test raise-1.5 {preserve creation order} -constraints testmakeexist -body {
raise_getOrder
} -result {d d d b c e e e}
-
test raise-2.1 {raise internal windows before creation} -body {
raise_setup
raise .raise.a
@@ -123,7 +121,6 @@ test raise-2.5 {raise internal windows before creation} -body {
raise_getOrder
} -result {a d d a c e e e}
-
test raise-3.1 {raise internal windows after creation} -body {
raise_setup
update
@@ -158,7 +155,6 @@ test raise-3.4 {raise internal windows after creation} -constraints {
raise_getOrder
} -result {d d d a c e e e}
-
test raise-4.1 {raise relative to nephews} -body {
raise_setup
update
@@ -177,7 +173,6 @@ test raise-4.2 {raise relative to nephews} -setup {
destroy .raise2
} -returnCodes error -result {can't raise ".raise.a" above ".raise2"}
-
test raise-5.1 {lower internal windows} -body {
raise_setup
update
@@ -207,7 +202,6 @@ test raise-5.4 {lower internal windows} -setup {
destroy .raise2
} -returnCodes error -result {can't lower ".raise.a" below ".raise2"}
-
test raise-6.1 {raise/lower toplevel windows} -constraints {
nonPortable
} -body {
@@ -286,7 +280,6 @@ test raise-6.6 {raise/lower toplevel windows} -constraints {
[winfo rooty .raise2]]
} -result {.raise1 .raise3}
-
test raise-7.1 {errors in raise/lower commands} -body {
raise
} -returnCodes error -result {wrong # args: should be "raise window ?aboveThis?"}