From 71a164f01c882d7bfdc171be107e81e98806b780 Mon Sep 17 00:00:00 2001 From: krischan Date: Mon, 30 Dec 2002 21:42:19 +0000 Subject: Splitted the big huge test into 5 (not so) little pieces... --- tests/column.test | 433 ++++++++++++++ tests/item.test | 384 ++++++++++++ tests/notify.test | 376 ++++++++++++ tests/style.test | 189 ++++++ tests/treectrl.test | 1649 ++------------------------------------------------- 5 files changed, 1415 insertions(+), 1616 deletions(-) create mode 100644 tests/column.test create mode 100644 tests/item.test create mode 100644 tests/notify.test create mode 100644 tests/style.test diff --git a/tests/column.test b/tests/column.test new file mode 100644 index 0000000..efb3752 --- /dev/null +++ b/tests/column.test @@ -0,0 +1,433 @@ +# Commands covered: treectrl's widget command column +# +# This file contains a collection of tests for the column widget command of +# the tktreectrl extension. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 2000 by Scriptics Corporation. +# Copyright (c) 2002 by Christian Krone. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# CVS: @(#) $Id: column.test,v 1.1 2002/12/30 21:42:19 krischan Exp $ + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import ::tcltest::* +} + +package require Tk +package_require treectrl + +test column-0.1 {some needed preparations} -body { + pack [treectrl .t] +} -result {} + +test column-0.2 {create an image} -body { + image create photo emptyImg +} -result {emptyImg} + +test column-1.1 {missing args} -body { + .t column +} -returnCodes error -result {wrong # args: should be ".t column command ?arg arg...?"} + +test column-1.2 {unknown command} -body { + .t column foo +} -returnCodes error -result {bad command "foo": must be bbox, cget, configure, delete, index, move, neededwidth, or width} + +test column-1.3 {configure: no column exists with numerical index} -body { + .t column configure 0 +} -returnCodes error -result {bad column index "0": there are no columns} + +test column-1.4 {configure: no column exists with tag} -body { + .t column configure column0 +} -returnCodes error -result {column with tag "column0" doesn't exist} + +test column-1.5 {configure: create and fill a column} -body { + .t column configure 0 -tag column0 + .t element create e rect -width 482 + .t style create s + .t style elements s e + set i [.t item create] + .t item style set $i 0 s + .t item lastchild root $i +} -result {1} + +test column-1.6 {configure: create another column} -body { + .t column configure 1 -tag column1 +} -result {} + +test column-2.1 {column bbox: missing args} -body { + .t column bbox +} -returnCodes error -result {wrong # args: should be ".t column bbox column"} + +test column-2.2 {column bbox: invalid column} -body { + .t column bbox foo +} -returnCodes error -result {column with tag "foo" doesn't exist} + +test column-2.3 {column bbox: tree doesn't show headers} -body { + .t configure -showheader 0 + .t column bbox column0 +} -result {} + +test column-2.4 {column bbox} -body { + .t configure -showheader 1 + .t column bbox 0 +} -result {0 3 501 7} + +test column-2.5 {column bbox: tail column not allowed} -body { + .t column bbox tail +} -returnCodes error -result {can't specify "tail" for this command} + +test column-3.1 {column configure: missing args} -body { + .t column configure +} -returnCodes error -result {wrong # args: should be ".t column configure column ?option? ?value?"} + +test column-3.2 {column configure: invalid column} -body { + .t column configure foo +} -returnCodes error -result {column with tag "foo" doesn't exist} + +test column-3.3 {column configure: list all options} -body { + .t column configure column1 +} -result {{-arrow {} {} none none} {-arrowside {} {} right right} {-arrowgravity {} {} left left} {-arrowpade {} {} 6 6} {-arrowpadw {} {} 6 6} {-bitmap {} {} {} {}} {-background {} {} #d9d9d9 #d9d9d9} {-borderwidth {} {} 2 2} {-button {} {} 1 1} {-expand {} {} 0 0} {-font {} {} {} {}} {-image {} {} {} {}} {-imagepade {} {} 6 6} {-imagepadn {} {} 0 0} {-imagepads {} {} 0 0} {-imagepadw {} {} 6 6} {-itembackground {} {} {} {}} {-justify {} {} left left} {-minwidth {} {} {} {}} {-relief {} {} raised raised} {-stepwidth {} {} {} {}} {-sunken {} {} 0 0} {-tag {} {} {} column1} {-text {} {} {} {}} {-textcolor {} {} Black Black} {-textpade {} {} 6 6} {-textpadn {} {} 0 0} {-textpads {} {} 0 0} {-textpadw {} {} 6 6} {-width {} {} {} {}} {-visible {} {} 1 1} {-widthhack {} {} 0 0}} + +test column-3.4 {column configure: tail column} -body { + .t column configure tail +} -result {{-arrow {} {} none none} {-arrowside {} {} right right} {-arrowgravity {} {} left left} {-arrowpade {} {} 6 6} {-arrowpadw {} {} 6 6} {-bitmap {} {} {} {}} {-background {} {} #d9d9d9 #d9d9d9} {-borderwidth {} {} 2 2} {-button {} {} 1 1} {-expand {} {} 0 0} {-font {} {} {} {}} {-image {} {} {} {}} {-imagepade {} {} 6 6} {-imagepadn {} {} 0 0} {-imagepads {} {} 0 0} {-imagepadw {} {} 6 6} {-itembackground {} {} {} {}} {-justify {} {} left left} {-minwidth {} {} {} {}} {-relief {} {} raised raised} {-stepwidth {} {} {} {}} {-sunken {} {} 0 0} {-tag {} {} {} tail} {-text {} {} {} {}} {-textcolor {} {} Black Black} {-textpade {} {} 6 6} {-textpadn {} {} 0 0} {-textpads {} {} 0 0} {-textpadw {} {} 6 6} {-width {} {} {} {}} {-visible {} {} 1 1} {-widthhack {} {} 0 0}} + +test column-3.5 {column configure: invalid -arrow} -body { + .t column configure column1 -arrow straight +} -returnCodes error -result {bad arrow "straight": must be none, up, or down} + +test column-3.6 {column configure/cget: -arrow} -body { + .t column configure column1 -arrow up + .t column cget column1 -arrow +} -result {up} + +test column-3.7 {column configure: invalid -arrowside} -body { + .t column configure column1 -arrowside up +} -returnCodes error -result {bad arrowside "up": must be left or right} + +test column-3.8 {column configure/cget: -arrowside} -body { + .t column configure column1 -arrowside left + .t column cget column1 -arrowside +} -result {left} + +test column-3.9 {column configure: invalid -arrowgravity} -body { + .t column configure column1 -arrowgravity both +} -returnCodes error -result {bad arrowgravity "both": must be left or right} + +test column-3.10 {column configure/cget: -arrowgravity} -body { + .t column configure column1 -arrowgravity right + .t column cget column1 -arrowgravity +} -result {right} + +test column-3.11 {column configure: invalid -arrowpadw} -body { + .t column configure column1 -arrowpadw x +} -returnCodes error -result {bad screen distance "x"} + +test column-3.12 {column configure/cget: -arrowpadw/e} -body { + .t column configure column1 -arrowpadw 8 -arrowpade 5 + list [.t column cget column1 -arrowpadw] \ + [.t column cget column1 -arrowpade] +} -result {8 5} + +test column-3.13 {column configure: invalid -bitmap} -body { + .t column configure column1 -bitmap foo +} -returnCodes error -result {bitmap "foo" not defined} + +test column-3.14 {column configure/cget: -bitmap} -body { + .t column configure column1 -bitmap questhead + .t column cget column1 -bitmap +} -result {questhead} + +test column-3.15 {column configure: invalid -background} -body { + .t column configure column1 -background foo +} -returnCodes error -result {unknown color name "foo"} + +test column-3.16 {column configure/cget: -background} -body { + .t column configure column1 -background magenta + .t column cget column1 -background +} -result {magenta} + +test column-3.17 {column configure: invalid -borderwidth} -body { + .t column configure column1 -borderwidth x +} -returnCodes error -result {bad screen distance "x"} + +test column-3.18 {column configure/cget: -borderwidth} -body { + .t column configure column1 -borderwidth 4 + .t column cget column1 -borderwidth +} -result {4} + +test column-3.19 {column configure: invalid -button} -body { + .t column configure column1 -button "" +} -returnCodes error -result {expected boolean value but got ""} + +test column-3.20 {column configure/cget: -button} -body { + .t column configure column1 -button off + .t column cget column1 -button +} -result {0} + +test column-3.21 {column configure: invalid -expand} -body { + .t column configure column1 -expand ew +} -returnCodes error -result {expected boolean value but got "ew"} + +test column-3.22 {column configure/cget: -expand} -body { + .t column configure column1 -expand true + .t column cget column1 -expand +} -result {1} + +test column-3.23 {column configure: invalid -image} -body { + .t column configure column1 -image questhead +} -returnCodes error -result {image "questhead" doesn't exist} + +test column-3.24 {column configure/cget: -image} -body { + .t column configure column1 -image emptyImg + .t column cget column1 -image +} -result {emptyImg} + +test column-3.25 {column configure: invalid -imagepade} -body { + .t column configure column1 -imagepade y +} -returnCodes error -result {bad screen distance "y"} + +test column-3.26 {column configure/cget: -imagepadw/e} -body { + .t column configure column1 -imagepadw 9 -imagepade 4 + list [.t column cget column1 -imagepadw] \ + [.t column cget column1 -imagepade] +} -result {9 4} + +test column-3.27 {column configure: invalid -itembackground} -body { + .t column configure column1 -itembackground no +} -returnCodes error -result {unknown color name "no"} + +test column-3.28 {column configure/cget: simple -itembackground} -body { + .t column configure column1 -itembackground blue + .t column cget column1 -itembackground +} -result {blue} + +test column-3.29 {column configure: invalid -itembackground list} -body { + .t column configure column1 -itembackground {blue selected green active} +} -returnCodes error -result {unknown color name "selected"} + +test column-3.30 {column configure/cget: -itembackground list} -body { + .t column configure column1 -itembackground {blue green magenta red} + .t column cget column1 -itembackground +} -result {blue green magenta red} + +test column-3.31 {column configure: invalid -justify} -body { + .t column configure column1 -justify no +} -returnCodes error -result {bad justification "no": must be left, right, or center} + +test column-3.32 {column configure/cget: simple -justify} -body { + .t column configure column1 -justify center + .t column cget column1 -justify +} -result {center} + +test column-3.33 {column configure: invalid -minwidth} -body { + .t column configure column1 -minwidth z +} -returnCodes error -result {bad screen distance "z"} + +test column-3.34 {column configure/cget: -minwidth} -body { + .t column configure column1 -minwidth 25 + .t column cget column1 -minwidth +} -result {25} + +test column-3.35 {column configure: invalid -relief} -body { + .t column configure column1 -relief yes +} -returnCodes error -result {bad relief "yes": must be flat, groove, raised, ridge, solid, or sunken} + +test column-3.36 {column configure/cget: -relief} -body { + .t column configure column1 -relief sunken + .t column cget column1 -relief +} -result {sunken} + +test column-3.37 {column configure: invalid -stepwidth} -body { + .t column configure column1 -stepwidth "\t" +} -returnCodes error -result {bad screen distance " "} + +test column-3.38 {column configure/cget: -stepwidth} -body { + .t column configure column1 -stepwidth 125 + .t column cget column1 -stepwidth +} -result {125} + +test column-3.39 {column configure: invalid -sunken} -body { + .t column configure column1 -sunken groove +} -returnCodes error -result {expected boolean value but got "groove"} + +test column-3.40 {column configure/cget: -sunken} -body { + .t column configure column1 -sunken on + .t column cget column1 -sunken +} -result {1} + +test column-3.41 {column configure: -text} -body { + .t column configure column1 -text "Text above Column 1" + .t column cget column1 -text +} -result {Text above Column 1} + +test column-3.42 {column configure: invalid -textpadw} -body { + .t column configure column1 -textpadw baz +} -returnCodes error -result {bad screen distance "baz"} + +test column-3.43 {column configure/cget: -textpadw/e} -body { + .t column configure column1 -textpadw 8 -textpade 5 + list [.t column cget column1 -textpadw] \ + [.t column cget column1 -textpade] +} -result {8 5} + +test column-3.44 {column configure: invalid -width} -body { + .t column configure column1 -width all +} -returnCodes error -result {bad screen distance "all"} + +test column-3.45 {column configure/cget: -width} -body { + .t column configure column1 -width 250 + .t column cget column1 -width +} -result {250} + +test column-3.46 {column configure: invalid -visible} -body { + .t column configure column1 -visible never +} -returnCodes error -result {expected boolean value but got "never"} + +test column-3.47 {column configure/cget: -visible} -body { + .t column configure column1 -visible no + .t column cget column1 -visible +} -result {0} + +test column-3.48 {column configure: invalid -widthhack} -body { + .t column configure column1 -widthhack ok +} -returnCodes error -result {expected boolean value but got "ok"} + +test column-3.49 {column configure/cget: -widthhack} -body { + .t column configure column1 -widthhack yes + .t column cget column1 -widthhack +} -result {1} + +test column-4.1 {column configure: -tag} -body { + .t column configure column1 -tag column2 + .t column cget column1 -tag +} -returnCodes error -result {column with tag "column1" doesn't exist} + +test column-4.2 {column configure: -tag} -body { + .t column cget column2 -tag +} -result {column2} + +test column-4.3 {column cget: -tag of tail} -body { + .t column cget tail -tag +} -result {tail} + +test column-4.4 {column configure/cget: -tag of tail} -body { + .t column configure tail -tag head +} -returnCodes error -result {can't change tag of tail column} + +test column-4.5 {column cget: specify tail by its tag} -body { + .t column cget head -tag +} -returnCodes error -result {column with tag "head" doesn't exist} + +test column-5.1 {column delete: missing args} -body { + .t column delete +} -returnCodes error -result {wrong # args: should be ".t column delete column"} + +test column-5.2 {column delete: column tail} -body { + .t column delete tail +} -returnCodes error -result {can't specify "tail" for this command} + +test column-5.3 {column delete: first column} -body { + .t column delete 0 +} -result {} + +test column-5.4 {suprise, surprise: column 0 still exists} -body { + .t column cget 0 -tag +} -result {column2} + +test column-6.1 {column index: missing args} -body { + .t column index +} -returnCodes error -result {wrong # args: should be ".t column index column"} + +test column-6.2 {column index: the easy case} -body { + .t column index 0 +} -result {0} + +test column-6.3 {column index} -body { + .t column index column2 +} -result {0} + +test column-6.4 {column index: tail column} -body { + .t column index tail +} -result {1} + +test column-7.1 {column move: missing args} -body { + .t column move +} -returnCodes error -result {wrong # args: should be ".t column move column before"} + +test column-7.2 {column move: invalid column} -body { + .t column move 0 2 +} -returnCodes error -result {bad column index "2": must be from 0 to 0} + +test column-7.3 {column move: invalid column} -body { + .t column configure 1 -tag column1 + .t column configure 2 -tag column3 + .t column move 0 2 + .t column index column2 +} -result {1} + +test column-7.4 {correct moved?} -body { + set res {} + for {set x 0} {$x < [.t numcolumns]} {incr x} { + lappend res [.t column cget $x -tag] + } + set res +} -result {column1 column2 column3} + +test column-7.5 {column move: tail to the left} -body { + .t column move tail 0 +} -returnCodes error -result {can't specify "tail" for this command} + +test column-7.6 {column move: tail as before is ok} -body { + .t column move 0 tail + .t column index column1 +} -result {2} + +test column-8.1 {column width: missing args} -body { + .t column width +} -returnCodes error -result {wrong # args: should be ".t column width column"} + +test column-8.2 {column width: invalid column} -body { + .t column width foo +} -returnCodes error -result {column with tag "foo" doesn't exist} + +test column-8.3 {column width: tail column returns always 0} -body { + .t column width tail +} -result {0} + +test column-8.4 {column width} -body { + .t element create eText2 text -font {{courier -12}} -text "Hello World" + .t style create testStyle3 + .t style elements testStyle3 eText2 + .t item style set 1 column1 testStyle3 + update idletasks + list [.t column width column1] [font measure {courier -12} "Hello World"] +} -result {77 77} + +test column-9.1 {column neededwidth: missing args} -body { + .t column neededwidth +} -returnCodes error -result {wrong # args: should be ".t column neededwidth column"} + +test column-9.2 {column neededwidth: invalid column} -body { + .t column neededwidth foo +} -returnCodes error -result {column with tag "foo" doesn't exist} + +test column-9.3 {column neededwidth: tail column returns always 0} -body { + .t column neededwidth tail +} -result {0} + +test column-9.4 {column neededwidth} -body { + .t column neededwidth column1 +} -result {77} + +test column-99.1 {some needed cleanup} -body { + destroy .t +} -result {} + +# cleanup +::tcltest::cleanupTests +return diff --git a/tests/item.test b/tests/item.test new file mode 100644 index 0000000..b32f5c6 --- /dev/null +++ b/tests/item.test @@ -0,0 +1,384 @@ +# Commands covered: treectrl's widget command item +# +# This file contains a collection of tests for the item widget command of +# the tktreectrl extension. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 2000 by Scriptics Corporation. +# Copyright (c) 2002 by Christian Krone. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# CVS: @(#) $Id: item.test,v 1.1 2002/12/30 21:42:21 krischan Exp $ + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import ::tcltest::* +} + +package require Tk +package_require treectrl + +test item-0.1 {some needed preparations} -body { + pack [treectrl .t] +} -result {} + +test item-1.1 {item: missing command} -body { + .t item +} -returnCodes error -result {wrong # args: should be ".t item command ?arg arg...?"} + +test item-2.2 {item: invalid command} -body { + .t item foo +} -returnCodes error -result {bad command "foo": must be ancestors, children, create, delete, firstchild, lastchild, nextsibling, numchildren, parent, prevsibling, remove, bbox, complex, dump, element, hasbutton, index, isancestor, isopen, rnc, sort, state, style, text, or visible} + +test item-2.3 {item create: too many args} -body { + .t item create foo +} -returnCodes error -result {wrong # args: should be ".t item create"} + +# Before continuing to test the item descriptions and their modifiers, +# lets create some items with this hierarchy: +# 0 +# + 1 +# | + 2 +# | + 3 +# | + 4 +# + 5 +# | + 6 +# | + 7 +# + 8 +test item-2.4 {create some items} -body { + set n1 [.t item create]; .t item lastchild 0 $n1 + set n2 [.t item create]; .t item lastchild $n1 $n2 + set n3 [.t item create]; .t item lastchild $n1 $n3 + set n4 [.t item create]; .t item lastchild $n3 $n4 + set n5 [.t item create]; .t item lastchild 0 $n5 + set n6 [.t item create]; .t item lastchild $n5 $n6 + set n7 [.t item create]; .t item lastchild $n5 $n7 + set n8 [.t item create]; .t item lastchild 0 $n8 +} -result {8} + +test item-2.5 {some more preparations} -body { + .t state define state0 + .t element create eBorder border + .t element create eImage image + .t element create eRect rect + .t element create eText text -fill red + .t style create testStyle + .t style elements testStyle {eText eBorder} +} -result {} + +test tree-2.6 {item create} -body { + list [.t item create] [.t item create] [.t item create] +} -result {9 10 11} + +test tree-3.1 {item delete: missing itemDesc} -body { + .t item delete +} -returnCodes error -result {wrong # args: should be ".t item delete first ?last?"} + +test tree-3.2 {item delete: unknown item} -body { + .t item delete 999 +} -returnCodes error -result {item "999" doesn't exist} + +test tree-3.3 {item delete: one item} -body { + .t item delete 9 +} -result {} + +test tree-3.4 {item delete: item range without common ancestor} -body { + .t item delete 10 11 +} -returnCodes error -result {item 10 and item 11 don't share a common ancestor} + +test tree-3.5 {item delete: item range without common ancestor} -body { + .t item lastchild 8 10 + .t item lastchild 8 11 + .t item delete 10 11 +} -result {} + +test tree-3.6 {item delete: don't delete "root" itemDesc} -body { + .t item delete root + .t index root +} -result {0} + +test tree-3.7 {item delete: deleting root should be ignored} -body { + .t item delete [.t index root] + update idletasks +} -result {} + +test tree-4.1 {item ancestors: no ancestor yet} -body { + .t item create + .t item ancestors 12 +} -result {} + +test tree-4.2 {item ancestors} -body { + .t item lastchild 7 12 + .t item ancestors 12 +} -result {7 5 0} + +test tree-5.1 {item children: no children} -body { + .t item children 12 +} -result {} + +test tree-5.2 {item children} -body { + .t item children 0 +} -result {1 5 8} + +test tree-6.1 {item firstchild: missing itemDesc} -body { + .t item firstchild +} -returnCodes error -result {wrong # args: should be ".t item firstchild item ?newFirstChild?"} + +test tree-6.2 {item firstchild: no children} -body { + .t item firstchild 12 +} -result {} + +test tree-6.3 {item firstchild} -body { + .t item firstchild 1 +} -result {2} + +test tree-7.1 {item lastchild: no children} -body { + .t item lastchild 1 +} -result {3} + +test tree-8.1 {item nextsibling: no sibling} -body { + .t item nextsibling 12 +} -result {} + +test tree-8.2 {item nextsibling: no sibling} -body { + .t item nextsibling 2 +} -result {3} + +test tree-9.1 {item numchildren: no children} -body { + .t item numchildren 12 +} -result {0} + +test tree-9.2 {item numchildren} -body { + .t item numchildren 1 +} -result {2} + +test tree-10.1 {item parent: no parent} -body { + .t item parent root +} -result {} + +test tree-10.2 {item parent} -body { + .t item parent "root firstchild" +} -result {0} + +test tree-11.1 {item prevsibling: missing arg} -body { + .t item prevsibling +} -returnCodes error -result {wrong # args: should be ".t item prevsibling item ?newPrevSibling?"} + +test tree-11.2 {item prevsibling: no prevsibling} -body { + .t item prevsibling 1 +} -result {} + +test tree-11.3 {item prevsibling} -body { + .t item prevsibling 3 +} -result {2} + +test tree-12.1 {item remove: invalid item} -body { + .t item remove 999 +} -returnCodes error -result {item "999" doesn't exist} + +test tree-12.2 {item remove} -body { + .t item remove 12 +} -result {} + +test tree-13.1 {item complex: missing args} -body { + .t item complex 8 +} -returnCodes error -result {wrong # args: should be ".t item complex item list..."} + +test tree-13.2 {item complex: only allowed if column style is defined} -body { + .t item complex 8 {{e1 -text Hallo}} +} -returnCodes error -result {item 8 doesn't have column 0} + +test tree-13.3 {item complex: invalid list} -body { + .t item style set 8 0 testStyle + .t item complex 8 {{e1 -text}} +} -returnCodes error -result {wrong # args: should be "element option value..."} + +test tree-13.4 {item complex: element name not defined in style} -body { + .t item complex 8 {{e1 -text Hallo}} +} -returnCodes error -result {element "e1" doesn't exist} + +test tree-13.5 {item complex: option not known in element} -body { + .t item complex 8 {{eText -bitmap questhead}} +} -returnCodes error -result {unknown option "-bitmap"} + +test tree-13.6 {item complex: invalid option value in element} -body { + .t item complex 8 {{eText -fill foo}} +} -returnCodes error -result {unknown color name "foo"} + +test tree-14.1 {item element: missing command} -body { + .t item element +} -returnCodes error -result {wrong # args: should be ".t item element command item column element ?arg ...?"} + +test tree-14.2 {item element: invalid command} -body { + .t item element foo 8 0 eText +} -returnCodes error -result {bad command "foo": must be actual, cget, or configure} + +test tree-14.3 {item element actual: missing arg} -body { + .t item element actual 8 0 eText +} -returnCodes error -result {wrong # args: should be ".t item element actual item column element option"} + +test tree-14.4 {item element actual} -body { + .t item element actual 8 0 eText -fill +} -result {red} + +test tree-14.5 {item element cget: missing arg} -body { + .t item element cget 8 0 eText +} -returnCodes error -result {wrong # args: should be ".t item element cget item column element option"} + +test tree-14.6 {item element cget} -body { + .t item element cget 8 0 eText -fill +} -result {} + +test tree-14.7 {item element configure} -body { + .t item element configure 8 0 eText +} -result {{-data {} {} {} {}} {-datatype {} {} {} {}} {-format {} {} {} {}} {-fill {} {} {} {}} {-font {} {} {} {}} {-justify {} {} {} {}} {-lines {} {} {} {}} {-text {} {} {} {}} {-width {} {} {} {}} {-wrap {} {} {} {}}} + +test tree-14.8 {item element configure/cget} -body { + .t item element configure 8 0 eText -fill yellow + .t item element cget 8 0 eText -fill +} -result {yellow} + +test tree-14.9 {item element configure} -body { + .t item element configure 8 0 eText -fill +} -result {-fill {} {} {} yellow} + +test tree-15.1 {item style: missing args} -body { + .t item style +} -returnCodes error -result {wrong # args: should be ".t item style command item ?arg ...?"} + +test tree-15.2 {item style: invalid command} -body { + .t item style foo bar +} -returnCodes error -result {bad command "foo": must be elements, map, or set} + +test tree-15.3 {item style: invalid command} -body { + .t item style foo bar +} -returnCodes error -result {bad command "foo": must be elements, map, or set} + +test tree-15.4 {item style elements: missing args} -body { + .t item style elements 8 +} -returnCodes error -result {wrong # args: should be ".t item style elements item column"} + +test tree-15.5 {item style elements: invalid item} -body { + .t item style elements 999 +} -returnCodes error -result {item "999" doesn't exist} + +test tree-15.6 {item style elements: item without style} -body { + .t item style elements 1 0 +} -returnCodes error -result {item 1 doesn't have column 0} + +test tree-15.7 {item style elements} -body { + .t item style elements 8 0 +} -result {eText} + +test tree-15.8 {item style map: missing args} -body { + .t item style map 8 +} -returnCodes error -result {wrong # args: should be ".t item style map item column style map"} + +test tree-15.9 {item style map: invalid item} -body { + .t item style map 999 +} -returnCodes error -result {item "999" doesn't exist} + +test tree-15.10 {item style map: item with unknown style} -body { + .t item style map 1 0 noStyle {foo bar} +} -returnCodes error -result {style "noStyle" doesn't exist} + +test tree-15.11 {item style map: odd elemented list} -body { + .t item style map 8 0 testStyle foo + .t item style elements 8 0 +} -returnCodes error -result {list must contain even number of elements} + +test tree-15.12 {item style map: unknown element} -body { + .t style create testStyle2 + .t item style map 8 0 testStyle2 {eText foo} + .t item style elements 8 0 +} -returnCodes error -result {element "foo" doesn't exist} + +test tree-15.13 {item style map: element not in to-style} -body { + .t item style map 8 0 testStyle2 {eText eRect} +} -returnCodes error -result {style testStyle2 does not use element eRect} + +test tree-15.14 {item style map: element not in from-style} -body { + # .t style elements testStyle2 {eImage eRect} + .t item style map 8 0 testStyle2 {eRect eBorder} +} -returnCodes error -result {style testStyle does not use element eRect} + +test tree-15.15 {item style map: different element types} -body { + .t style elements testStyle2 {eImage eRect} + .t item style map 8 0 testStyle2 {eBorder eRect} +} -returnCodes error -result {can't map element type border to rect} + +test tree-15.16 {item style set: invalid item} -body { + .t item style set foo bar +} -returnCodes error -result {bad item description "foo"} + +test tree-15.17 {item style set: without args returns all styles} -body { + .t item style set 2 +} -result {} + +test tree-15.18 {item style set: without args returns style} -body { + .t item style set 2 0 +} -returnCodes error -result {item 2 doesn't have column 0} + +test tree-15.19 {item style set: without args returns style} -body { + .t item style set 8 0 +} -result {testStyle} + +test tree-15.20 {item style set} -body { + .t item style set 8 0 testStyle2 + .t item style set 8 +} -result {testStyle2} + +test tree-16.1 {item state: missing args} -body { + .t item state +} -returnCodes error -result {wrong # args: should be ".t item state item ?state ...?"} + +test tree-16.2 {item state: unknown item} -body { + .t item state 999 +} -returnCodes error -result {item "999" doesn't exist} + +test tree-16.3 {item state: list all set states} -body { + .t item state 8 +} -result {open enabled} + +test tree-16.4 {item state: try to reset predefined state} -body { + .t item state 8 !open +} -returnCodes error -result {cannot change state "!open"} + +test tree-16.5 {item state: unknown states} -body { + .t item state 8 foo bar +} -returnCodes error -result {cannot change state "foo"} + +test tree-16.6 {item state: switch on states} -body { + .t item state 8 state0 + .t item state 8 +} -result {open enabled state0} + +test tree-16.7 {item state: switch off states} -body { + .t item state 8 !state0 + .t item state 8 +} -result {open enabled} + +test tree-16.8 {item state: reset predefined state} -body { + .t collapse 8 + .t item state 8 +} -result {enabled} + +test tree-16.9 {item state: reset predefined state} -body { + .t expand 8 + .t item state 8 +} -result {open enabled} + +test tree-16.10 {item state: reset predefined state} -body { + .t toggle 8 + .t item state 8 +} -result {enabled} + +test item-99.1 {some needed cleanup} -body { + destroy .t +} -result {} + +# cleanup +::tcltest::cleanupTests +return diff --git a/tests/notify.test b/tests/notify.test new file mode 100644 index 0000000..7070f53 --- /dev/null +++ b/tests/notify.test @@ -0,0 +1,376 @@ +# Commands covered: treectrl's widget command notify +# +# This file contains a collection of tests for the notify widget command of +# the tktreectrl extension. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 2000 by Scriptics Corporation. +# Copyright (c) 2002 by Christian Krone. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# CVS: @(#) $Id: notify.test,v 1.1 2002/12/30 21:42:22 krischan Exp $ + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import ::tcltest::* +} + +package require Tk +package_require treectrl + +test notify-0.1 {some needed preparations} -body { + treectrl .t +} -result {.t} + +test notify-1.1 {notify: missing args} -body { + .t notify +} -returnCodes error -result {wrong # args: should be ".t notify command ?arg arg...?"} + +test notify-1.2 {notify: unknown command} -body { + .t notify foo +} -returnCodes error -result {bad command "foo": must be bind, configure, detailnames, eventnames, generate, install, linkage, or uninstall} + +test notify-2.1 {notify eventnames: too much args} -body { + .t notify eventnames Open +} -returnCodes error -result {wrong # args: should be ".t notify eventnames"} + +test notify-2.2 {notify eventnames: nothing own installed yet} -body { + lsort [.t notify eventnames] +} -result {ActiveItem Collapse Expand Scroll Selection} + +test notify-2.3 {notify install: missing args} -body { + .t notify install +} -returnCodes error -result {wrong # args: should be ".t notify install option arg ..."} + +test notify-2.4 {notify install: unknown command} -body { + .t notify install foo +} -returnCodes error -result {bad option "foo": must be detail or event} + +test notify-2.5 {notify install event: missing args} -body { + .t notify install event +} -returnCodes error -result {wrong # args: should be ".t notify install event name ?percentsCommand?"} + +test notify-2.6 {notify install event: too much args} -body { + .t notify install event foo bar baz +} -returnCodes error -result {wrong # args: should be ".t notify install event name ?percentsCommand?"} + +test notify-2.7 {notify install event} -body { + .t notify install event Greetings + .t notify install event GoodBye +} -result {} + +test notify-2.8 {notify eventnames: list Greetings} -body { + lsort [.t notify eventnames] +} -result {ActiveItem Collapse Expand GoodBye Greetings Scroll Selection} + +test notify-2.9 {notify detailnames: missing args} -body { + .t notify detailnames +} -returnCodes error -result {wrong # args: should be ".t notify detailnames eventName"} + +test notify-2.10 {notify detailnames: too many args} -body { + .t notify detailnames foo bar +} -returnCodes error -result {wrong # args: should be ".t notify detailnames eventName"} + +test notify-2.11 {notify detailnames: unknown event} -body { + .t notify detailnames Hello +} -returnCodes error -result {unknown event "Hello"} + +test notify-2.12 {notify detailnames: no details yet} -body { + .t notify detailnames Greetings +} -result {} + +test notify-2.13 {notify install detail: missing args} -body { + .t notify install detail +} -returnCodes error -result {wrong # args: should be ".t notify install detail event detail ?percentsCommand?"} + +test notify-2.14 {notify install detail: unknown event} -body { + .t notify install detail Hello GoodBye +} -returnCodes error -result {unknown event "Hello"} + +test notify-2.15 {notify install detail} -body { + .t notify install detail Greetings Wrote + .t notify install detail Greetings Sent +} -result {} + +test notify-2.16 {notify detailnames} -body { + lsort [.t notify detailnames Greetings] +} -result {Sent Wrote} + +test notify-3.1 {notify linkage: missing args} -body { + .t notify linkage +} -returnCodes error -result {wrong # args: should be ".t notify linkage event ?detail?"} + +test notify-3.2 {notify linkage: unknown event} -body { + .t notify linkage foo +} -returnCodes error -result {unknown event "foo"} + +test notify-3.3 {notify linkage: standard event} -body { + .t notify linkage Scroll +} -result {static} + +test notify-3.4 {notify linkage: self made event} -body { + .t notify linkage Greetings +} -result {dynamic} + +test notify-3.5 {notify linkage: unknown detail} -body { + .t notify linkage Greetings foo +} -returnCodes error -result {unknown detail "foo" for event "Greetings"} + +test notify-3.6 {notify linkage: standard event} -body { + .t notify linkage Scroll x +} -result {static} + +test notify-3.7 {notify linkage: self made event} -body { + .t notify linkage Greetings Sent +} -result {dynamic} + +test notify-4.1 {notify bind: too much args} -body { + .t notify bind z y z z y +} -returnCodes error -result {wrong # args: should be ".t notify bind ?object? ?pattern? ?script?"} + +test notify-4.2 {notify bind: nothing bound yet} -body { + .t notify bind .t +} -result {} + +test notify-4.3 {notify bind: invalid pattern} -body { + .t notify bind .t Greetings +} -returnCodes error -result {missing "<" in event pattern "Greetings"} + +test notify-4.4 {notify bind: unknown event} -body { + .t notify bind .t +} -returnCodes error -result {unknown event "Hello"} + +test notify-4.5 {notify bind: unknown detail} -body { + .t notify bind .t +} -returnCodes error -result {unknown detail "Prepare" for event "Greetings"} + +test notify-4.6 {notify bind: nothing yet for simple event} -body { + .t notify bind .t +} -result {} + +test notify-4.7 {notify bind: simple event} -body { + .t notify bind .t {puts -nonewline "Bye bye"} +} -result {} + +test notify-4.8 {notify bind: simple event, script added} -body { + .t notify bind .t {+puts ""} +} -result {} + +test notify-4.9 {notify bind: simple event defined} -body { + .t notify bind .t +} -result {puts -nonewline "Bye bye" +puts ""} + +test notify-4.10 {notify bind: nothing yet for event with detail} -body { + .t notify bind .t +} -result {} + +test notify-4.11 {notify bind: event with detail} -body { + .t notify bind .t {puts -nonewline "Hello World"} + .t notify bind .t {puts ""} +} -result {} + +test notify-4.12 {notify bind: event with detail defined} -body { + .t notify bind .t +} -result {puts ""} + +test notify-4.13 {notify bind without pattern} -body { + lsort [.t notify bind .t] +} -result { } + +test notify-5.1 {notify configure: missing args} -body { + .t notify configure +} -returnCodes error -result {wrong # args: should be ".t notify configure object pattern ?option? ?value? ?option value ...?"} + +test notify-5.2 {notify configure: unknown event} -body { + .t notify configure .t +} -returnCodes error -result {unknown event "Hello"} + +test notify-5.3 {notify configure: unknown event with detail} -body { + .t notify configure .t +} -returnCodes error -result {unknown event "Hello"} + +test notify-5.4 {notify configure: unbound event} -body { + .t notify configure .t +} -result {} + +test notify-5.5 {notify configure: unbound event with details} -body { + .t notify configure .t +} -result {} + +test notify-5.6 {notify configure: dynamic event} -body { + .t notify configure .t +} -result {-active 1} + +test notify-5.7 {notify configure: dynamic event} -body { + .t notify configure .t -active 0 + .t notify configure .t +} -result {-active 0} + +test notify-6.1 {notify generate: missing args} -body { + .t notify generate +} -returnCodes error -result {wrong # args: should be ".t notify generate pattern ?field value ...?"} + +test notify-6.2 {notify generate: invalid event} -body { + .t notify generate Greetings +} -returnCodes error -result {missing "<" in event pattern "Greetings"} + +test notify-6.3 {notify generate: virtual event} -body { + .t notify generate <> +} -returnCodes error -result {unknown event ""} + +test notify-6.4 {notify generate: unknown event} -body { + .t notify generate +} -returnCodes error -result {unknown event "Hello"} + +test notify-6.5 {notify generate: unknown detail} -body { + .t notify generate +} -returnCodes error -result {unknown detail "Prepare" for event "Greetings"} + +test notify-6.6 {notify generate: missing detail} -body { + .t notify generate +} -returnCodes error -result {cannot generate "": missing detail} + +test notify-6.7 {notify generate: NOW!} -body { + .t notify generate +} -output {Hello World} + +test notify-6.8 {notify generate: not active} -body { + .t notify generate +} -result {} + +test notify-6.9 {notify generate: and AGAIN!} -body { + .t notify configure .t -active 1 + .t notify generate +} -output { +} + +test notify-6.10 {notify generate: invalid percent char} -body { + .t notify generate -foo bar +} -returnCodes error -result {invalid percent char "-foo"} + +test notify-6.11 {notify generate: odd number of field args} -body { + .t notify generate -f +} -returnCodes error -result {wrong # args: should be ".t notify pattern ?field value ...?"} + +test notify-6.12 {notify generate: huge number of field args} -body { + set command [list .t notify generate ] + for {set x 1} {$x < 2048} {incr x} { + lappend command -f $x + } + eval $command +} -output { +} + +test notify-6.13 {notify generate: not so much field args} -body { + .t notify generate \ + -0 a -1 b -2 c -3 d -4 e -5 f -6 g -7 h -8 i -9 j -X x +} -output { +} + +test notify-6.14 {notify install/bind/generate: do some replacements} -body { + .t notify install event Percent + .t notify install detail Percent Test + .t notify bind .t \ + {puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"} + .t notify generate -2 to -b be -~ not -| or +} -output {%W: to be or not to be%} + +proc doMyOwnSubst {field window eventName detail args} { + return [string map {2 TO b BE ~ NOT | OR} $field] +} + +test notify-6.15 {notify install/bind/generate: my own replacements} -body { + .t notify uninstall detail Percent Test + .t notify install detail Percent Test doMyOwnSubst + .t notify bind .t \ + {puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"} + .t notify generate +} -output {%W: TO BE OR NOT TO BE%} + +test notify-6.16 {notify install/bind/generate: standard replacements} -body { + .t notify generate -2 to -b be -~ not -| or +} -output {%W: TO BE OR NOT TO BE%} + +test notify-6.17 {notify install/bind/generate: my own replacements} -body { + .t notify uninstall detail Percent Test + .t notify uninstall event Percent + .t notify install event Percent doMyOwnSubst + .t notify bind .t \ + {puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"} + .t notify generate +} -output {%W: TO BE OR NOT TO BE%} + +test notify-6.18 {notify install/bind/generate: standard replacements} -body { + .t notify generate -2 to -b be -~ not -| or +} -output {%W: TO BE OR NOT TO BE%} + +test notify-7.1 {notify uninstall: missing args} -body { + .t notify uninstall +} -returnCodes error -result {wrong # args: should be ".t notify uninstall option arg ..."} + +test notify-7.2 {notify uninstall: unknown command} -body { + .t notify uninstall foo +} -returnCodes error -result {bad option "foo": must be detail or event} + +test notify-7.3 {notify uninstall detail: missing args} -body { + .t notify uninstall detail +} -returnCodes error -result {wrong # args: should be ".t notify uninstall detail event detail"} + +test notify-7.4 {notify uninstall detail: too much args} -body { + .t notify uninstall detail foo bar baz +} -returnCodes error -result {wrong # args: should be ".t notify uninstall detail event detail"} + +test notify-7.5 {notify uninstall detail: unknown event} -body { + .t notify uninstall detail foo bar +} -returnCodes error -result {unknown event "foo"} + +test notify-7.6 {notify uninstall detail: unknown detail} -body { + .t notify uninstall detail Greetings GoodBye +} -returnCodes error -result {unknown detail "GoodBye" for event "Greetings"} + +test notify-7.7 {notify uninstall detail} -body { + .t notify uninstall detail Greetings Sent +} -result {} + +test notify-7.8 {notify uninstall detail: double check} -body { + lsearch -exact [.t notify detailnames Greetings] Sent +} -result {-1} + +test notify-7.9 {notify uninstall detail: delete a static detail} -body { + .t notify uninstall detail Scroll x +} -returnCodes error -result {can't uninstall static detail "x"} + +test notify-7.10 {notify uninstall event: missing args} -body { + .t notify uninstall event +} -returnCodes error -result {wrong # args: should be ".t notify uninstall event name"} + +test notify-7.11 {notify uninstall event: too much args} -body { + .t notify uninstall event foo bar +} -returnCodes error -result {wrong # args: should be ".t notify uninstall event name"} + +test notify-7.12 {notify uninstall event: unknown event} -body { + .t notify uninstall event foo +} -returnCodes error -result {unknown event "foo"} + +test notify-7.13 {notify uninstall event} -body { + .t notify uninstall event Greetings +} -result {} + +test notify-7.14 {notify uninstall event: double check} -body { + lsearch -exact [.t notify eventnames] Greetings +} -result {-1} + +test notify-7.15 {notify uninstall event: delete a static event} -body { + .t notify uninstall event Scroll +} -returnCodes error -result {can't uninstall static event "Scroll"} + +test notify-99.1 {some needed cleanup} -body { + destroy .t +} -result {} + +# cleanup +::tcltest::cleanupTests +return diff --git a/tests/style.test b/tests/style.test new file mode 100644 index 0000000..f6c0482 --- /dev/null +++ b/tests/style.test @@ -0,0 +1,189 @@ +# Commands covered: treectrl's widget command style +# +# This file contains a collection of tests for the style widget command of +# the tktreectrl extension. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 2000 by Scriptics Corporation. +# Copyright (c) 2002 by Christian Krone. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# CVS: @(#) $Id: style.test,v 1.1 2002/12/30 21:42:22 krischan Exp $ + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import ::tcltest::* +} + +package require Tk +package_require treectrl + +test style-0.1 {some needed preparations} -body { + pack [treectrl .t] +} -result {} + +test style-0.1 {some other preparations} -body { + .t element create eBorder border + .t element create eText text + .t element create eImage image + .t element create eRect rect + list +} -result {} + +test style-1.1 {style: missing args} -body { + .t style +} -returnCodes error -result {wrong # args: should be ".t style command ?arg arg...?"} + +test style-1.2 {style: invalid command} -body { + .t style foo +} -returnCodes error -result {bad command "foo": must be cget, configure, create, delete, elements, layout, or names} + +test style-1.3 {style names: no style exists yet} -body { + .t style names +} -result {} + +test style-2.1 {style create: missing args} -body { + .t style create +} -returnCodes error -result {wrong # args: should be ".t style create name ?option value...?"} + +test style-2.2 {style create: invalid option} -body { + .t style create testStyle -foo bar +} -returnCodes error -result {unknown option "-foo"} + +test style-2.3 {style create} -body { + .t style create testStyle +} -result {testStyle} + +test style-2.4 {style create: already existing style} -body { + .t style create testStyle +} -returnCodes error -result {style "testStyle" already exists} + +test style-3.1 {style configure: invalid option} -body { + .t style configure testStyle -foo bar +} -returnCodes error -result {unknown option "-foo"} + +test style-3.2 {style configure: all options} -body { + .t style configure testStyle +} -result {{-orient {} {} horizontal horizontal}} + +test style-3.3 {style configure: the only option} -body { + .t style configure testStyle -orient +} -result {-orient {} {} horizontal horizontal} + +test style-3.4 {style configure: invalid option -orient} -body { + .t style configure testStyle -orient diagonal +} -returnCodes error -result {bad orient "diagonal": must be horizontal or vertical} + +test style-3.5 {style configure/cget: option -orient} -body { + .t style configure testStyle -orient vertical + .t style cget testStyle -orient +} -result {vertical} + +test style-4.1 {style delete: unknown style} -body { + .t style delete testStyle2 +} -returnCodes error -result {style "testStyle2" doesn't exist} + +test style-4.2 {style delete: unknown style} -body { + .t style names +} -result {testStyle} + +test style-4.3 {style delete} -body { + .t style delete testStyle +} -result {} + +test style-4.4 {style names: no style defined} -body { + .t style names +} -result {} + +test style-5.1 {style elements: missing args} -body { + .t style elements +} -returnCodes error -result {wrong # args: should be ".t style elements name ?element element...?"} + +test style-5.2 {style elements: unknown style} -body { + .t style elements testStyle +} -returnCodes error -result {style "testStyle" doesn't exist} + +test style-5.3 {style elements: no element yet} -body { + .t style create testStyle + .t style elements testStyle +} -result {} + +test style-5.4 {style elements: empty element list} -body { + .t style elements testStyle {} +} -result {} + +test style-5.5 {style elements: add some elements} -body { + .t style elements testStyle {eBorder eImage eText} + .t style elements testStyle +} -result {eBorder eImage eText} + +test style-6.1 {style layout: missing args} -body { + .t style layout +} -returnCodes error -result {wrong # args: should be ".t style layout name element ?option? ?value? ?option value ...?"} + +test style-6.2 {style layout: no options specified} -body { + .t style layout testStyle eText +} -result {-padw 0 -padn 0 -pade 0 -pads 0 -ipadw 0 -ipadn 0 -ipade 0 -ipads 0 -expand {} -iexpand {} -detach no -squeeze {} -union {}} + +test style-6.3 {style layout: option -pads} -body { + .t style layout testStyle eText -pads 3 + .t style layout testStyle eText -pads +} -result {3} + +test style-6.4 {style layout: option -expand} -body { + .t style layout testStyle eText -expand "hello world" +} -returnCodes error -result {bad expand value "hello world": must be a string containing zero or more of n, e, s, and w} + +test style-6.5 {style layout: option -expand} -body { + .t style layout testStyle eText -expand ew + .t style layout testStyle eText -expand +} -result {we} + +test style-6.6 {style layout: option -squeeze} -body { + .t style layout testStyle eText -squeeze xyzzy +} -returnCodes error -result {bad squeeze value "xyzzy": must be a string containing zero or more of x and y} + +test style-6.7 {style layout: option -squeeze} -body { + .t style layout testStyle eText -squeeze xy + .t style layout testStyle eText -squeeze +} -result {xy} + +test style-6.8 {style layout: option -union invalid list} -body { + .t style layout testStyle eText -union "\{" +} -returnCodes error -result {unmatched open brace in list} + +test style-6.9 {style layout: option -union unknown elements} -body { + .t style layout testStyle eText -union {foo bar} +} -returnCodes error -result {element "foo" doesn't exist} + +test style-6.10 {style layout: option -union element not in style} -body { + .t style layout testStyle eText -union {eBorder eRect} +} -returnCodes error -result {style testStyle does not use element eRect} + +test style-6.11 {style layout: option -union with itself} -body { + .t style layout testStyle eText -union {eBorder eText} +} -returnCodes error -result {element eText can't form union with itself} + +test style-6.12 {style layout: option -union} -body { + .t style layout testStyle eText -union {eBorder eImage} + .t style layout testStyle eText -union +} -result {eBorder eImage} + +test style-6.13 {style layout: option invalid -detach} -body { + .t style layout testStyle eText -detach {x y} +} -returnCodes error -result {expected boolean value but got "x y"} + +test style-6.14 {style layout: option -detach} -body { + .t style layout testStyle eText -detach true + .t style layout testStyle eText -detach +} -result {1} + +test style-99.1 {some needed cleanup} -body { + destroy .t +} -result {} + +# cleanup +::tcltest::cleanupTests +return diff --git a/tests/treectrl.test b/tests/treectrl.test index c95c94a..a7032e1 100644 --- a/tests/treectrl.test +++ b/tests/treectrl.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: treectrl.test,v 1.14 2002/12/30 17:29:54 krischan Exp $ +# RCS: @(#) $Id: treectrl.test,v 1.15 2002/12/30 21:42:22 krischan Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -18,32 +18,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { } package require Tk -# This works only, if tktreectrl is already installed: -# package require treectrl -# And we want to test the currently built version anyway. -# So we better load and source it by hand: -set thisPlatform $tcl_platform(platform) -if {![catch {tk windowingsystem} windowingSystem] \ - && [string equal aqua $windowingSystem]} { - set thisPlatform macosx -} -switch -- $thisPlatform { - macintosh { - load treectrl.shlb - } - macosx { - load build/treectrl.dylib - } - unix { - load [glob libtreectrl*[info sharedlibextension]] - } - default { # Windows - load Build/treectrl[info sharedlibextension] - } -} - -source [file join library treectrl.tcl] -source [file join library filelist-bindings.tcl] +package_require treectrl test tree-1.1 {Usage} -body { treectrl @@ -265,7 +240,7 @@ test tree-1.48 {configure: -treecolumn option with unknown column} -body { test tree-1.49 {configure: -treecolumn option with known column} -body { .t column configure 0 -tag column0 - .t column configure 1 -tag column1 + .t column configure 1 -tag column2 .t configure -treecolumn 1 .t configure -treecolumn } -result {-treecolumn treeColumn TreeColumn 0 1} @@ -543,558 +518,6 @@ test tree-2.37 {modifier cocktail} -body { set res } -result {8 8 1 5 4 3 2 1 5 7 8} -test tree-3.1 {element: missing op} -body { - .t element -} -returnCodes error -result {wrong # args: should be ".t element command ?arg arg...?"} - -test tree-3.2 {element create: missing argument} -body { - .t element create -} -returnCodes error -result {wrong # args: should be ".t element create name type ?option value...?"} - -test tree-3.3 {element create: unknown type} -body { - .t element create foo bar -} -returnCodes error -result {unknown element type "bar"} - -test tree-3.4 {element create: a bitmap} -body { - .t element create eBitmap bitmap -} -result {eBitmap} - -test tree-3.5 {element configure: for a bitmap} -body { - .t element configure eBitmap -} -result {{-background {} {} {} {}} {-bitmap {} {} {} {}} {-foreground {} {} {} {}}} - -test tree-3.6 {element configure: bitmap invalid -background} -body { - .t element configure eBitmap -background blur -} -returnCodes error -result {unknown color name "blur"} - -test tree-3.7 {element configure/cget: bitmap -background} -body { - .t element configure eBitmap -background blue - .t element cget eBitmap -background -} -result {blue} - -test tree-3.8 {element configure: bitmap invalid psd -background} -body { - .t element configure eBitmap -background {blue !selected blur {}} -} -returnCodes error -result {unknown color name "blur"} - -test tree-3.9 {element configure/cget: bitmap psd -background} -body { - .t element configure eBitmap -background {blue open magenta {}} - .t element cget eBitmap -background -} -result {blue open magenta {}} - -test tree-3.10 {element configure/cget: bitmap invalid -bitmap} -body { - .t element configure eBitmap -bitmap notExists -} -returnCodes error -result {bitmap "notExists" not defined} - -test tree-3.11 {element configure/cget: bitmap -bitmap} -body { - .t element configure eBitmap -bitmap questhead - .t element cget eBitmap -bitmap -} -result {questhead} - -test tree-3.12 {element configure: bitmap invalid psd -bitmap} -body { - .t element configure eBitmap -bitmap {questhead selected yep {}} -} -returnCodes error -result {bitmap "yep" not defined} - -test tree-3.13 {element configure/cget: bitmap psd -background} -body { - .t element configure eBitmap -bitmap {questhead !open error {}} - .t element cget eBitmap -bitmap -} -result {questhead !open error {}} - -test tree-3.14 {element configure: bitmap invalid -foreground} -body { - .t element configure eBitmap -foreground foobar -} -returnCodes error -result {unknown color name "foobar"} - -test tree-3.15 {element configure/cget: bitmap -foreground} -body { - .t element configure eBitmap -foreground yellow - .t element cget eBitmap -foreground -} -result {yellow} - -test tree-3.16 {element configure: bitmap invalid psd -foreground} -body { - .t element configure eBitmap -foreground {blue ! red {}} -} -returnCodes error -result {unknown state ""} - -test tree-3.17 {element configure/cget: bitmap psd -foreground} -body { - .t element configure eBitmap -foreground {blue open red !selected} - .t element cget eBitmap -foreground -} -result {blue open red !selected} - -test tree-3.18 {element create: a border} -body { - .t element create eBorder border -} -result {eBorder} - -test tree-3.19 {element configure: for a border} -body { - .t element configure eBorder -} -result {{-background {} {} {} {}} {-filled {} {} {} {}} {-height {} {} {} {}} {-relief {} {} {} {}} {-thickness {} {} {} {}} {-width {} {} {} {}}} - -test tree-3.20 {element configure: border invalid -background} -body { - .t element configure eBorder -background # -} -returnCodes error -result {invalid color name "#"} - -test tree-3.21 {element configure/cget: border -background} -body { - .t element configure eBorder -background #010101 - .t element cget eBorder -background -} -result {#010101} - -test tree-3.22 {element configure: border invalid psd -background} -body { - .t element configure eBorder -background {blue active red !} -} -returnCodes error -result {unknown state ""} - -test tree-3.23 {element configure/cget: border psd -background} -body { - .t element configure eBorder -background {blue !open red selected} - .t element cget eBorder -background -} -result {blue !open red selected} - -test tree-3.24 {element configure: border invalid -filled} -body { - .t element configure eBorder -filled foo -} -returnCodes error -result {expected boolean value but got "foo"} - -test tree-3.25 {element configure/cget: border -filled} -body { - .t element configure eBorder -filled 1 - .t element cget eBorder -filled -} -result {1} - -test tree-3.26 {element configure: border invalid -height} -body { - .t element configure eBorder -height {200 300} -} -returnCodes error -result {bad screen distance "200 300"} - -test tree-3.27 {element configure/cget: border -height} -body { - .t element configure eBorder -height 200 - .t element cget eBorder -height -} -result {200} - -test tree-3.28 {element configure: border invalid -relief} -body { - .t element configure eBorder -relief groovy -} -returnCodes error -result {bad relief "groovy": must be flat, groove, raised, ridge, solid, or sunken} - -test tree-3.29 {element configure/cget: border -relief} -body { - .t element configure eBorder -relief ridge - .t element cget eBorder -relief -} -result {ridge} - -test tree-3.30 {element configure: border invalid psd -relief} -body { - .t element configure eBorder -relief {groove open ridge} -} -returnCodes error -result {list must have even number of elements} - -test tree-3.31 {element configure/cget: border psd -relief} -body { - .t element configure eBorder -relief {groove !open ridge {}} - .t element cget eBorder -relief -} -result {groove !open ridge {}} - -test tree-3.32 {element configure: border invalid -thickness} -body { - .t element configure eBorder -thickness jup -} -returnCodes error -result {bad screen distance "jup"} - -test tree-3.33 {element configure/cget: border -thickness} -body { - .t element configure eBorder -thickness 8 - .t element cget eBorder -thickness -} -result {8} - -test tree-3.34 {element configure: border invalid -width} -body { - .t element configure eBorder -width {300 200} -} -returnCodes error -result {bad screen distance "300 200"} - -test tree-3.35 {element configure/cget: border -width} -body { - .t element configure eBorder -width 300 - .t element cget eBorder -width -} -result {300} - -test tree-3.36 {element create: an image} -body { - .t element create eImage image -} -result {eImage} - -test tree-3.37 {element configure: for an image} -body { - .t element configure eImage -} -result {{-height {} {} {} {}} {-image {} {} {} {}} {-width {} {} {} {}}} - -test tree-3.38 {element configure: image invalid -height} -body { - .t element configure eImage -height {101 open 200 {}} -} -returnCodes error -result {bad screen distance "101 open 200 {}"} - -test tree-3.39 {element configure/cget: image -height} -body { - .t element configure eImage -height 101 - .t element cget eImage -height -} -result {101} - -test tree-3.40 {element configure: image unknown -image} -body { - .t element configure eImage -image foo -} -returnCodes error -result {image "foo" doesn't exist} - -test tree-3.41 {element configure/cget: image -image} -body { - .t element configure eImage -image emptyImg - .t element cget eImage -image -} -result {emptyImg} - -test tree-3.42 {element configure: image invalid psd -image} -body { - .t element configure eImage -image {emptyImg open dirImg} -} -returnCodes error -result {list must have even number of elements} - -test tree-3.43 {element configure/cget: image psd -image} -body { - .t element configure eImage -image {emptyImg {}} - .t element cget eImage -image -} -result {emptyImg {}} - -test tree-3.44 {element configure: image invalid -width} -body { - .t element configure eImage -width {202 boo} -} -returnCodes error -result {bad screen distance "202 boo"} - -test tree-3.45 {element configure/cget: image -width} -body { - .t element configure eImage -width 202 - .t element cget eImage -width -} -result {202} - -test tree-3.46 {element create: a rectangle} -body { - .t element create eRect rect -} -result {eRect} - -test tree-3.47 {element configure: for a rectangle} -body { - .t element configure eRect -} -result {{-fill {} {} {} {}} {-height {} {} {} {}} {-open {} {} {} {}} {-outline {} {} {} {}} {-outlinewidth {} {} {} {}} {-showfocus {} {} {} {}} {-width {} {} {} {}}} - -test tree-3.48 {element configure: rectangle invalid -fill} -body { - .t element configure eRect -fill baz -} -returnCodes error -result {unknown color name "baz"} - -test tree-3.49 {element configure/cget: rectangle -fill} -body { - .t element configure eRect -fill blue - .t element cget eRect -fill -} -result {blue} - -test tree-3.50 {element configure: rectangle invalid psd -fill} -body { - .t element configure eRect -fill {red blue yellow green} -} -returnCodes error -result {unknown state "blue"} - -test tree-3.51 {element configure/cget: rectangle psd -fill} -body { - .t element configure eRect -fill {red open blue {}} - .t element cget eRect -fill -} -result {red open blue {}} - -test tree-3.52 {element configure: rectangle invalid -height} -body { - .t element configure eRect -height 100b -} -returnCodes error -result {bad screen distance "100b"} - -test tree-3.53 {element configure/cget: rectangle -height} -body { - .t element configure eRect -height 200 - .t element cget eRect -height -} -result {200} - -test tree-3.54 {element configure: rectangle invalid -open} -body { - .t element configure eRect -open now -} -returnCodes error -result {bad open value "now": must be a string containing zero or more of n, e, s, and w} - -test tree-3.55 {element configure/cget: rectangle -open} -body { - .t element configure eRect -open n - .t element cget eRect -open -} -result {n} - -test tree-3.56 {element configure: rectangle invalid -outline} -body { - .t element configure eRect -outline baz -} -returnCodes error -result {unknown color name "baz"} - -test tree-3.57 {element configure/cget: rectangle -outline} -body { - .t element configure eRect -outline blue - .t element cget eRect -outline -} -result {blue} - -test tree-3.58 {element configure: rectangle invalid psd -outline} -body { - .t element configure eRect -outline {red blue yellow green} -} -returnCodes error -result {unknown state "blue"} - -test tree-3.59 {element configure/cget: rectangle psd -outline} -body { - .t element configure eRect -outline {red {} blue open} - .t element cget eRect -outline -} -result {red {} blue open} - -test tree-3.60 {element configure: rectangle invalid -outlinewidth} -body { - .t element configure eRect -outlinewidth baz -} -returnCodes error -result {bad screen distance "baz"} - -test tree-3.61 {element configure/cget: rectangle -outlinewidth} -body { - .t element configure eRect -outlinewidth 1c - .t element cget eRect -outlinewidth -} -result {1c} - -test tree-3.62 {element configure: rectangle invalid -showfocus} -body { - .t element configure eRect -showfocus baz -} -returnCodes error -result {expected boolean value but got "baz"} - -test tree-3.63 {element configure/cget: rectangle -showfocus} -body { - .t element configure eRect -showfocus 1 - .t element cget eRect -showfocus -} -result {1} - -test tree-3.64 {element configure: rectangle invalid -width} -body { - .t element configure eRect -width baz -} -returnCodes error -result {bad screen distance "baz"} - -test tree-3.65 {element configure/cget: rectangle -width} -body { - .t element configure eRect -width 10c - .t element cget eRect -width -} -result {10c} - -test tree-3.66 {element create: a text} -body { - .t element create eText text -} -result {eText} - -test tree-3.67 {element configure: for a text} -body { - .t element configure eText -} -result {{-data {} {} {} {}} {-datatype {} {} {} {}} {-format {} {} {} {}} {-fill {} {} {} {}} {-font {} {} {} {}} {-justify {} {} {} {}} {-lines {} {} {} {}} {-text {} {} {} {}} {-width {} {} {} {}} {-wrap {} {} {} {}}} - -test tree-3.68 {element configure/cget: text -data} -body { - .t element configure eText -data "1.23456789" - .t element cget eText -data -} -result {1.23456789} - -test tree-3.69 {element configure: text invalid -datatype} -body { - .t element configure eText -datatype float -} -returnCodes error -result {bad datatype "float": must be double, integer, long, string, or time} - -test tree-3.70 {element configure/cget: text -datatype} -body { - .t element configure eText -datatype double - .t element cget eText -datatype -} -result {double} - -test tree-3.71 {element configure: text invalid -fill} -body { - .t element configure eText -fill baz -} -returnCodes error -result {unknown color name "baz"} - -test tree-3.72 {element configure/cget: text -fill} -body { - .t element configure eText -fill blue - .t element cget eText -fill -} -result {blue} - -test tree-3.73 {element configure: text invalid psd -fill} -body { - .t element configure eText -fill {red blue yellow green} -} -returnCodes error -result {unknown state "blue"} - -test tree-3.74 {element configure/cget: text psd -fill} -body { - .t element configure eText -fill {red open blue {}} - .t element cget eText -fill -} -result {red open blue {}} - -test tree-3.75 {element configure/cget: text -format} -body { - .t element configure eText -format "The value of the double is a secret" - .t element cget eText -format -} -result {The value of the double is a secret} - -test tree-3.76 {element configure: text invalid -font} -body { - # Invalid font doesn't generate an error... - .t element configure eText -font {"Australia 12"} - .t element cget eText -font -} -result {"Australia 12"} - -test tree-3.77 {element configure/cget: text -font} -body { - .t element configure eText -font {"Helvetica 12"} - .t element cget eText -font -} -result {"Helvetica 12"} - -test tree-3.78 {element configure: text invalid psd -font} -body { - .t element configure eText -font {"Australia 12" opened} -} -returnCodes error -result {unknown state "opened"} - -test tree-3.79 {element configure/cget: text -font} -body { - .t element configure eText -font {"Helvetica 12" open "Times 18" {}} - .t element cget eText -font -} -result {"Helvetica 12" open "Times 18" {}} - -test tree-3.80 {element configure: text invalid -justify} -body { - .t element configure eText -justify north -} -returnCodes error -result {bad justification "north": must be left, right, or center} - -test tree-3.81 {element configure/cget: text -justify} -body { - .t element configure eText -justify center - .t element cget eText -justify -} -result {center} - -test tree-3.82 {element configure: text invalid -lines} -body { - .t element configure eText -lines asap -} -returnCodes error -result {expected integer but got "asap"} - -test tree-3.83 {element configure/cget: text -lines} -body { - .t element configure eText -lines 5 - .t element cget eText -lines -} -result {5} - -test tree-3.84 {element configure/cget: text -text} -body { - .t element configure eText -text "Hallo Welt" - .t element cget eText -text -} -result {Hallo Welt} - -test tree-3.85 {element configure: text invalid -wrap} -body { - .t element configure eText -wrap none -} -returnCodes error -result {bad wrap "none": must be char or word} - -test tree-3.86 {element configure/cget: text -wrap} -body { - .t element configure eText -wrap char - .t element cget eText -wrap -} -result {char} - -test tree-3.87 {element types} -body { - set res {} - foreach e {eBitmap eBorder eImage eRect eText} { - lappend res [.t element type $e] - } - set res -} -result {bitmap border image rect text} - -test tree-3.88 {element names} -body { - lsort [.t element names] -} -result {eBitmap eBorder eImage eRect eText} - -test tree-3.89 {element delete with something unknown in middle} -body { - .t element delete eBitmap eNotExist eBorder -} -returnCodes error -result {element "eNotExist" doesn't exist} - -test tree-3.90 {element names} -body { - lsort [.t element names] -} -result {eBorder eImage eRect eText} - -test tree-4.1 {style: missing args} -body { - .t style -} -returnCodes error -result {wrong # args: should be ".t style command ?arg arg...?"} - -test tree-4.2 {style: invalid command} -body { - .t style foo -} -returnCodes error -result {bad command "foo": must be cget, configure, create, delete, elements, layout, or names} - -test tree-4.3 {style names: no style exists yet} -body { - .t style names -} -result {} - -test tree-4.4 {style create: missing args} -body { - .t style create -} -returnCodes error -result {wrong # args: should be ".t style create name ?option value...?"} - -test tree-4.5 {style create: invalid option} -body { - .t style create testStyle -foo bar -} -returnCodes error -result {unknown option "-foo"} - -test tree-4.6 {style create} -body { - .t style create testStyle -} -result {testStyle} - -test tree-4.7 {style create: already existing style} -body { - .t style create testStyle -} -returnCodes error -result {style "testStyle" already exists} - -test tree-4.8 {style configure: invalid option} -body { - .t style configure testStyle -foo bar -} -returnCodes error -result {unknown option "-foo"} - -test tree-4.9 {style configure: all options} -body { - .t style configure testStyle -} -result {{-orient {} {} horizontal horizontal}} - -test tree-4.10 {style configure: the only option} -body { - .t style configure testStyle -orient -} -result {-orient {} {} horizontal horizontal} - -test tree-4.11 {style configure: invalid option -orient} -body { - .t style configure testStyle -orient diagonal -} -returnCodes error -result {bad orient "diagonal": must be horizontal or vertical} - -test tree-4.12 {style configure/cget: option -orient} -body { - .t style configure testStyle -orient vertical - .t style cget testStyle -orient -} -result {vertical} - -test tree-4.13 {style delete: unknown style} -body { - .t style delete testStyle2 -} -returnCodes error -result {style "testStyle2" doesn't exist} - -test tree-4.14 {style delete: unknown style} -body { - .t style names -} -result {testStyle} - -test tree-4.15 {style delete} -body { - .t style delete testStyle -} -result {} - -test tree-4.16 {style names: no style defined} -body { - .t style names -} -result {} - -test tree-4.17 {style elements: missing args} -body { - .t style elements -} -returnCodes error -result {wrong # args: should be ".t style elements name ?element element...?"} - -test tree-4.18 {style elements: unknown style} -body { - .t style elements testStyle -} -returnCodes error -result {style "testStyle" doesn't exist} - -test tree-4.19 {style elements: no element yet} -body { - .t style create testStyle - .t style elements testStyle -} -result {} - -test tree-4.20 {style elements: empty element list} -body { - .t style elements testStyle {} -} -result {} - -test tree-4.21 {style elements: add some elements} -body { - .t style elements testStyle {eBorder eImage eText} - .t style elements testStyle -} -result {eBorder eImage eText} - -test tree-4.22 {style layout: missing args} -body { - .t style layout -} -returnCodes error -result {wrong # args: should be ".t style layout name element ?option? ?value? ?option value ...?"} - -test tree-4.23 {style layout: no options specified} -body { - .t style layout testStyle eText -} -result {-padw 0 -padn 0 -pade 0 -pads 0 -ipadw 0 -ipadn 0 -ipade 0 -ipads 0 -expand {} -iexpand {} -detach no -squeeze {} -union {}} - -test tree-4.24 {style layout: option -pads} -body { - .t style layout testStyle eText -pads 3 - .t style layout testStyle eText -pads -} -result {3} - -test tree-4.25 {style layout: option -expand} -body { - .t style layout testStyle eText -expand "hello world" -} -returnCodes error -result {bad expand value "hello world": must be a string containing zero or more of n, e, s, and w} - -test tree-4.25a {style layout: option -expand} -body { - .t style layout testStyle eText -expand ew - .t style layout testStyle eText -expand -} -result {we} - -test tree-4.26 {style layout: option -squeeze} -body { - .t style layout testStyle eText -squeeze xyzzy -} -returnCodes error -result {bad squeeze value "xyzzy": must be a string containing zero or more of x and y} - -test tree-4.26a {style layout: option -squeeze} -body { - .t style layout testStyle eText -squeeze xy - .t style layout testStyle eText -squeeze -} -result {xy} - -test tree-4.27 {style layout: option -union invalid list} -body { - .t style layout testStyle eText -union "\{" -} -returnCodes error -result {unmatched open brace in list} - -test tree-4.28 {style layout: option -union unknown elements} -body { - .t style layout testStyle eText -union {foo bar} -} -returnCodes error -result {element "foo" doesn't exist} - -test tree-4.29 {style layout: option -union element not in style} -body { - .t style layout testStyle eText -union {eBorder eRect} -} -returnCodes error -result {style testStyle does not use element eRect} - -test tree-4.30 {style layout: option -union with itself} -body { - .t style layout testStyle eText -union {eBorder eText} -} -returnCodes error -result {element eText can't form union with itself} - -test tree-4.31 {style layout: option -union} -body { - .t style layout testStyle eText -union {eBorder eImage} - .t style layout testStyle eText -union -} -result {eBorder eImage} - -test tree-4.32 {style layout: option invalid -detach} -body { - .t style layout testStyle eText -detach {x y} -} -returnCodes error -result {expected boolean value but got "x y"} - -test tree-4.33 {style layout: option -detach} -body { - .t style layout testStyle eText -detach true - .t style layout testStyle eText -detach -} -result {1} - test tree-5.1 {state: missing args} -body { .t state } -returnCodes error -result {wrong # args: should be ".t state command ?arg arg...?"} @@ -1145,324 +568,15 @@ test tree-5.10 {state undefine} -body { .t state names } -result {state0} -test tree-6.1 {item: missing command} -body { - .t item -} -returnCodes error -result {wrong # args: should be ".t item command ?arg arg...?"} - -test tree-6.2 {item: invalid command} -body { - .t item foo -} -returnCodes error -result {bad command "foo": must be ancestors, children, create, delete, firstchild, lastchild, nextsibling, numchildren, parent, prevsibling, remove, bbox, complex, dump, element, hasbutton, index, isancestor, isopen, rnc, sort, state, style, text, or visible} - -test tree-6.3 {item create: too many args} -body { - .t item create foo -} -returnCodes error -result {wrong # args: should be ".t item create"} - -test tree-6.4 {item create} -body { - list [.t item create] [.t item create] [.t item create] -} -result {9 10 11} - -test tree-6.5 {item delete: missing itemDesc} -body { - .t item delete -} -returnCodes error -result {wrong # args: should be ".t item delete first ?last?"} - -test tree-6.6 {item delete: unknown item} -body { - .t item delete 999 -} -returnCodes error -result {item "999" doesn't exist} - -test tree-6.7 {item delete: one item} -body { - .t item delete 9 -} -result {} - -test tree-6.8 {item delete: item range without common ancestor} -body { - .t item delete 10 11 -} -returnCodes error -result {item 10 and item 11 don't share a common ancestor} - -test tree-6.9 {item delete: item range without common ancestor} -body { - .t item lastchild 8 10 - .t item lastchild 8 11 - .t item delete 10 11 -} -result {} - -test tree-6.9a {item delete: don't delete "root" itemDesc} -body { - .t item delete root - .t index root -} -result {0} - -test tree-6.9b {item delete: deleting root should be ignored} -body { - .t item delete [.t index root] - update idletasks -} -result {} - -test tree-6.10 {item ancestors: no ancestor yet} -body { - .t item create - .t item ancestors 12 -} -result {} - -test tree-6.11 {item ancestors} -body { - .t item lastchild 7 12 - .t item ancestors 12 -} -result {7 5 0} - -test tree-6.12 {item children: no children} -body { - .t item children 12 -} -result {} - -test tree-6.13 {item children} -body { - .t item children 0 -} -result {1 5 8} - -test tree-6.14 {item firstchild: missing itemDesc} -body { - .t item firstchild -} -returnCodes error -result {wrong # args: should be ".t item firstchild item ?newFirstChild?"} - -test tree-6.15 {item firstchild: no children} -body { - .t item firstchild 12 -} -result {} - -test tree-6.16 {item firstchild} -body { - .t item firstchild 1 -} -result {2} - -test tree-6.17 {item lastchild: no children} -body { - .t item lastchild 1 -} -result {3} - -test tree-6.18 {item nextsibling: no sibling} -body { - .t item nextsibling 12 -} -result {} - -test tree-6.19 {item nextsibling: no sibling} -body { - .t item nextsibling 2 -} -result {3} - -test tree-6.20 {item numchildren: no children} -body { - .t item numchildren 12 -} -result {0} - -test tree-6.21 {item numchildren} -body { - .t item numchildren 1 -} -result {2} - -test tree-6.22 {item parent: no parent} -body { - .t item parent root -} -result {} - -test tree-6.23 {item parent} -body { - .t item parent "root firstchild" -} -result {0} - -test tree-6.24 {item prevsibling: missing arg} -body { - .t item prevsibling -} -returnCodes error -result {wrong # args: should be ".t item prevsibling item ?newPrevSibling?"} - -test tree-6.25 {item prevsibling: no prevsibling} -body { - .t item prevsibling 1 -} -result {} - -test tree-6.26 {item prevsibling} -body { - .t item prevsibling 3 -} -result {2} - -test tree-6.27 {item remove: invalid item} -body { - .t item remove 999 -} -returnCodes error -result {item "999" doesn't exist} - -test tree-6.28 {item remove} -body { - .t item remove 12 -} -result {} - -test tree-6.29 {item complex: missing args} -body { - .t item complex 8 -} -returnCodes error -result {wrong # args: should be ".t item complex item list..."} - -test tree-6.30 {item complex: only allowed if column style is defined} -body { - .t item complex 8 {{e1 -text Hallo}} -} -returnCodes error -result {item 8 doesn't have column 0} - -test tree-6.31 {item complex: invalid list} -body { - .t item style set 8 0 testStyle - .t item complex 8 {{e1 -text}} -} -returnCodes error -result {wrong # args: should be "element option value..."} - -test tree-6.32 {item complex: element name not defined in style} -body { - .t item complex 8 {{e1 -text Hallo}} -} -returnCodes error -result {element "e1" doesn't exist} - -test tree-6.33 {item complex: option not known in element} -body { - .t item complex 8 {{eText -bitmap questhead}} -} -returnCodes error -result {unknown option "-bitmap"} - -test tree-6.34 {item complex: invalid option value in element} -body { - .t item complex 8 {{eText -fill foo}} -} -returnCodes error -result {unknown color name "foo"} - -test tree-6.35 {item element: missing command} -body { - .t item element -} -returnCodes error -result {wrong # args: should be ".t item element command item column element ?arg ...?"} - -test tree-6.36 {item element: invalid command} -body { - .t item element foo 8 0 eText -} -returnCodes error -result {bad command "foo": must be actual, cget, or configure} - -test tree-6.37 {item element actual: missing arg} -body { - .t item element actual 8 0 eText -} -returnCodes error -result {wrong # args: should be ".t item element actual item column element option"} - -test tree-6.38 {item element actual} -body { - .t item element actual 8 0 eText -fill -} -result {red} - -test tree-6.39 {item element cget: missing arg} -body { - .t item element cget 8 0 eText -} -returnCodes error -result {wrong # args: should be ".t item element cget item column element option"} - -test tree-6.40 {item element cget} -body { - .t item element cget 8 0 eText -fill -} -result {} - -test tree-6.41 {item element configure} -body { - .t item element configure 8 0 eText -} -result {{-data {} {} {} {}} {-datatype {} {} {} {}} {-format {} {} {} {}} {-fill {} {} {} {}} {-font {} {} {} {}} {-justify {} {} {} {}} {-lines {} {} {} {}} {-text {} {} {} {}} {-width {} {} {} {}} {-wrap {} {} {} {}}} - -test tree-6.42 {item element configure/cget} -body { - .t item element configure 8 0 eText -fill yellow - .t item element cget 8 0 eText -fill -} -result {yellow} - -test tree-6.43 {item element configure} -body { - .t item element configure 8 0 eText -fill -} -result {-fill {} {} {} yellow} - -test tree-6.44 {item style: missing args} -body { - .t item style -} -returnCodes error -result {wrong # args: should be ".t item style command item ?arg ...?"} - -test tree-6.45 {item style: invalid command} -body { - .t item style foo bar -} -returnCodes error -result {bad command "foo": must be elements, map, or set} - -test tree-6.45 {item style: invalid command} -body { - .t item style foo bar -} -returnCodes error -result {bad command "foo": must be elements, map, or set} - -test tree-6.46 {item style elements: missing args} -body { - .t item style elements 8 -} -returnCodes error -result {wrong # args: should be ".t item style elements item column"} - -test tree-6.47 {item style elements: invalid item} -body { - .t item style elements 999 -} -returnCodes error -result {item "999" doesn't exist} - -test tree-6.48 {item style elements: item without style} -body { - .t item style elements 1 0 -} -returnCodes error -result {item 1 doesn't have column 0} - -test tree-6.49 {item style elements} -body { - .t item style elements 8 0 -} -result {eText} - -test tree-6.50 {item style map: missing args} -body { - .t item style map 8 -} -returnCodes error -result {wrong # args: should be ".t item style map item column style map"} - -test tree-6.51 {item style map: invalid item} -body { - .t item style map 999 -} -returnCodes error -result {item "999" doesn't exist} - -test tree-6.52 {item style map: item with unknown style} -body { - .t item style map 1 0 noStyle {foo bar} -} -returnCodes error -result {style "noStyle" doesn't exist} - -test tree-6.53 {item style map: odd elemented list} -body { - .t item style map 8 0 testStyle foo - .t item style elements 8 0 -} -returnCodes error -result {list must contain even number of elements} - -test tree-6.54 {item style map: unknown element} -body { +test tree-7.0 {some prerequisites for the marquee test} -body { + .t element create eImage image -width 202 + .t element create eRect rect -width 10c .t style create testStyle2 - .t item style map 8 0 testStyle2 {eText foo} - .t item style elements 8 0 -} -returnCodes error -result {element "foo" doesn't exist} - -test tree-6.55 {item style map: element not in to-style} -body { - .t item style map 8 0 testStyle2 {eText eRect} -} -returnCodes error -result {style testStyle2 does not use element eRect} - -test tree-6.56 {item style map: element not in from-style} -body { - # .t style elements testStyle2 {eImage eRect} - .t item style map 8 0 testStyle2 {eRect eBorder} -} -returnCodes error -result {style testStyle does not use element eRect} - -test tree-6.57 {item style map: different element types} -body { .t style elements testStyle2 {eImage eRect} - .t item style map 8 0 testStyle2 {eBorder eRect} -} -returnCodes error -result {can't map element type border to rect} - -test tree-6.58 {item style set: invalid item} -body { - .t item style set foo bar -} -returnCodes error -result {bad item description "foo"} - -test tree-6.59 {item style set: without args returns all styles} -body { .t item style set 2 -} -result {} - -test tree-6.60 {item style set: without args returns style} -body { - .t item style set 2 0 -} -returnCodes error -result {item 2 doesn't have column 0} - -test tree-6.61 {item style set: without args returns style} -body { - .t item style set 8 0 -} -result {testStyle} - -test tree-6.62 {item style set} -body { .t item style set 8 0 testStyle2 - .t item style set 8 -} -result {testStyle2} - -test tree-6.63 {item state: missing args} -body { - .t item state -} -returnCodes error -result {wrong # args: should be ".t item state item ?state ...?"} - -test tree-6.64 {item state: unknown item} -body { - .t item state 999 -} -returnCodes error -result {item "999" doesn't exist} - -test tree-6.65 {item state: list all set states} -body { - .t item state 8 -} -result {open enabled} - -test tree-6.66 {item state: try to reset predefined state} -body { - .t item state 8 !open -} -returnCodes error -result {cannot change state "!open"} - -test tree-6.67 {item state: unknown states} -body { - .t item state 8 foo bar -} -returnCodes error -result {cannot change state "foo"} - -test tree-6.68 {item state: switch on states} -body { - .t item state 8 state0 - .t item state 8 -} -result {open enabled state0} - -test tree-6.69 {item state: switch off states} -body { - .t item state 8 !state0 - .t item state 8 -} -result {open enabled} - -test tree-6.70 {item state: reset predefined state} -body { - .t collapse 8 - .t item state 8 -} -result {enabled} - -test tree-6.71 {item state: reset predefined state} -body { - .t expand 8 - .t item state 8 -} -result {open enabled} - -test tree-6.72 {item state: reset predefined state} -body { - .t toggle 8 - .t item state 8 -} -result {enabled} + update idletasks +} -result {} test tree-7.1 {marquee: missing args} -body { .t marquee @@ -1503,9 +617,16 @@ test tree-7.9 {marquee corner: set it} -body { test tree-7.10 {marquee identify} -body { .t marquee identify -} -result {0 {1 0} 2 3 4 5 6 7 {8 {0 eRect eImage}}} +} -result {0 1 2 3 4 5 6 7 {8 {0 eRect eImage}}} + +test tree-7.11 {marquee identify: after invalid item style map} -constraints knownBug -body { + # BUG ALERT: After this buggy statement, "marquee identify" returns a + # different result! I suspect, that this one is invalid... + catch {.t item style map 1 0 noStyle {foo bar}} + .t marquee identify +} -result {0 1 2 3 4 5 6 7 {8 {0 eRect eImage}}} -test tree-7.11 {marquee visible} -body { +test tree-7.12 {marquee visible} -body { list [.t marquee configure -visible] \ [.t marquee visible 1] \ [.t marquee cget -visible] \ @@ -1542,19 +663,19 @@ test tree-8.6 {selection count/get: still nothing selected} -body { test tree-8.7 {selection add: all children of an item} -body { .t selection add "1 firstchild" "1 lastchild" - list [.t selection count] [.t selection get] + list [.t selection count] [lsort -integer [.t selection get]] } -result {2 {2 3}} test tree-8.8 {selection add: all items and then some} -body { .t selection add all "1 lastchild" - list [.t selection count] [.t selection get] -} -result {10 {0 1 2 3 4 5 6 7 8 12}} + list [.t selection count] [lsort -integer [.t selection get]] +} -result {9 {0 1 2 3 4 5 6 7 8}} test tree-8.9 {selection clear} -body { .t selection add all .t selection clear "root firstchild" - list [.t selection count] [.t selection get] -} -result {9 {0 2 3 4 5 6 7 8 12}} + list [.t selection count] [lsort -integer [.t selection get]] +} -result {8 {0 2 3 4 5 6 7 8}} test tree-8.10 {selection clear: some items and then all} -body { .t selection clear "root lastchild" all @@ -1563,17 +684,17 @@ test tree-8.10 {selection clear: some items and then all} -body { test tree-8.11 {selection modify: to be or not to be?} -body { .t selection modify all all - list [.t selection count] [.t selection get] -} -result {10 {0 1 2 3 4 5 6 7 8 12}} + list [.t selection count] [lsort -integer [.t selection get]] +} -result {9 {0 1 2 3 4 5 6 7 8}} test tree-8.12 {selection clear: totally empty} -body { .t selection clear - list [.t selection count] [.t selection get] + list [.t selection count] [lsort -integer [.t selection get]] } -result {0 {}} test tree-8.12 {selection modify: to be or not to be?} -body { .t selection modify {{root firstchild} {root lastchild}} {{root lastchild}} - list [.t selection count] [.t selection get] + list [.t selection count] [lsort -integer [.t selection get]] } -result {2 {1 8}} test tree-8.13 {selection includes: missing args} -body { @@ -1628,12 +749,13 @@ test tree-11.1 {orphans: too many args} -body { .t orphans foo } -returnCodes error -result {wrong # args: should be ".t orphans"} -test tree-11.2 {orphans: 12 from above} -body { +test tree-11.2 {orphans: lets make one} -body { + .t item remove 8 .t orphans -} -result {12} +} -result {8} test tree-11.3 {orphans: no orphans} -body { - .t item lastchild 0 12 + .t item lastchild 0 8 .t orphans } -result {} @@ -1643,7 +765,7 @@ test tree-12.1 {numitems: too many args} -body { test tree-12.2 {numitems} -body { .t numitems -} -result {10} +} -result {9} test tree-12.3 {numitems: simple double check with range} -body { expr {[.t numitems] == [llength [.t range first last]]} @@ -1701,379 +823,17 @@ test tree-13.5 {depth of the tree} -body { foreach i $rootKids {.t item lastchild root $i} } -result {0} -test tree-14.1 {column: missing args} -body { - .t column -} -returnCodes error -result {wrong # args: should be ".t column command ?arg arg...?"} - -test tree-14.2 {column: unknown command} -body { - .t column foo -} -returnCodes error -result {bad command "foo": must be bbox, cget, configure, delete, index, move, neededwidth, or width} - -test tree-14.3 {column bbox: missing args} -body { - .t column bbox -} -returnCodes error -result {wrong # args: should be ".t column bbox column"} - -test tree-14.4 {column bbox: invalid column} -body { - .t column bbox foo -} -returnCodes error -result {column with tag "foo" doesn't exist} - -test tree-14.5 {column bbox: tree doesn't show headers} -body { - .t configure -showheader 0 - .t column bbox column0 -} -result {} - -test tree-14.6 {column bbox} -body { - .t configure -showheader 1 - .t column bbox 0 -} -result {3 3 501 7} - -test tree-14.7 {column bbox: tail column not allowed} -body { - .t column bbox tail -} -returnCodes error -result {can't specify "tail" for this command} - -test tree-14.8 {column configure: missing args} -body { - .t column configure -} -returnCodes error -result {wrong # args: should be ".t column configure column ?option? ?value?"} - -test tree-14.9 {column configure: invalid column} -body { - .t column configure foo -} -returnCodes error -result {column with tag "foo" doesn't exist} - -test tree-14.10 {column configure: list all options} -body { - .t column configure column1 -} -result {{-arrow {} {} none none} {-arrowside {} {} right right} {-arrowgravity {} {} left left} {-arrowpade {} {} 6 6} {-arrowpadw {} {} 6 6} {-bitmap {} {} {} {}} {-background {} {} #d9d9d9 #d9d9d9} {-borderwidth {} {} 2 2} {-button {} {} 1 1} {-expand {} {} 0 0} {-font {} {} {} {}} {-image {} {} {} {}} {-imagepade {} {} 6 6} {-imagepadn {} {} 0 0} {-imagepads {} {} 0 0} {-imagepadw {} {} 6 6} {-itembackground {} {} {} {}} {-justify {} {} left left} {-minwidth {} {} {} {}} {-relief {} {} raised raised} {-stepwidth {} {} {} {}} {-sunken {} {} 0 0} {-tag {} {} {} column1} {-text {} {} {} {}} {-textcolor {} {} Black Black} {-textpade {} {} 6 6} {-textpadn {} {} 0 0} {-textpads {} {} 0 0} {-textpadw {} {} 6 6} {-width {} {} {} {}} {-visible {} {} 1 1} {-widthhack {} {} 0 0}} - -test tree-14.11 {column configure: tail column} -body { - .t column configure tail -} -result {{-arrow {} {} none none} {-arrowside {} {} right right} {-arrowgravity {} {} left left} {-arrowpade {} {} 6 6} {-arrowpadw {} {} 6 6} {-bitmap {} {} {} {}} {-background {} {} #d9d9d9 #d9d9d9} {-borderwidth {} {} 2 2} {-button {} {} 1 1} {-expand {} {} 0 0} {-font {} {} {} {}} {-image {} {} {} {}} {-imagepade {} {} 6 6} {-imagepadn {} {} 0 0} {-imagepads {} {} 0 0} {-imagepadw {} {} 6 6} {-itembackground {} {} {} {}} {-justify {} {} left left} {-minwidth {} {} {} {}} {-relief {} {} raised raised} {-stepwidth {} {} {} {}} {-sunken {} {} 0 0} {-tag {} {} {} tail} {-text {} {} {} {}} {-textcolor {} {} Black Black} {-textpade {} {} 6 6} {-textpadn {} {} 0 0} {-textpads {} {} 0 0} {-textpadw {} {} 6 6} {-width {} {} {} {}} {-visible {} {} 1 1} {-widthhack {} {} 0 0}} - -test tree-14.12 {column configure: invalid -arrow} -body { - .t column configure column1 -arrow straight -} -returnCodes error -result {bad arrow "straight": must be none, up, or down} - -test tree-14.13 {column configure/cget: -arrow} -body { - .t column configure column1 -arrow up - .t column cget column1 -arrow -} -result {up} - -test tree-14.14 {column configure: invalid -arrowside} -body { - .t column configure column1 -arrowside up -} -returnCodes error -result {bad arrowside "up": must be left or right} - -test tree-14.15 {column configure/cget: -arrowside} -body { - .t column configure column1 -arrowside left - .t column cget column1 -arrowside -} -result {left} - -test tree-14.16 {column configure: invalid -arrowgravity} -body { - .t column configure column1 -arrowgravity both -} -returnCodes error -result {bad arrowgravity "both": must be left or right} - -test tree-14.17 {column configure/cget: -arrowgravity} -body { - .t column configure column1 -arrowgravity right - .t column cget column1 -arrowgravity -} -result {right} - -test tree-14.18 {column configure: invalid -arrowpadw} -body { - .t column configure column1 -arrowpadw x -} -returnCodes error -result {bad screen distance "x"} - -test tree-14.19 {column configure/cget: -arrowpadw/e} -body { - .t column configure column1 -arrowpadw 8 -arrowpade 5 - list [.t column cget column1 -arrowpadw] \ - [.t column cget column1 -arrowpade] -} -result {8 5} - -test tree-14.20 {column configure: invalid -bitmap} -body { - .t column configure column1 -bitmap foo -} -returnCodes error -result {bitmap "foo" not defined} - -test tree-14.21 {column configure/cget: -bitmap} -body { - .t column configure column1 -bitmap questhead - .t column cget column1 -bitmap -} -result {questhead} - -test tree-14.22 {column configure: invalid -background} -body { - .t column configure column1 -background foo -} -returnCodes error -result {unknown color name "foo"} - -test tree-14.23 {column configure/cget: -background} -body { - .t column configure column1 -background magenta - .t column cget column1 -background -} -result {magenta} - -test tree-14.24 {column configure: invalid -borderwidth} -body { - .t column configure column1 -borderwidth x -} -returnCodes error -result {bad screen distance "x"} - -test tree-14.25 {column configure/cget: -borderwidth} -body { - .t column configure column1 -borderwidth 4 - .t column cget column1 -borderwidth -} -result {4} - -test tree-14.26 {column configure: invalid -button} -body { - .t column configure column1 -button "" -} -returnCodes error -result {expected boolean value but got ""} - -test tree-14.27 {column configure/cget: -button} -body { - .t column configure column1 -button off - .t column cget column1 -button -} -result {0} - -test tree-14.28 {column configure: invalid -expand} -body { - .t column configure column1 -expand ew -} -returnCodes error -result {expected boolean value but got "ew"} - -test tree-14.29 {column configure/cget: -expand} -body { - .t column configure column1 -expand true - .t column cget column1 -expand -} -result {1} - -test tree-14.30 {column configure: invalid -image} -body { - .t column configure column1 -image questhead -} -returnCodes error -result {image "questhead" doesn't exist} - -test tree-14.31 {column configure/cget: -image} -body { - .t column configure column1 -image emptyImg - .t column cget column1 -image -} -result {emptyImg} - -test tree-14.32 {column configure: invalid -imagepade} -body { - .t column configure column1 -imagepade y -} -returnCodes error -result {bad screen distance "y"} - -test tree-14.33 {column configure/cget: -imagepadw/e} -body { - .t column configure column1 -imagepadw 9 -imagepade 4 - list [.t column cget column1 -imagepadw] \ - [.t column cget column1 -imagepade] -} -result {9 4} - -test tree-14.34 {column configure: invalid -itembackground} -body { - .t column configure column1 -itembackground no -} -returnCodes error -result {unknown color name "no"} - -test tree-14.35 {column configure/cget: simple -itembackground} -body { - .t column configure column1 -itembackground blue - .t column cget column1 -itembackground -} -result {blue} - -test tree-14.36 {column configure: invalid -itembackground list} -body { - .t column configure column1 -itembackground {blue selected green active} -} -returnCodes error -result {unknown color name "selected"} - -test tree-14.37 {column configure/cget: -itembackground list} -body { - .t column configure column1 -itembackground {blue green magenta red} - .t column cget column1 -itembackground -} -result {blue green magenta red} - -test tree-14.38 {column configure: invalid -justify} -body { - .t column configure column1 -justify no -} -returnCodes error -result {bad justification "no": must be left, right, or center} - -test tree-14.39 {column configure/cget: simple -justify} -body { - .t column configure column1 -justify center - .t column cget column1 -justify -} -result {center} - -test tree-14.40 {column configure: invalid -minwidth} -body { - .t column configure column1 -minwidth z -} -returnCodes error -result {bad screen distance "z"} - -test tree-14.41 {column configure/cget: -minwidth} -body { - .t column configure column1 -minwidth 25 - .t column cget column1 -minwidth -} -result {25} - -test tree-14.42 {column configure: invalid -relief} -body { - .t column configure column1 -relief yes -} -returnCodes error -result {bad relief "yes": must be flat, groove, raised, ridge, solid, or sunken} - -test tree-14.43 {column configure/cget: -relief} -body { - .t column configure column1 -relief sunken - .t column cget column1 -relief -} -result {sunken} - -test tree-14.44 {column configure: invalid -stepwidth} -body { - .t column configure column1 -stepwidth "\t" -} -returnCodes error -result {bad screen distance " "} - -test tree-14.45 {column configure/cget: -stepwidth} -body { - .t column configure column1 -stepwidth 125 - .t column cget column1 -stepwidth -} -result {125} - -test tree-14.46 {column configure: invalid -sunken} -body { - .t column configure column1 -sunken groove -} -returnCodes error -result {expected boolean value but got "groove"} - -test tree-14.47 {column configure/cget: -sunken} -body { - .t column configure column1 -sunken on - .t column cget column1 -sunken -} -result {1} - -test tree-14.48 {column configure: -text} -body { - .t column configure column1 -text "Text above Column 1" - .t column cget column1 -text -} -result {Text above Column 1} - -test tree-14.49 {column configure: invalid -textpadw} -body { - .t column configure column1 -textpadw baz -} -returnCodes error -result {bad screen distance "baz"} - -test tree-14.50 {column configure/cget: -textpadw/e} -body { - .t column configure column1 -textpadw 8 -textpade 5 - list [.t column cget column1 -textpadw] \ - [.t column cget column1 -textpade] -} -result {8 5} - -test tree-14.51 {column configure: invalid -width} -body { - .t column configure column1 -width all -} -returnCodes error -result {bad screen distance "all"} - -test tree-14.52 {column configure/cget: -width} -body { - .t column configure column1 -width 250 - .t column cget column1 -width -} -result {250} - -test tree-14.53 {column configure: invalid -visible} -body { - .t column configure column1 -visible never -} -returnCodes error -result {expected boolean value but got "never"} - -test tree-14.54 {column configure/cget: -visible} -body { - .t column configure column1 -visible no - .t column cget column1 -visible -} -result {0} - -test tree-14.55 {column configure: invalid -widthhack} -body { - .t column configure column1 -widthhack ok -} -returnCodes error -result {expected boolean value but got "ok"} - -test tree-14.56 {column configure/cget: -widthhack} -body { - .t column configure column1 -widthhack yes - .t column cget column1 -widthhack -} -result {1} - -test tree-14.57 {column configure: -tag} -body { - .t column configure column1 -tag column2 - .t column cget column1 -tag -} -returnCodes error -result {column with tag "column1" doesn't exist} - -test tree-14.58 {column configure: -tag} -body { - .t column cget column2 -tag -} -result {column2} - -test tree-14.59 {column cget: -tag of tail} -body { - .t column cget tail -tag -} -result {tail} - -test tree-14.60 {column configure/cget: -tag of tail} -body { - .t column configure tail -tag head -} -returnCodes error -result {can't change tag of tail column} - -test tree-14.61 {column cget: specify tail by its tag} -body { - .t column cget head -tag -} -returnCodes error -result {column with tag "head" doesn't exist} - -test tree-14.62 {column delete: missing args} -body { - .t column delete -} -returnCodes error -result {wrong # args: should be ".t column delete column"} - -test tree-14.63 {column delete: column tail} -body { - .t column delete tail -} -returnCodes error -result {can't specify "tail" for this command} - -test tree-14.64 {column delete: first column} -body { +test tree-14.1 {rename and change some columns} -body { .t column delete 0 -} -result {} - -test tree-14.65 {suprise, surprise: column 0 still exists} -body { - .t column cget 0 -tag -} -result {column2} - -test tree-14.66 {column index: missing args} -body { - .t column index -} -returnCodes error -result {wrong # args: should be ".t column index column"} - -test tree-14.67 {column index: the easy case} -body { - .t column index 0 -} -result {0} - -test tree-14.68 {column index} -body { - .t column index column2 -} -result {0} - -test tree-14.69 {column index: tail column} -body { - .t column index tail -} -result {1} - -test tree-14.70 {column move: missing args} -body { - .t column move -} -returnCodes error -result {wrong # args: should be ".t column move column before"} - -test tree-14.71 {column move: invalid column} -body { - .t column move 0 2 -} -returnCodes error -result {bad column index "2": must be from 0 to 0} - -test tree-14.72 {column move: invalid column} -body { .t column configure 1 -tag column1 .t column configure 2 -tag column3 .t column move 0 2 - .t column index column2 -} -result {1} - -test tree-14.73 {correct moved?} -body { - set res {} - for {set x 0} {$x < [.t numcolumns]} {incr x} { - lappend res [.t column cget $x -tag] - } - set res -} -result {column1 column2 column3} - -test tree-14.74 {column move: tail to the left} -body { - .t column move tail 0 -} -returnCodes error -result {can't specify "tail" for this command} - -test tree-14.75 {column move: tail as before is ok} -body { .t column move 0 tail - .t column index column1 -} -result {2} - -test tree-14.76 {column width: missing args} -body { - .t column width -} -returnCodes error -result {wrong # args: should be ".t column width column"} - -test tree-14.77 {column width: invalid column} -body { - .t column width foo -} -returnCodes error -result {column with tag "foo" doesn't exist} - -test tree-14.78 {column width: tail column returns always 0} -body { - .t column width tail -} -result {0} - -test tree-14.79 {column width} -body { .t element create eText2 text -font {{courier -12}} -text "Hello World" .t style create testStyle3 .t style elements testStyle3 eText2 .t item style set 1 column1 testStyle3 - update idletasks - .t column width column1 -} -result {136} - -test tree-14.80 {column neededwidth: missing args} -body { - .t column neededwidth -} -returnCodes error -result {wrong # args: should be ".t column neededwidth column"} - -test tree-14.81 {column neededwidth: invalid column} -body { - .t column neededwidth foo -} -returnCodes error -result {column with tag "foo" doesn't exist} - -test tree-14.82 {column neededwidth: tail column returns always 0} -body { - .t column neededwidth tail -} -result {0} - -test tree-14.83 {column neededwidth} -body { - .t column neededwidth column1 -} -result {136} +} -result {} test tree-15.1 {identify: missing args} -body { .t identify @@ -2187,349 +947,6 @@ test tree-16.14 {dragimage clear: doesn't modify the offset} -body { .t dragimage offset } -result {10 10} -test tree-17.1 {notify: missing args} -body { - .t notify -} -returnCodes error -result {wrong # args: should be ".t notify command ?arg arg...?"} - -test tree-17.2 {notify: unknown command} -body { - .t notify foo -} -returnCodes error -result {bad command "foo": must be bind, configure, detailnames, eventnames, generate, install, linkage, or uninstall} - -test tree-17.3 {notify eventnames: too much args} -body { - .t notify eventnames Open -} -returnCodes error -result {wrong # args: should be ".t notify eventnames"} - -test tree-17.4 {notify eventnames: nothing own installed yet} -body { - lsort [.t notify eventnames] -} -result {ActiveItem Collapse Expand Scroll Selection} - -test tree-17.5 {notify install: missing args} -body { - .t notify install -} -returnCodes error -result {wrong # args: should be ".t notify install option arg ..."} - -test tree-17.6 {notify install: unknown command} -body { - .t notify install foo -} -returnCodes error -result {bad option "foo": must be detail or event} - -test tree-17.7 {notify install event: missing args} -body { - .t notify install event -} -returnCodes error -result {wrong # args: should be ".t notify install event name ?percentsCommand?"} - -test tree-17.8 {notify install event: too much args} -body { - .t notify install event foo bar baz -} -returnCodes error -result {wrong # args: should be ".t notify install event name ?percentsCommand?"} - -test tree-17.9 {notify install event} -body { - .t notify install event Greetings - .t notify install event GoodBye -} -result {} - -test tree-17.10 {notify eventnames: list Greetings} -body { - lsort [.t notify eventnames] -} -result {ActiveItem Collapse Expand GoodBye Greetings Scroll Selection} - -test tree-17.11 {notify detailnames: missing args} -body { - .t notify detailnames -} -returnCodes error -result {wrong # args: should be ".t notify detailnames eventName"} - -test tree-17.12 {notify detailnames: too many args} -body { - .t notify detailnames foo bar -} -returnCodes error -result {wrong # args: should be ".t notify detailnames eventName"} - -test tree-17.13 {notify detailnames: unknown event} -body { - .t notify detailnames Hello -} -returnCodes error -result {unknown event "Hello"} - -test tree-17.14 {notify detailnames: no details yet} -body { - .t notify detailnames Greetings -} -result {} - -test tree-17.15 {notify install detail: missing args} -body { - .t notify install detail -} -returnCodes error -result {wrong # args: should be ".t notify install detail event detail ?percentsCommand?"} - -test tree-17.16 {notify install detail: unknown event} -body { - .t notify install detail Hello GoodBye -} -returnCodes error -result {unknown event "Hello"} - -test tree-17.17 {notify install detail} -body { - .t notify install detail Greetings Wrote - .t notify install detail Greetings Sent -} -result {} - -test tree-17.18 {notify detailnames} -body { - lsort [.t notify detailnames Greetings] -} -result {Sent Wrote} - -test tree-17.19 {notify linkage: missing args} -body { - .t notify linkage -} -returnCodes error -result {wrong # args: should be ".t notify linkage event ?detail?"} - -test tree-17.20 {notify linkage: unknown event} -body { - .t notify linkage foo -} -returnCodes error -result {unknown event "foo"} - -test tree-17.21 {notify linkage: standard event} -body { - .t notify linkage Scroll -} -result {static} - -test tree-17.22 {notify linkage: self made event} -body { - .t notify linkage Greetings -} -result {dynamic} - -test tree-17.23 {notify linkage: unknown detail} -body { - .t notify linkage Greetings foo -} -returnCodes error -result {unknown detail "foo" for event "Greetings"} - -test tree-17.24 {notify linkage: standard event} -body { - .t notify linkage Scroll x -} -result {static} - -test tree-17.25 {notify linkage: self made event} -body { - .t notify linkage Greetings Sent -} -result {dynamic} - -test tree-17.26 {notify bind: too much args} -body { - .t notify bind z y z z y -} -returnCodes error -result {wrong # args: should be ".t notify bind ?object? ?pattern? ?script?"} - -test tree-17.27 {notify bind: nothing bound yet} -body { - .t notify bind .t -} -result {} - -test tree-17.28 {notify bind: invalid pattern} -body { - .t notify bind .t Greetings -} -returnCodes error -result {missing "<" in event pattern "Greetings"} - -test tree-17.29 {notify bind: unknown event} -body { - .t notify bind .t -} -returnCodes error -result {unknown event "Hello"} - -test tree-17.30 {notify bind: unknown detail} -body { - .t notify bind .t -} -returnCodes error -result {unknown detail "Prepare" for event "Greetings"} - -test tree-17.31 {notify bind: nothing yet for simple event} -body { - .t notify bind .t -} -result {} - -test tree-17.32 {notify bind: simple event} -body { - .t notify bind .t {puts -nonewline "Bye bye"} -} -result {} - -test tree-17.33 {notify bind: simple event, script added} -body { - .t notify bind .t {+puts ""} -} -result {} - -test tree-17.34 {notify bind: simple event defined} -body { - .t notify bind .t -} -result {puts -nonewline "Bye bye" -puts ""} - -test tree-17.35 {notify bind: nothing yet for event with detail} -body { - .t notify bind .t -} -result {} - -test tree-17.36 {notify bind: event with detail} -body { - .t notify bind .t {puts -nonewline "Hello World"} - .t notify bind .t {puts ""} -} -result {} - -test tree-17.37 {notify bind: event with detail defined} -body { - .t notify bind .t -} -result {puts ""} - -test tree-17.38 {notify bind without pattern} -body { - lsort [.t notify bind .t] -} -result { } - -test tree-17.39 {notify configure: missing args} -body { - .t notify configure -} -returnCodes error -result {wrong # args: should be ".t notify configure object pattern ?option? ?value? ?option value ...?"} - -test tree-17.40 {notify configure: unknown event} -body { - .t notify configure .t -} -returnCodes error -result {unknown event "Hello"} - -test tree-17.41 {notify configure: unknown event with detail} -body { - .t notify configure .t -} -returnCodes error -result {unknown event "Hello"} - -test tree-17.42 {notify configure: unbound event} -body { - .t notify configure .t -} -result {} - -test tree-17.43 {notify configure: unbound event with details} -body { - .t notify configure .t -} -result {} - -test tree-17.44 {notify configure: dynamic event} -body { - .t notify configure .t -} -result {-active 1} - -test tree-17.45 {notify configure: dynamic event} -body { - .t notify configure .t -active 0 - .t notify configure .t -} -result {-active 0} - -test tree-17.46 {notify generate: missing args} -body { - .t notify generate -} -returnCodes error -result {wrong # args: should be ".t notify generate pattern ?field value ...?"} - -test tree-17.47 {notify generate: invalid event} -body { - .t notify generate Greetings -} -returnCodes error -result {missing "<" in event pattern "Greetings"} - -test tree-17.48 {notify generate: virtual event} -body { - .t notify generate <> -} -returnCodes error -result {unknown event ""} - -test tree-17.49 {notify generate: unknown event} -body { - .t notify generate -} -returnCodes error -result {unknown event "Hello"} - -test tree-17.50 {notify generate: unknown detail} -body { - .t notify generate -} -returnCodes error -result {unknown detail "Prepare" for event "Greetings"} - -test tree-17.51 {notify generate: missing detail} -body { - .t notify generate -} -returnCodes error -result {cannot generate "": missing detail} - -test tree-17.52 {notify generate: NOW!} -body { - .t notify generate -} -output {Hello World} - -test tree-17.53 {notify generate: not active} -body { - .t notify generate -} -result {} - -test tree-17.54 {notify generate: and AGAIN!} -body { - .t notify configure .t -active 1 - .t notify generate -} -output { -} - -test tree-17.55 {notify generate: invalid percent char} -body { - .t notify generate -foo bar -} -returnCodes error -result {invalid percent char "-foo"} - -test tree-17.56 {notify generate: odd number of field args} -body { - .t notify generate -f -} -returnCodes error -result {wrong # args: should be ".t notify pattern ?field value ...?"} - -test tree-17.57 {notify generate: huge number of field args} -body { - set command [list .t notify generate ] - for {set x 1} {$x < 2048} {incr x} { - lappend command -f $x - } - eval $command -} -output { -} - -test tree-17.58 {notify generate: not so much field args} -body { - .t notify generate \ - -0 a -1 b -2 c -3 d -4 e -5 f -6 g -7 h -8 i -9 j -X x -} -output { -} - -test tree-17.60 {notify install/bind/generate: do some replacements} -body { - .t notify install event Percent - .t notify install detail Percent Test - .t notify bind .t \ - {puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"} - .t notify generate -2 to -b be -~ not -| or -} -output {%W: to be or not to be%} - -proc doMyOwnSubst {field window eventName detail args} { - return [string map {2 TO b BE ~ NOT | OR} $field] -} - -test tree-17.61 {notify install/bind/generate: my own replacements} -body { - .t notify uninstall detail Percent Test - .t notify install detail Percent Test doMyOwnSubst - .t notify bind .t \ - {puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"} - .t notify generate -} -output {%W: TO BE OR NOT TO BE%} - -test tree-17.62 {notify install/bind/generate: standard replacements} -body { - .t notify generate -2 to -b be -~ not -| or -} -output {%W: TO BE OR NOT TO BE%} - -test tree-17.62a {notify install/bind/generate: my own replacements} -body { - .t notify uninstall detail Percent Test - .t notify uninstall event Percent - .t notify install event Percent doMyOwnSubst - .t notify bind .t \ - {puts -nonewline "%%W: %2 %b %| %~ %2 %b%%"} - .t notify generate -} -output {%W: TO BE OR NOT TO BE%} - -test tree-17.62b {notify install/bind/generate: standard replacements} -body { - .t notify generate -2 to -b be -~ not -| or -} -output {%W: TO BE OR NOT TO BE%} - -test tree-17.63 {notify uninstall: missing args} -body { - .t notify uninstall -} -returnCodes error -result {wrong # args: should be ".t notify uninstall option arg ..."} - -test tree-17.64 {notify uninstall: unknown command} -body { - .t notify uninstall foo -} -returnCodes error -result {bad option "foo": must be detail or event} - -test tree-17.65 {notify uninstall detail: missing args} -body { - .t notify uninstall detail -} -returnCodes error -result {wrong # args: should be ".t notify uninstall detail event detail"} - -test tree-17.66 {notify uninstall detail: too much args} -body { - .t notify uninstall detail foo bar baz -} -returnCodes error -result {wrong # args: should be ".t notify uninstall detail event detail"} - -test tree-17.67 {notify uninstall detail: unknown event} -body { - .t notify uninstall detail foo bar -} -returnCodes error -result {unknown event "foo"} - -test tree-17.68 {notify uninstall detail: unknown detail} -body { - .t notify uninstall detail Greetings GoodBye -} -returnCodes error -result {unknown detail "GoodBye" for event "Greetings"} - -test tree-17.69 {notify uninstall detail} -body { - .t notify uninstall detail Greetings Sent -} -result {} - -test tree-17.70 {notify uninstall detail: double check} -body { - lsearch -exact [.t notify detailnames Greetings] Sent -} -result {-1} - -test tree-17.71 {notify uninstall detail: delete a static detail} -body { - .t notify uninstall detail Scroll x -} -returnCodes error -result {can't uninstall static detail "x"} - -test tree-17.72 {notify uninstall event: missing args} -body { - .t notify uninstall event -} -returnCodes error -result {wrong # args: should be ".t notify uninstall event name"} - -test tree-17.73 {notify uninstall event: too much args} -body { - .t notify uninstall event foo bar -} -returnCodes error -result {wrong # args: should be ".t notify uninstall event name"} - -test tree-17.74 {notify uninstall event: unknown event} -body { - .t notify uninstall event foo -} -returnCodes error -result {unknown event "foo"} - -test tree-17.75 {notify uninstall event} -body { - .t notify uninstall event Greetings -} -result {} - -test tree-17.76 {notify uninstall event: double check} -body { - lsearch -exact [.t notify eventnames] Greetings -} -result {-1} - -test tree-17.77 {notify uninstall event: delete a static event} -body { - .t notify uninstall event Scroll -} -returnCodes error -result {can't uninstall static event "Scroll"} - # cleanup image delete emptyImg ::tcltest::cleanupTests -- cgit v0.12