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/canvText.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/canvText.test')
-rw-r--r-- | tests/canvText.test | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/tests/canvText.test b/tests/canvText.test index f0c677f..1b7344e 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -12,7 +12,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands # Canvas used in 1.* - 17.* tests -canvas .c -width 400 -height 300 -bd 2 -relief sunken +canvas .c -width 400 -height 300 -borderwidth 2 -relief sunken pack .c update @@ -92,7 +92,6 @@ test canvasText-1.19 {configuration options: bounding of "angle"} -body { } -result {30.0 330.0 0.0} .c delete test - test canvText-2.1 {CreateText procedure: args} -body { .c create text } -returnCodes {error} -result {wrong # args: should be ".c create text coords ?arg ...?"} @@ -118,7 +117,6 @@ test canvText-2.5 {CreateText procedure} -body { .c delete x } -result {0.0 0.0} - test canvText-3.1 {TextCoords procedure} -body { .c create text 20 20 -tag test .c coords test 0 0 @@ -168,7 +166,6 @@ test canvText-3.6 {TextCoords procedure} -setup { .c delete test } -returnCodes {error} -result {wrong # coordinates: expected 0 or 2, got 3} - test canvText-4.1 {ConfigureText procedure} -setup { .c create text 20 20 -tag test } -body { @@ -252,14 +249,12 @@ test canvText-4.6 {ConfigureText procedure: adjust cursor} -setup { .c delete test } -result {4} - test canvText-5.1 {ConfigureText procedure: adjust cursor} -body { .c create text 10 10 -tag x -fill blue -font "times 40" -stipple gray50 \ -text "xyz" .c delete x } -result {} - test canvText-6.1 {ComputeTextBbox procedure} -constraints fonts -setup { .c delete test } -body { @@ -491,7 +486,7 @@ test canvText-7.9 {DisplayText procedure: select end} -setup { .t.c select from $id 0 .t.c select to $id end update - #catch {destroy .t} + #destroy .t update } -cleanup { destroy .t @@ -688,7 +683,6 @@ test canvText-9.15 {TextInsert procedure: cursor doesn't move} -body { } -result {5} .c delete test - test canvText-10.1 {TextToPoint procedure} -body { .c create text 0 0 -tag test .c itemconfig test -text 0 -anchor center @@ -697,7 +691,6 @@ test canvText-10.1 {TextToPoint procedure} -body { .c delete test } -result {0} - test canvText-11.1 {TextToArea procedure} -setup { .c create text 0 0 -tag test focus .c @@ -721,7 +714,6 @@ test canvText-11.2 {TextToArea procedure} -setup { .c delete test } -result {} - test canvText-12.1 {ScaleText procedure} -body { .c create text 100 100 -tag test .c scale all 50 50 2 2 @@ -730,7 +722,6 @@ test canvText-12.1 {ScaleText procedure} -body { .c delete test } -result {150 150} - test canvText-13.1 {TranslateText procedure} -body { .c create text 100 100 -tag test .c move all 10 10 @@ -739,7 +730,6 @@ test canvText-13.1 {TranslateText procedure} -body { .c delete test } -result {110 110} - test canvText-14.1 {GetTextIndex procedure} -setup { .c create text 0 0 -tag test focus .c @@ -850,7 +840,7 @@ end set font {Courier 12 italic} set ax [font measure $font 0] set ay [font metrics $font -linespace] - .c config -height 300 -highlightthickness 0 -bd 0 + .c config -height 300 -highlightthickness 0 -borderwidth 0 update .c create text 100 100 -tags test .c itemconfig test -font $font -text "00000000" -width [expr 3*$ax] @@ -877,7 +867,7 @@ test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} -setup { test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} -setup { destroy .c - set c [canvas .c -bg black -width 964] + set c [canvas .c -background black -width 964] pack $c $c delete all after 100 "set done 1"; vwait done |