diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/canvPs.test | 136 | ||||
-rw-r--r-- | tests/choosedir.test | 8 | ||||
-rw-r--r-- | tests/filebox.test | 3 | ||||
-rw-r--r-- | tests/imgPPM.test | 11 | ||||
-rw-r--r-- | tests/imgPhoto.test | 4 | ||||
-rw-r--r-- | tests/listbox.test | 3 | ||||
-rw-r--r-- | tests/main.test | 8 |
7 files changed, 112 insertions, 61 deletions
diff --git a/tests/canvPs.test b/tests/canvPs.test index 8921450..f209828 100644 --- a/tests/canvPs.test +++ b/tests/canvPs.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: canvPs.test,v 1.9 2004/06/24 12:45:42 dkf Exp $ +# RCS: @(#) $Id: canvPs.test,v 1.10 2004/12/08 03:02:53 dgp Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -17,36 +17,58 @@ canvas .c -width 400 -height 300 -bd 2 -relief sunken pack .c update -test canvPs-1.1 {test writing to a file} {unixOrPc} { +test canvPs-1.1 {test writing to a file} -constraints { + unixOrPc +} -setup { + set foo [makeFile {} foo.ps] +} -body { + .c postscript -file $foo + file exists $foo +} -cleanup { removeFile foo.ps - .c postscript -file foo.ps - file exists foo.ps -} 1 -test canvPs-1.2 {test writing to a file, idempotency} {unixOrPc} { - removeFile foo.ps - removeFile bar.ps - .c postscript -file foo.ps - .c postscript -file bar.ps +} -result 1 +test canvPs-1.2 {test writing to a file, idempotency} -constraints { + unixOrPc +} -setup { + set foo [makeFile {} foo.ps] + set bar [makeFile {} bar.ps] +} -body { + .c postscript -file $foo + .c postscript -file $bar set status ok - if {[file size bar.ps] != [file size foo.ps]} { + if {[file size $bar] != [file size $foo]} { set status broken } set status -} ok - -test canvPs-2.1 {test writing to a channel} {unixOrPc} { +} -cleanup { removeFile foo.ps - set chan [open foo.ps w] + removeFile bar.ps +} -result ok + +test canvPs-2.1 {test writing to a channel} -constraints { + unixOrPc +} -setup { + set foo [makeFile {} foo.ps] + file delete $foo +} -body { + set chan [open $foo w] fconfigure $chan -translation lf .c postscript -channel $chan close $chan - file exists foo.ps -} 1 -test canvPs-2.2 {test writing to channel, idempotency} {unixOrPc} { + file exists $foo +} -cleanup { removeFile foo.ps - removeFile bar.ps - set c1 [open foo.ps w] - set c2 [open bar.ps w] +} -result 1 +test canvPs-2.2 {test writing to channel, idempotency} -constraints { + unixOrPc +} -setup { + set foo [makeFile {} foo.ps] + set bar [makeFile {} bar.ps] + file delete $foo + file delete $bar +} -body { + set c1 [open $foo w] + set c2 [open $bar w] fconfigure $c1 -translation lf fconfigure $c2 -translation lf .c postscript -channel $c1 @@ -54,42 +76,63 @@ test canvPs-2.2 {test writing to channel, idempotency} {unixOrPc} { close $c1 close $c2 set status ok - if {[file size bar.ps] != [file size foo.ps]} { + if {[file size $bar] != [file size $foo]} { set status broken } set status -} ok -test canvPs-2.3 {test writing to channel and file, same output} unix { +} -cleanup { removeFile foo.ps removeFile bar.ps - set c1 [open foo.ps w] +} -result ok +test canvPs-2.3 {test writing to channel and file, same output} -constraints { + unix +} -setup { + set foo [makeFile {} foo.ps] + set bar [makeFile {} bar.ps] + file delete $foo + file delete $bar +} -body { + set c1 [open $foo w] fconfigure $c1 -translation lf .c postscript -channel $c1 close $c1 - .c postscript -file bar.ps + .c postscript -file $bar set status ok - if {[file size foo.ps] != [file size bar.ps]} { + if {[file size $foo] != [file size $bar]} { set status broken } set status -} ok -test canvPs-2.4 {test writing to channel and file, same output} win { +} -cleanup { removeFile foo.ps removeFile bar.ps - set c1 [open foo.ps w] +} -result ok +test canvPs-2.4 {test writing to channel and file, same output} -constraints { + win +} -setup { + set foo [makeFile {} foo.ps] + set bar [makeFile {} bar.ps] + file delete $foo + file delete $bar +} -body { + set c1 [open $foo w] fconfigure $c1 -translation crlf .c postscript -channel $c1 close $c1 - .c postscript -file bar.ps + .c postscript -file $bar set status ok - if {[file size foo.ps] != [file size bar.ps]} { + if {[file size $foo] != [file size $bar]} { set status broken } set status -} ok - -test canvPs-3.1 {test ps generation with an embedded window} {} { +} -cleanup { + removeFile foo.ps removeFile bar.ps +} -result ok + +test canvPs-3.1 {test ps generation with an embedded window} -setup { + set bar [makeFile {} bar.ps] + file delete $bar +} -body { destroy .c pack [canvas .c -width 200 -height 200 -background white] .c create rect 20 20 150 150 -tags rect0 -dash . -width 2 @@ -104,19 +147,25 @@ test canvPs-3.1 {test ps generation with an embedded window} {} { .c.e insert 0 "we gonna be postscripted" .c create window 50 180 -anchor nw -window .c.e update - .c postscript -file bar.ps - file exists bar.ps -} 1 -test canvPs-3.2 {test ps generation with an embedded window not mapped} {} { + .c postscript -file $bar + file exists $bar +} -cleanup { removeFile bar.ps +} -result 1 +test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup { + set bar [makeFile {} bar.ps] + file delete $bar +} -body { destroy .c pack [canvas .c -width 200 -height 200 -background white] entry .c.e -background pink -foreground blue -width 14 .c.e insert 0 "we gonna be postscripted" .c create window 50 180 -anchor nw -window .c.e - .c postscript -file bar.ps - file exists bar.ps -} 1 + .c postscript -file $bar + file exists $bar +} -cleanup { + removeFile bar.ps +} -result 1 test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} {} { destroy .c @@ -126,8 +175,7 @@ test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498 } 0 # cleanup -removeFile foo.ps -removeFile bar.ps +unset -nocomplain foo bar deleteWindows cleanupTests return diff --git a/tests/choosedir.test b/tests/choosedir.test index 540c686..d63d091 100644 --- a/tests/choosedir.test +++ b/tests/choosedir.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: choosedir.test,v 1.13 2004/06/24 12:45:42 dkf Exp $ +# RCS: @(#) $Id: choosedir.test,v 1.14 2004/12/08 03:02:53 dgp Exp $ # package require tcltest 2.1 @@ -81,10 +81,9 @@ proc SendButtonPress {parent btn type} { # #---------------------------------------------------------------------- # Make a dir for us to rely on for tests -makeDirectory choosedirTest -set dir [pwd] +set real [makeDirectory choosedirTest] +set dir [file dirname $real] set fake [file join $dir non-existant] -set real [file join $dir choosedirTest] set parent . @@ -145,5 +144,6 @@ test choosedir-5.1 "tk_chooseDirectory, handles {} entry text" unix { } $real # cleanup +removeDirectory choosedirTest cleanupTests return diff --git a/tests/filebox.test b/tests/filebox.test index d8da29c..f42af62 100644 --- a/tests/filebox.test +++ b/tests/filebox.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: filebox.test,v 1.16 2004/06/04 19:55:31 dgp Exp $ +# RCS: @(#) $Id: filebox.test,v 1.17 2004/12/08 03:02:53 dgp Exp $ # package require tcltest 2.1 @@ -375,5 +375,6 @@ foreach mode $modes { set tk_strictMotif $tk_strictMotif_old # cleanup +removeFile filebox.tmp cleanupTests return diff --git a/tests/imgPPM.test b/tests/imgPPM.test index 1e043bd..53aa4c7 100644 --- a/tests/imgPPM.test +++ b/tests/imgPPM.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: imgPPM.test,v 1.7 2004/05/23 17:34:48 dkf Exp $ +# RCS: @(#) $Id: imgPPM.test,v 1.8 2004/12/08 03:03:06 dgp Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -14,6 +14,8 @@ tcltest::loadTestedCommands eval image delete [image names] +# Note that we do not use [tcltest::makeFile] because it is +# only suitable for text files proc put {file data} { set f [open $file w] fconfigure $f -translation lf @@ -68,8 +70,8 @@ test imgPPM-2.1 {FileWritePPM procedure} { } {1 {couldn't open "not_a_dir/bar/baz/gorp": no such file or directory} {posix enoent {no such file or directory}}} test imgPPM-2.2 {FileWritePPM procedure} { catch {unset data} - p1 write -format ppm test2.ppm - set fd [open test2.ppm] + p1 write -format ppm test.ppm + set fd [open test.ppm] set data [read $fd] close $fd set data @@ -144,10 +146,9 @@ test imgPPM-3.13 {ReadPPMFileHeader procedure, file ends too soon} { list [catch {image create photo p1 -file test.ppm} msg] $msg } {1 {couldn't recognize data in image file "test.ppm"}} -removeFile test.ppm -removeFile test2.ppm eval image delete [image names] # cleanup +catch {file delete test.ppm} cleanupTests return diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test index d3193b9..d79dad0 100644 --- a/tests/imgPhoto.test +++ b/tests/imgPhoto.test @@ -9,7 +9,7 @@ # # Author: Paul Mackerras (paulus@cs.anu.edu.au) # -# RCS: @(#) $Id: imgPhoto.test,v 1.20 2004/12/04 00:04:41 dkf Exp $ +# RCS: @(#) $Id: imgPhoto.test,v 1.21 2004/12/08 03:03:06 dgp Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -23,7 +23,7 @@ update set README [makeFile { README -- Tk test suite design document. -} README-imgPhotot] +} README-imgPhoto] # find the teapot.ppm file for use in these tests # first look in $tk_library/demos/images/teapot.ppm diff --git a/tests/listbox.test b/tests/listbox.test index 73b068a..8534e10 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: listbox.test,v 1.24 2004/12/04 00:04:41 dkf Exp $ +# RCS: @(#) $Id: listbox.test,v 1.25 2004/12/08 03:03:06 dgp Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -943,6 +943,7 @@ test listbox-4.18 {ConfigureListbox, no listvar -> bad listvar} { "unmatched open quote in list: invalid -listvariable value"] test listbox-4.19 {ConfigureListbox, no listvar -> bad non-existent listvar} { catch {destroy .l} + unset -nocomplain ::foo listbox .l -listvar foo .l insert end a b c d catch {.l configure -listvar ::zoo::bar::foo} result diff --git a/tests/main.test b/tests/main.test index ffb098a..d37240f 100644 --- a/tests/main.test +++ b/tests/main.test @@ -8,7 +8,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: main.test,v 1.9 2004/05/23 17:34:48 dkf Exp $ +# RCS: @(#) $Id: main.test,v 1.10 2004/12/08 03:03:06 dgp Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -28,7 +28,7 @@ test main-2.1 {Tk_MainEx: -encoding option} -constraints { stdio } -setup { set script [makeFile {} script] - removeFile script + file delete $script set f [open $script w] fconfigure $f -encoding utf-8 puts $f {puts [list $argv0 $argv $tcl_interactive]} @@ -47,7 +47,7 @@ test main-2.2 {Tk_MainEx: -encoding option} -constraints { stdio } -setup { set script [makeFile {} script] - removeFile script + file delete $script set f [open $script w] fconfigure $f -encoding utf-8 puts $f {puts [list $argv0 $argv $tcl_interactive]} @@ -80,7 +80,7 @@ test main-2.3 {Tk_MainEx: -encoding option} -constraints { stdio } -setup { set script [makeFile {} script] - removeFile script + file delete $script set f [open $script w] fconfigure $f -encoding utf-8 puts $f {puts [list $argv0 $argv $tcl_interactive]} |