diff options
author | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
---|---|---|
committer | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
commit | 48c9fcb7281cc6aa076113db874c7ae0e105795d (patch) | |
tree | 7187940ff056462bfa41705a2ce04d0ed07d424e /tests/geometry.test | |
parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
download | tk-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/geometry.test')
-rw-r--r-- | tests/geometry.test | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/geometry.test b/tests/geometry.test index 13cc515..f25164d 100644 --- a/tests/geometry.test +++ b/tests/geometry.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. -proc getsize w { +proc getsize {w} { regexp {(^[^+-]*)} [wm geometry $w] foo x return $x } @@ -17,14 +17,13 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test - wm geometry . 300x300 raise . update -frame .f -bd 2 -relief raised -frame .f.f -bd 2 -relief sunken -frame .f.f.f -bd 2 -relief raised +frame .f -borderwidth 2 -relief raised +frame .f.f -borderwidth 2 -relief sunken +frame .f.f.f -borderwidth 2 -relief raised button .b1 -text .b1 button .b2 -text .b2 button .b3 -text .b3 @@ -53,7 +52,6 @@ test geometry-1.2 {Tk_ManageGeometry procedure} -setup { list [winfo x .b1] [winfo y .b1] } -result {0 0} - test geometry-2.1 {Tk_GeometryRequest procedure} -setup { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w @@ -76,7 +74,6 @@ test geometry-2.1 {Tk_GeometryRequest procedure} -setup { destroy .f2 } -result {1 1 150 300 1x1+0+0 150x300+10+20 100x80+10+20} - test geometry-3.1 {Tk_SetInternalBorder procedure} -setup { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w @@ -86,14 +83,13 @@ test geometry-3.1 {Tk_SetInternalBorder procedure} -setup { place .b1 -in .f -x 50 -y 5 update set x [list [winfo x .b1] [winfo y .b1]] - .f configure -bd 5 + .f configure -borderwidth 5 update lappend x [winfo x .b1] [winfo y .b1] } -cleanup { - .f configure -bd 2 + .f configure -borderwidth 2 } -result {72 37 75 40} - test geometry-4.1 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} -setup { foreach w {.f .f.f .f.f.f .b1 .b2 .b3} { place forget $w @@ -234,8 +230,8 @@ test geometry-4.8 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} -setup { place .b3 -in .f.f.f -x 50 -y 25 update destroy .f.f - frame .f.f -bd 2 -relief raised - frame .f.f.f -bd 2 -relief raised + frame .f.f -borderwidth 2 -relief raised + frame .f.f.f -borderwidth 2 -relief raised place .f -x 30 -y 25 update list [winfo x .b1] [winfo y .b1] [winfo ismapped .b1] \ |