summaryrefslogtreecommitdiffstats
path: root/tests/canvPs.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/canvPs.test')
-rw-r--r--tests/canvPs.test136
1 files changed, 92 insertions, 44 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