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/canvImg.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/canvImg.test')
| -rw-r--r-- | tests/canvImg.test | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/tests/canvImg.test b/tests/canvImg.test index 776d268..2fc5740 100644 --- a/tests/canvImg.test +++ b/tests/canvImg.test @@ -18,7 +18,6 @@ canvas .c pack .c update - test canvImg-1.1 {options for image items} -body { .c create image 50 50 -anchor nw -tags i1 .c itemconfigure i1 -anchor @@ -91,7 +90,6 @@ test canvImg-2.6 {CreateImage procedure} -constraints testImageType -body { .c delete all } -returnCodes {error} -result {unknown option "-gorp"} - test canvImg-3.1 {ImageCoords procedure} -constraints testImageType -setup { image create test foo } -body { @@ -141,7 +139,6 @@ test canvImg-3.5 {ImageCoords procedure} -constraints testImageType -setup { image delete foo } -returnCodes {error} -result {wrong # coordinates: expected 0 or 2, got 3} - test canvImg-4.1 {ConfiugreImage procedure} -constraints testImageType -setup { .c delete all } -body { @@ -190,7 +187,6 @@ test canvImg-4.3 {ConfiugreImage procedure} -constraints testImageType -setup { image delete foo foo2 } -returnCodes {error} -result {image "lousy" doesn't exist} - test canvImg-5.1 {DeleteImage procedure} -constraints testImageType -setup { .c delete all imageCleanup @@ -219,7 +215,6 @@ test canvImg-5.2 {DeleteImage procedure (don't delete non-existent image)} -body update } -result {} - test canvImg-6.1 {ComputeImageBbox procedure} -constraints testImageType -setup { image create test foo .c delete all @@ -385,7 +380,7 @@ if {[testConstraint testImageType]} { } test canvImg-8.1 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect 50 70 80 81 .c gettags [.c find closest 70 90] @@ -394,7 +389,7 @@ test canvImg-8.1 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.2 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{50 70 80 79} .c gettags [.c find closest {*}{70 90}] @@ -403,7 +398,7 @@ test canvImg-8.2 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.3 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{99 70 110 81} .c gettags [.c find closest {*}{90 90}] @@ -412,7 +407,7 @@ test canvImg-8.3 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.4 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{101 70 110 79} .c gettags [.c find closest {*}{90 90}] @@ -421,7 +416,7 @@ test canvImg-8.4 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.5 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{99 100 110 115} .c gettags [.c find closest {*}{90 110}] @@ -430,7 +425,7 @@ test canvImg-8.5 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.6 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{101 100 110 115} .c gettags [.c find closest {*}{90 110}] @@ -439,7 +434,7 @@ test canvImg-8.6 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.7 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{99 134 110 145} .c gettags [.c find closest {*}{90 125}] @@ -448,7 +443,7 @@ test canvImg-8.7 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.8 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{101 136 110 145} .c gettags [.c find closest {*}{90 125}] @@ -457,7 +452,7 @@ test canvImg-8.8 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.9 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{50 134 80 145} .c gettags [.c find closest {*}{70 125}] @@ -466,7 +461,7 @@ test canvImg-8.9 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.10 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{50 136 80 145} .c gettags [.c find closest {*}{70 125}] @@ -475,7 +470,7 @@ test canvImg-8.10 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.11 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{20 134 31 145} .c gettags [.c find closest {*}{40 125}] @@ -484,7 +479,7 @@ test canvImg-8.11 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.12 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{20 136 29 145} .c gettags [.c find closest {*}{40 125}] @@ -493,7 +488,7 @@ test canvImg-8.12 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.13 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{20 100 31 115} .c gettags [.c find closest {*}{40 110}] @@ -502,7 +497,7 @@ test canvImg-8.13 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.14 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{20 100 29 115} .c gettags [.c find closest {*}{40 110}] @@ -511,7 +506,7 @@ test canvImg-8.14 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.15 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{20 70 31 80} .c gettags [.c find closest {*}{40 90}] @@ -520,7 +515,7 @@ test canvImg-8.15 {ImageToArea procedure} -constraints testImageType -setup { } -result {rect} test canvImg-8.16 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{20 70 29 79} .c gettags [.c find closest {*}{40 90}] @@ -529,7 +524,7 @@ test canvImg-8.16 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.17 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{60 70 69 109} .c gettags [.c find closest {*}{70 110}] @@ -538,7 +533,7 @@ test canvImg-8.17 {ImageToArea procedure} -constraints testImageType -setup { } -result {image} test canvImg-8.18 {ImageToArea procedure} -constraints testImageType -setup { .c create image 50 100 -image foo -tags image -anchor nw - .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline {} + .c create rect 10 10 20 20 -tags rect -fill black -width 0 -outline "" } -body { .c coords rect {*}{60 70 71 111} .c gettags [.c find closest {*}{70 110}] @@ -707,7 +702,6 @@ if {[testConstraint testImageType]} { image delete foo } - test canvImg-9.1 {DisplayImage procedure} -constraints testImageType -setup { .c delete all image create test foo |
