summaryrefslogtreecommitdiffstats
path: root/tests/listbox.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/listbox.test')
-rw-r--r--tests/listbox.test181
1 files changed, 86 insertions, 95 deletions
diff --git a/tests/listbox.test b/tests/listbox.test
index 98ec96c..5afeddd 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "listbox" command
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1993-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1993-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -376,15 +376,15 @@ test listbox-3.5 {ListboxWidgetCmd procedure, "activate" option} -body {
test listbox-3.6 {ListboxWidgetCmd procedure, "activate" option} -body {
.l activate -1
.l index active
-} -result {0}
+} -result 0
test listbox-3.7 {ListboxWidgetCmd procedure, "activate" option} -body {
.l activate 30
.l index active
-} -result {17}
+} -result 17
test listbox-3.8 {ListboxWidgetCmd procedure, "activate" option} -body {
.l activate end
.l index active
-} -result {17}
+} -result 17
test listbox-3.9 {ListboxWidgetCmd procedure, "bbox" option} -body {
.l bbox
} -returnCodes error -result {wrong # args: should be ".l bbox index"}
@@ -508,7 +508,7 @@ test listbox-3.18b {ListboxWidgetCmd procedure, "bbox" option, justified, non-de
} -cleanup {
destroy .top.l .top
unset -nocomplain lres res
-} -result {1}
+} -result 1
test listbox-3.19 {ListboxWidgetCmd procedure, "cget" option} -body {
.l cget
} -returnCodes error -result {wrong # args: should be ".l cget option"}
@@ -520,10 +520,10 @@ test listbox-3.21 {ListboxWidgetCmd procedure, "cget" option} -body {
} -returnCodes error -result {unknown option "-gorp"}
test listbox-3.22 {ListboxWidgetCmd procedure, "cget" option} -body {
.l cget -setgrid
-} -result {0}
+} -result 0
test listbox-3.23 {ListboxWidgetCmd procedure, "configure" option} -body {
llength [.l configure]
-} -result {28}
+} -result 28
test listbox-3.24 {ListboxWidgetCmd procedure, "configure" option} -body {
.l configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
@@ -587,7 +587,7 @@ test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup {
} -body {
listbox .l2
.l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7
- .l2 delete -3 2
+ .l2 delete -1 2
.l2 get 0 end
} -cleanup {
destroy .l2
@@ -597,7 +597,7 @@ test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup {
} -body {
listbox .l2
.l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7
- .l2 delete -3 -1
+ .l2 delete -1 -1
.l2 get 0 end
} -cleanup {
destroy .l2
@@ -684,10 +684,10 @@ test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body {
.l get -1
} -result {}
test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body {
- .l get -2 -1
+ .l get -1 -1
} -result {}
test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body {
- .l get -2 3
+ .l get -1 3
} -result {el0 el1 el2 el3}
test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body {
.l get 12 end
@@ -718,7 +718,7 @@ test listbox-3.60 {ListboxWidgetCmd procedure, "index" option} -body {
} -result 2
test listbox-3.61 {ListboxWidgetCmd procedure, "index" option} -body {
.l index -1
-} -result {-1}
+} -result -1
test listbox-3.62 {ListboxWidgetCmd procedure, "index" option} -body {
.l index end
} -result 18
@@ -783,7 +783,7 @@ test listbox-3.72 {ListboxWidgetCmd procedure, "nearest" option} -body {
test listbox-3.73 {ListboxWidgetCmd procedure, "nearest" option} -body {
.l yview 3
.l nearest 1000
-} -result {7}
+} -result 7
test listbox-3.74 {ListboxWidgetCmd procedure, "scan" option} -body {
.l scan a b
} -returnCodes error -result {wrong # args: should be ".l scan mark|dragto x y"}
@@ -830,52 +830,52 @@ test listbox-3.83 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 7
.l index @0,0
-} -result {7}
+} -result 7
test listbox-3.84 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 11
.l index @0,0
-} -result {7}
+} -result 7
test listbox-3.85 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 6
.l index @0,0
-} -result {6}
+} -result 6
test listbox-3.86 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 5
.l index @0,0
-} -result {3}
+} -result 3
test listbox-3.87 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 12
.l index @0,0
-} -result {8}
+} -result 8
test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 13
.l index @0,0
-} -result {11}
+} -result 11
test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see -1
.l index @0,0
-} -result {0}
+} -result 0
test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see end
.l index @0,0
-} -result {13}
+} -result 13
test listbox-3.91 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 322
.l index @0,0
-} -result {13}
+} -result 13
test listbox-3.92 {ListboxWidgetCmd procedure, "see" option, partial last line} -body {
mkPartial
.partial.l see 4
.partial.l index @0,0
-} -result {1}
+} -result 1
test listbox-3.93 {ListboxWidgetCmd procedure, "selection" option} -body {
.l select a
} -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"}
@@ -898,15 +898,15 @@ test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} -body {
test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection anchor -1
.l index anchor
-} -result {0}
+} -result 0
test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection anchor end
.l index anchor
-} -result {17}
+} -result 17
test listbox-3.101 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection anchor 44
.l index anchor
-} -result {17}
+} -result 17
test listbox-3.102 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection clear 0 end
.l selection set 2 8
@@ -926,16 +926,16 @@ test listbox-3.104 {ListboxWidgetCmd procedure, "selection" option} -body {
test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection set 0 end
.l selection includes -1
-} -result {0}
+} -result 0
test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection clear 0 end
.l selection set end
.l selection includes end
-} -result {1}
+} -result 1
test listbox-3.107 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection set 0 end
.l selection includes 44
-} -result {0}
+} -result 0
test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup {
destroy .l2
} -body {
@@ -943,7 +943,7 @@ test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup {
.l2 selection includes 0
} -cleanup {
destroy .l2
-} -result {0}
+} -result 0
test listbox-3.109 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection clear 0 end
.l selection set 2
@@ -965,7 +965,7 @@ test listbox-3.112 {ListboxWidgetCmd procedure, "size" option} -body {
} -returnCodes error -result {wrong # args: should be ".l size"}
test listbox-3.113 {ListboxWidgetCmd procedure, "size" option} -body {
.l size
-} -result {18}
+} -result 18
test listbox-3.114 {ListboxWidgetCmd procedure, "xview" option} -setup {
destroy .l2
} -body {
@@ -1242,7 +1242,7 @@ test listbox-4.2 {ConfigureListbox procedure} -setup {
.l cget -highlightthickness
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test listbox-4.3 {ConfigureListbox procedure} -setup {
deleteWindows
destroy .l
@@ -1573,14 +1573,14 @@ test listbox-6.2 {InsertEls procedure} -body {
.l selection anchor 2
.l insert 2 A B
.l index anchor
-} -result {4}
+} -result 4
test listbox-6.3 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 2
.l insert 3 A B
.l index anchor
-} -result {2}
+} -result 2
test listbox-6.4 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1588,7 +1588,7 @@ test listbox-6.4 {InsertEls procedure} -body {
update
.l insert 2 A B
.l index @0,0
-} -result {5}
+} -result 5
test listbox-6.5 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1596,31 +1596,31 @@ test listbox-6.5 {InsertEls procedure} -body {
update
.l insert 3 A B
.l index @0,0
-} -result {3}
+} -result 3
test listbox-6.6 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 5
.l insert 5 A B
.l index active
-} -result {7}
+} -result 7
test listbox-6.7 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 5
.l insert 6 A B
.l index active
-} -result {5}
+} -result 5
test listbox-6.8 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c
.l index active
-} -result {2}
+} -result 2
test listbox-6.9 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0
.l index active
-} -result {0}
+} -result 0
test listbox-6.10 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b "two words" c d e f g h i j
@@ -1728,28 +1728,28 @@ test listbox-7.5 {DeleteEls procedure} -body {
.l selection anchor 2
.l delete 0 1
.l index anchor
-} -result {0}
+} -result 0
test listbox-7.6 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 2
.l delete 2
.l index anchor
-} -result {2}
+} -result 2
test listbox-7.7 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 4
.l delete 2 5
.l index anchor
-} -result {2}
+} -result 2
test listbox-7.8 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 3
.l delete 4 5
.l index anchor
-} -result {3}
+} -result 3
test listbox-7.9 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1757,7 +1757,7 @@ test listbox-7.9 {DeleteEls procedure} -body {
update
.l delete 1 2
.l index @0,0
-} -result {1}
+} -result 1
test listbox-7.10 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1765,7 +1765,7 @@ test listbox-7.10 {DeleteEls procedure} -body {
update
.l delete 3 4
.l index @0,0
-} -result {3}
+} -result 3
test listbox-7.11 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1773,7 +1773,7 @@ test listbox-7.11 {DeleteEls procedure} -body {
update
.l delete 4 6
.l index @0,0
-} -result {3}
+} -result 3
test listbox-7.12 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1781,42 +1781,42 @@ test listbox-7.12 {DeleteEls procedure} -body {
update
.l delete 3 end
.l index @0,0
-} -result {1}
+} -result 1
test listbox-7.13 {DeleteEls procedure, updating view with partial last line} -body {
mkPartial
.partial.l yview 8
update
.partial.l delete 10 13
.partial.l index @0,0
-} -result {7}
+} -result 7
test listbox-7.14 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 3 4
.l index active
-} -result {4}
+} -result 4
test listbox-7.15 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 5 7
.l index active
-} -result {5}
+} -result 5
test listbox-7.16 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 5 end
.l index active
-} -result {4}
+} -result 4
test listbox-7.17 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 0 end
.l index active
-} -result {0}
+} -result 0
test listbox-7.18 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c "two words" d e f g h i j
@@ -1987,7 +1987,7 @@ test listbox-10.5 {GetListboxIndex procedure} -setup {
.l index end
} -cleanup {
destroy .l
-} -result {12}
+} -result 12
test listbox-10.6 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2102,7 +2102,7 @@ test listbox-10.16 {GetListboxIndex procedure} -setup {
.l index 3
} -cleanup {
destroy .l
-} -result {3}
+} -result 3
test listbox-10.17 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2112,7 +2112,7 @@ test listbox-10.17 {GetListboxIndex procedure} -setup {
.l index 20
} -cleanup {
destroy .l
-} -result {12}
+} -result 12
test listbox-10.18 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2129,10 +2129,10 @@ test listbox-10.19 {GetListboxIndex procedure} -setup {
pack [listbox .l]
.l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11
update
- .l index -2
+ .l index -1
} -cleanup {
destroy .l
-} -result -1
+} -result -1
test listbox-10.20 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2226,7 +2226,7 @@ test listbox-11.6 {ChangeListboxView procedure, partial last line} -body {
.partial.l index @0,0
} -cleanup {
destroy .l
-} -result {11}
+} -result 11
# Listbox used in 12.* tests
@@ -2314,7 +2314,7 @@ test listbox-13.3 {ListboxScanTo procedure} -constraints {
test listbox-14.1 {NearestListboxElement procedure, partial last line} -body {
mkPartial
.partial.l nearest [winfo height .partial.l]
-} -result {4}
+} -result 4
# Listbox used in 14.* tests
destroy .l
listbox .l -font $fixed -width 20 -height 10
@@ -2326,7 +2326,7 @@ test listbox-14.2 {NearestListboxElement procedure} -constraints {
fonts
} -body {
.l index @50,0
-} -result {4}
+} -result 4
test listbox-14.3 {NearestListboxElement procedure} -constraints {
fonts
} -body {
@@ -2336,7 +2336,7 @@ test listbox-14.4 {NearestListboxElement procedure} -constraints {
fonts
} -body {
.l index @50,200
-} -result {13}
+} -result 13
# Listbox used in 15.* 16.* and 17.* tests
@@ -2378,7 +2378,7 @@ test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -bo
.l delete 0 end
.l insert 0 a b c d e f
.l select clear 0 end
- .l select set -2 -1
+ .l select set -1 -1
.l curselection
} -result {}
test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body {
@@ -2415,7 +2415,7 @@ test listbox-15.9 {ListboxSelect procedure, boundary conditions for indices} -bo
.l select clear 0 end
.l select set end 30
.l curselection
-} -result {5}
+} -result 5
test listbox-15.10 {ListboxSelect procedure, boundary conditions for indices} -body {
.l delete 0 end
.l insert 0 a b c d e f
@@ -2451,7 +2451,7 @@ test listbox-16.3 {ListboxFetchSelection procedure, retrieve in several parts} -
string compare 1$long\n2$long\n3$long\n4$long\n5$long $sel
} -cleanup {
catch {unset long sel}
-} -result {0}
+} -result 0
test listbox-17.1 {ListboxLostSelection procedure} -setup {
@@ -2662,41 +2662,37 @@ test listbox-21.8 {ListboxListVarProc, test selection after listvar mod} -setup
test listbox-21.9 {ListboxListVarProc, test hscrollbar after listvar mod} -setup {
destroy .l
} -body {
- catch {unset x}
+ set x {}
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
- set log {}
pack .l
- set timeout [after 500 {set log timeout}]
- vwait log
+ update idletasks
+ set log {}
lappend x "0000000000"
- update
+ update idletasks
lappend x "00000000000000000000"
- update
+ update idletasks
set log
} -cleanup {
destroy .l
- after cancel $timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5}]
+} -result [list {x 0 1} {x 0 0.5}]
test listbox-21.10 {ListboxListVarProc, test hscrollbar after listvar mod} -setup {
destroy .l
} -body {
catch {unset x}
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
- set log {}
pack .l
- set timeout [after 500 {set log timeout}]
- vwait log
+ update idletasks
+ set log {}
lappend x "0000000000"
- update
+ update idletasks
lappend x "00000000000000000000"
- update
+ update idletasks
set x [list "0000000000"]
- update
+ update idletasks
set log
} -cleanup {
destroy .l
- after cancel timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5} {x 0 1}]
+} -result [list {x 0 1} {x 0 0.5} {x 0 1}]
test listbox-21.11 {ListboxListVarProc, bad list} -setup {
destroy .l
} -body {
@@ -2764,7 +2760,7 @@ test listbox-21.15 {ListboxListVarProc, update vertical scrollbar} -setup {
update
set log {}
pack .l
- set timeout [after 500 {set log timeout}]
+ set timeout [after 500 {lappend log timeout3}]
vwait log
update
lappend x a b c d e f
@@ -2801,19 +2797,19 @@ test listbox-22.1 {UpdateHScrollbar} -setup {
destroy .l
} -body {
listbox .l -font $fixed -width 10 -xscrollcommand "record x"
- set log {}
pack .l
- set timeout [after 500 {set log timeout}]
- vwait log
+ update idletasks
+ set log {}
+ set timeout [after 500 {lappend log timeout4}]
.l insert end "0000000000"
- update
+ vwait log
.l insert end "00000000000000000000"
vwait log
set log
} -cleanup {
destroy .l
after cancel $timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5}]
+} -result [list {x 0 1} {x 0 0.5}]
# ConfigureListboxItem
@@ -2858,7 +2854,7 @@ test listbox-23.4 {ConfigureListboxItem, wrong num args} -setup {
set result
} -cleanup {
destroy .l
-} -result {wrong # args: should be ".l itemconfigure index ?-option? ?value? ?-option value ...?"}
+} -result {wrong # args: should be ".l itemconfigure index ?-option value ...?"}
test listbox-23.5 {ConfigureListboxItem, multiple calls} -setup {
destroy .l
} -body {
@@ -3221,8 +3217,3 @@ option clear
# cleanup
cleanupTests
return
-
-
-
-
-