summaryrefslogtreecommitdiffstats
path: root/tests/canvas.test
diff options
context:
space:
mode:
authorhobbs <hobbs>1999-12-14 06:53:11 (GMT)
committerhobbs <hobbs>1999-12-14 06:53:11 (GMT)
commitcc105ac04d3d06c27918887b8157b2fa3f8f9e62 (patch)
tree9cf936e1b6b3abcdf9ad5fd0f58caa549f438d21 /tests/canvas.test
parent62e9e6611d2da6b8113210d5002611c40909231e (diff)
downloadtk-cc105ac04d3d06c27918887b8157b2fa3f8f9e62.zip
tk-cc105ac04d3d06c27918887b8157b2fa3f8f9e62.tar.gz
tk-cc105ac04d3d06c27918887b8157b2fa3f8f9e62.tar.bz2
* tests/bind.test:
* tests/canvImg.test: * tests/canvPsArc.tcl: * tests/canvPsImg.tcl: (new file) * tests/canvRect.test: * tests/canvText.test: * tests/canvas.test: * tests/defs.tcl: * tests/entry.test: * tests/event.test: * tests/font.test: * tests/frame.test: * tests/imgPhoto.test: * tests/safe.test: * tests/scale.test: * tests/scrollbar.test: * tests/select.test: * tests/text.test: * tests/textDisp.test: * tests/textTag.test: * tests/unixFont.test: * tests/unixWm.test: * tests/visual_bb.test: * tests/winClipboard.test: tests for the dash patch changes
Diffstat (limited to 'tests/canvas.test')
-rw-r--r--tests/canvas.test110
1 files changed, 109 insertions, 1 deletions
diff --git a/tests/canvas.test b/tests/canvas.test
index ee612ef..569dd6b 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: canvas.test,v 1.5 1999/04/16 01:51:35 stanton Exp $
+# RCS: @(#) $Id: canvas.test,v 1.6 1999/12/14 06:53:12 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -243,6 +243,114 @@ test canvas-9.1 {canvas id creation and deletion} {
set x ""
} {}
+test canvas-10.1 {find items using tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 60 40 80 -fill yellow -tag [list b a]
+ .c create oval 20 100 40 120 -fill green -tag [list c b]
+ .c create oval 20 140 40 160 -fill blue -tag [list b]
+ .c create oval 20 180 40 200 -fill bisque -tag [list a d e]
+ .c create oval 20 220 40 240 -fill bisque -tag b
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ set res {}
+ lappend res [.c find withtag {!a}]
+ lappend res [.c find withtag {b&&c}]
+ lappend res [.c find withtag {b||c}]
+ lappend res [.c find withtag {a&&!b}]
+ lappend res [.c find withtag {!b&&!c}]
+ lappend res [.c find withtag {d&&a&&c&&b}]
+ lappend res [.c find withtag {b^a}]
+ lappend res [.c find withtag {(a&&!b)||(!a&&b)}]
+ lappend res [.c find withtag { ( a && ! b ) || ( ! a && b ) }]
+ lappend res [.c find withtag {a&&!(c||d)}]
+ lappend res [.c find withtag {d&&"tag with spaces"}]
+ lappend res [.c find withtag "tag with spaces"]
+} {{3 4 6 7} {1 3} {1 2 3 4 6} 5 {5 7} 1 {3 4 5 6} {3 4 5 6} {3 4 5 6} 2 7 7}
+test canvas-10.2 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {&&c}} err
+ set err
+} {Unexpected operator in tag search expression}
+test canvas-10.3 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {!!c}} err
+ set err
+} {Too many '!' in tag search expression}
+test canvas-10.4 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {b||}} err
+ set err
+} {Missing tag in tag search expression}
+test canvas-10.5 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {b&&(c||)}} err
+ set err
+} {Unexpected operator in tag search expression}
+test canvas-10.6 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {d&&""}} err
+ set err
+} {Null quoted tag string in tag search expression}
+test canvas-10.7 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {d&&"tag with spaces}} err
+ set err
+} {Missing endquote in tag search expression}
+test canvas-10.8 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {a&&"tag with spaces"z}} err
+ set err
+} {Invalid boolean operator in tag search expression}
+test canvas-10.9 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {a&&b&c}} err
+ set err
+} {Singleton '&' in tag search expression}
+test canvas-10.10 {check errors from tag expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list a b c d]
+ .c create oval 20 260 40 280 -fill bisque -tag [list d "tag with spaces"]
+ catch {.c find withtag {a||b|c}} err
+ set err
+} {Singleton '|' in tag search expression}
+test canvas-10.11 {backward compatility - strange tags that are not expressions} {
+ catch {destroy .c}
+ canvas .c
+ .c create oval 20 20 40 40 -fill red -tag [list { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }]
+ .c find withtag { strange tag(xxx&yyy|zzz) " && \" || ! ^ " }
+} {1}
+test canvas-10.12 {multple events bound to same tag expr} {
+ catch {destroy .c}
+ canvas .c
+ .c bind {a && b} <Enter> {puts Enter}
+ .c bind {a && b} <Leave> {puts Leave}
+} {}
# cleanup
::tcltest::cleanupTests