summaryrefslogtreecommitdiffstats
path: root/tests/canvas.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/canvas.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/canvas.test')
-rw-r--r--tests/canvas.test22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/canvas.test b/tests/canvas.test
index 2b0da48..81c6a8b 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -28,18 +28,18 @@ test canvas-1.2 {configuration options: bad value for "background"} -body {
.c configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test canvas-1.3 {configuration options: good value for "bg"} -body {
- .c configure -bg #ff0000
- .c cget -bg
+ .c configure -background #ff0000
+ .c cget -background
} -result {#ff0000}
test canvas-1.4 {configuration options: bad value for "bg"} -body {
- .c configure -bg non-existent
+ .c configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test canvas-1.5 {configuration options: good value for "bd"} -body {
- .c configure -bd 4
- .c cget -bd
+ .c configure -borderwidth 4
+ .c cget -borderwidth
} -result {4}
test canvas-1.6 {configuration options: bad value for "bd"} -body {
- .c configure -bd badValue
+ .c configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
test canvas-1.7 {configuration options: good value for "borderwidth"} -body {
.c configure -borderwidth 1.3
@@ -190,7 +190,7 @@ test canvas-1.47 {configure throws error on bad option} -body {
catch {destroy .c}
# Canvas used in 2.* test cases
-canvas .c -width 60 -height 40 -scrollregion {0 0 200 150} -bd 0 \
+canvas .c -width 60 -height 40 -scrollregion {0 0 200 150} -borderwidth 0 \
-highlightthickness 0
pack .c
update
@@ -259,10 +259,10 @@ test canvas-4.1 {ButtonEventProc procedure} -setup {
deleteWindows
set x {}
} -body {
- canvas .c1 -bg #543210
+ canvas .c1 -background #543210
rename .c1 .c2
lappend x [winfo children .]
- lappend x [.c2 cget -bg]
+ lappend x [.c2 cget -background]
destroy .c1
lappend x [info command .c*] [winfo children .]
} -result {.c1 #543210 {} {}}
@@ -502,7 +502,7 @@ test canvas-11.1 {canvas poly fill check, bug 5783} -setup {
} -body {
# This would crash in 8.3.0 and 8.3.1
.c create polygon 0 0 100 100 200 50 \
- -fill {} -stipple gray50 -outline black
+ -fill "" -stipple gray50 -outline black
} -result 1
test canvas-11.2 {canvas poly overlap fill check, bug 226357} -setup {
destroy .c
@@ -730,7 +730,7 @@ test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setu
set id [.c create rect 0 0 1cm 1cm]
expr {[lindex [.c coords $id] 2]>1}
} -result {1}
-destroy .c
+catch {destroy .c}
test canvas-16.1 {arc coords check} -setup {
canvas .c