summaryrefslogtreecommitdiffstats
path: root/tests/canvas.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2020-01-18 11:32:22 (GMT)
committerfvogel <fvogelnew1@free.fr>2020-01-18 11:32:22 (GMT)
commitd2393d8231eb7b15dd5a55a82ea7f7f3ced84392 (patch)
tree590cd16e5e5900d9185ab2ded5eeb77ee59039a9 /tests/canvas.test
parent6a8038c617638af4e5eff2f17b422bb4fca72e58 (diff)
parentba181129b75274100ecbd2d1cab8a152c3297d04 (diff)
downloadtk-d2393d8231eb7b15dd5a55a82ea7f7f3ced84392.zip
tk-d2393d8231eb7b15dd5a55a82ea7f7f3ced84392.tar.gz
tk-d2393d8231eb7b15dd5a55a82ea7f7f3ced84392.tar.bz2
Fix [587937fff]: Don't shuffle tag list sequence upon deletion. Add non regression tests canvas-20.[123]
Diffstat (limited to 'tests/canvas.test')
-rw-r--r--tests/canvas.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/canvas.test b/tests/canvas.test
index 2dcc48b..39643fe 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -952,6 +952,48 @@ test canvas-19.11 {rchars method - errors} -setup {
destroy .c
} -returnCodes error -result {bad index "foo"}
+test canvas-20.1 {addtag/dtag - no shuffling of tag sequence} -setup {
+ canvas .c
+ .c create text 100 100 -text Hello
+} -body {
+ for {set i 1} {$i < 5} {incr i} {
+ .c addtag tag$i all
+ }
+ # [.c addtags] only adds tags that are not already present
+ .c addtag tag1 all ; # no effect
+ set res [list [.c gettags 1]]
+ .c dtag 1 tag2
+ lappend res [.c gettags 1]
+} -cleanup {
+ destroy .c
+} -result {{tag1 tag2 tag3 tag4} {tag1 tag3 tag4}}
+test canvas-20.2 {tag deletion - multiple tags with same name, no shuffling} -setup {
+ canvas .c
+ .c create text 100 100 -text Hello
+} -body {
+ # [.c itemconfigure -tags] lets the user add duplicate tags
+ # this is not a problem although inconsistent with [.c addtags]
+ .c itemconfigure 1 -tags {tagA tagB tagA tagA tagC tagA}
+ set res [list [.c gettags 1]]
+ .c dtag 1 tagA
+ lappend res [.c gettags 1]
+} -cleanup {
+ destroy .c
+} -result {{tagA tagB tagA tagA tagC tagA} {tagB tagC}}
+test canvas-20.3 {tag deletion - all tags match} -setup {
+ canvas .c
+ .c create text 100 100 -text Hello
+} -body {
+ # [.c itemconfigure -tags] lets the user add duplicate tags
+ # this is not a problem although inconsistent with [.c addtags]
+ .c itemconfigure 1 -tags {tagA tagA tagA tagA tagA tagA}
+ set res [list [.c gettags 1]]
+ .c dtag 1 tagA
+ lappend res [.c gettags 1]
+} -cleanup {
+ destroy .c
+} -result {{tagA tagA tagA tagA tagA tagA} {}}
+
# Procedure used in test cases 20.1 20.2 20.3
proc matchPixels {pixels expected} {
set matched 1