summaryrefslogtreecommitdiffstats
path: root/tests/canvPs.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/canvPs.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/canvPs.test')
-rw-r--r--tests/canvPs.test25
1 files changed, 11 insertions, 14 deletions
diff --git a/tests/canvPs.test b/tests/canvPs.test
index c7ba958..47dcd0b 100644
--- a/tests/canvPs.test
+++ b/tests/canvPs.test
@@ -13,7 +13,7 @@ tcltest::loadTestedCommands
imageInit
# canvas used in 1.* and 2.* test cases
-canvas .c -width 400 -height 300 -bd 2 -relief sunken
+canvas .c -width 400 -height 300 -borderwidth 2 -relief sunken
.c create rectangle 20 20 80 80 -fill red
pack .c
update
@@ -46,7 +46,6 @@ test canvPs-1.2 {test writing to a file, idempotency} -constraints {
removeFile bar.ps
} -result ok
-
test canvPs-2.1 {test writing to a channel} -constraints {
unixOrPc
} -setup {
@@ -54,9 +53,9 @@ test canvPs-2.1 {test writing to a channel} -constraints {
file delete $foo
} -body {
set chan [open $foo w]
- fconfigure $chan -translation lf
+ chan configure $chan -translation lf
.c postscript -channel $chan
- close $chan
+ chan close $chan
file exists $foo
} -cleanup {
removeFile foo.ps
@@ -71,12 +70,12 @@ test canvPs-2.2 {test writing to channel, idempotency} -constraints {
} -body {
set c1 [open $foo w]
set c2 [open $bar w]
- fconfigure $c1 -translation lf
- fconfigure $c2 -translation lf
+ chan configure $c1 -translation lf
+ chan configure $c2 -translation lf
.c postscript -channel $c1
.c postscript -channel $c2
- close $c1
- close $c2
+ chan close $c1
+ chan close $c2
set status ok
if {[file size $bar] != [file size $foo]} {
set status broken
@@ -95,9 +94,9 @@ test canvPs-2.3 {test writing to channel and file, same output} -constraints {
file delete $bar
} -body {
set c1 [open $foo w]
- fconfigure $c1 -translation lf
+ chan configure $c1 -translation lf
.c postscript -channel $c1
- close $c1
+ chan close $c1
.c postscript -file $bar
set status ok
if {[file size $foo] != [file size $bar]} {
@@ -117,9 +116,9 @@ test canvPs-2.4 {test writing to channel and file, same output} -constraints {
file delete $bar
} -body {
set c1 [open $foo w]
- fconfigure $c1 -translation crlf
+ chan configure $c1 -translation crlf
.c postscript -channel $c1
- close $c1
+ chan close $c1
.c postscript -file $bar
set status ok
if {[file size $foo] != [file size $bar]} {
@@ -132,7 +131,6 @@ test canvPs-2.4 {test writing to channel and file, same output} -constraints {
} -result ok
destroy .c
-
test canvPs-3.1 {test ps generation with an embedded window} -constraints {
notAqua
} -setup {
@@ -174,7 +172,6 @@ test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup {
removeFile bar.ps
} -result {1}
-
test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} -body {
pack [canvas .c]
.c create poly 10 20 10 20