summaryrefslogtreecommitdiffstats
path: root/tests/listbox.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/listbox.test')
-rw-r--r--tests/listbox.test99
1 files changed, 51 insertions, 48 deletions
diff --git a/tests/listbox.test b/tests/listbox.test
index fd8603d..25bc606 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -7,17 +7,14 @@
# All rights reserved.
package require tcltest 2.1
-namespace import -force tcltest::configure
-namespace import -force tcltest::testsDirectory
-configure -testdir [file join [pwd] [file dirname [info script]]]
-configure -loadfile [file join [testsDirectory] constraints.tcl]
+eval tcltest::configure $argv
tcltest::loadTestedCommands
set fixed {Courier -12}
-proc record args {
+proc record {name args} {
global log
- lappend log $args
+ lappend log [format {%s %.6g %.6g} $name {*}$args]
}
proc getsize w {
@@ -477,7 +474,7 @@ test listbox-3.78 {ListboxWidgetCmd procedure, "scan" option} {fonts} {
.t.l scan mark 100 140
.t.l scan dragto 90 137
update
- list [.t.l xview] [.t.l yview]
+ list [format {%.6g %.6g} {*}[.t.l xview]] [format {%.6g %.6g} {*}[.t.l yview]]
} {{0.249364 0.427481} {0.0714286 0.428571}}
test listbox-3.79 {ListboxWidgetCmd procedure, "scan" option} {
list [catch {.l scan foo 2 4} msg] $msg
@@ -629,7 +626,7 @@ test listbox-3.114 {ListboxWidgetCmd procedure, "xview" option} {
catch {destroy .l2}
listbox .l2
update
- .l2 xview
+ format {%.6g %.6g} {*}[.l2 xview]
} {0 1}
test listbox-3.115 {ListboxWidgetCmd procedure, "xview" option} {
catch {destroy .l}
@@ -637,7 +634,7 @@ test listbox-3.115 {ListboxWidgetCmd procedure, "xview" option} {
.l insert 0 a b c d e f g h i j k l m n o p q r s t
pack .l
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0 1}
catch {destroy .l}
listbox .l -width 10 -height 5 -font $fixed
@@ -647,7 +644,7 @@ pack .l
update
test listbox-3.116 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 4
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.08 0.28}
test listbox-3.117 {ListboxWidgetCmd procedure, "xview" option} {
list [catch {.l xview foo} msg] $msg
@@ -659,19 +656,19 @@ test listbox-3.119 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 0
.l xview moveto .4
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.4 0.6}
test listbox-3.120 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 0
.l xview scroll 2 units
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.04 0.24}
test listbox-3.121 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 30
.l xview scroll -1 pages
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.44 0.64}
test listbox-3.122 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l configure -width 1
@@ -679,14 +676,14 @@ test listbox-3.122 {ListboxWidgetCmd procedure, "xview" option} {fonts} {
.l xview 30
.l xview scroll -4 pages
update
- .l xview
+ format {%.6g %.6g} {*}[.l xview]
} {0.52 0.54}
test listbox-3.123 {ListboxWidgetCmd procedure, "yview" option} {
catch {destroy .l}
listbox .l
pack .l
update
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0 1}
test listbox-3.124 {ListboxWidgetCmd procedure, "yview" option} {
catch {destroy .l}
@@ -694,7 +691,7 @@ test listbox-3.124 {ListboxWidgetCmd procedure, "yview" option} {
.l insert 0 el1
pack .l
update
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0 1}
catch {destroy .l}
listbox .l -width 10 -height 5 -font $fixed
@@ -704,11 +701,11 @@ update
test listbox-3.125 {ListboxWidgetCmd procedure, "yview" option} {
.l yview 4
update
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.2 0.45}
test listbox-3.126 {ListboxWidgetCmd procedure, "yview" option, partial last line} {
mkPartial
- .partial.l yview
+ format {%.6g %.6g} {*}[.partial.l yview]
} {0 0.266667}
test listbox-3.127 {ListboxWidgetCmd procedure, "xview" option} {
list [catch {.l yview foo} msg] $msg
@@ -719,24 +716,24 @@ test listbox-3.128 {ListboxWidgetCmd procedure, "xview" option} {
test listbox-3.129 {ListboxWidgetCmd procedure, "xview" option} {
.l yview 0
.l yview moveto .31
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.3 0.55}
test listbox-3.130 {ListboxWidgetCmd procedure, "xview" option} {
.l yview 2
.l yview scroll 2 pages
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.4 0.65}
test listbox-3.131 {ListboxWidgetCmd procedure, "xview" option} {
.l yview 10
.l yview scroll -3 units
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.35 0.6}
test listbox-3.132 {ListboxWidgetCmd procedure, "xview" option} {
.l configure -height 2
update
.l yview 15
.l yview scroll -4 pages
- .l yview
+ format {%.6g %.6g} {*}[.l yview]
} {0.55 0.65}
test listbox-3.133 {ListboxWidgetCmd procedure, "xview" option} {
list [catch {.l whoknows} msg] $msg
@@ -944,6 +941,7 @@ test listbox-4.18 {ConfigureListbox, no listvar -> bad listvar} {
"unmatched open quote in list: invalid -listvariable value"]
test listbox-4.19 {ConfigureListbox, no listvar -> bad non-existent listvar} {
catch {destroy .l}
+ unset -nocomplain ::foo
listbox .l -listvar foo
.l insert end a b c d
catch {.l configure -listvar ::zoo::bar::foo} result
@@ -1107,7 +1105,7 @@ test listbox-6.14 {InsertEls procedure, check selection update} {
.l2 insert 0 a
.l2 curselection
} [list 3 4 5]
-test listbox-6.15 {InsertEls procedure, lost namespaced listvar, bug 1424513} {
+test listbox-6.15 {InsertEls procedure, lost namespaced listvar} {
destroy .l2
namespace eval test { variable foo {a b} }
listbox .l2 -listvar ::test::foo
@@ -1302,7 +1300,7 @@ test listbox-8.2 {ListboxEventProc procedure} {fonts} {
update
place .l -width 50 -height 80
update
- list [.l xview] [.l yview]
+ list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0 0.222222} {0 0.333333}}
test listbox-8.3 {ListboxEventProc procedure} {
deleteWindows
@@ -1445,7 +1443,7 @@ test listbox-11.3 {ChangeListboxView procedure} {
set log {}
.l yview 2
update
- list [.l yview] $log
+ list [format {%.6g %.6g} {*}[.l yview]] $log
} {{0.2 0.7} {{y 0.2 0.7}}}
test listbox-11.4 {ChangeListboxView procedure} {
catch {destroy .l}
@@ -1456,7 +1454,7 @@ test listbox-11.4 {ChangeListboxView procedure} {
set log {}
.l yview 8
update
- list [.l yview] $log
+ list [format {%.6g %.6g} {*}[.l yview]] $log
} {{0.5 1} {{y 0.5 1}}}
test listbox-11.5 {ChangeListboxView procedure} {
catch {destroy .l}
@@ -1468,7 +1466,7 @@ test listbox-11.5 {ChangeListboxView procedure} {
set log {}
.l yview 3
update
- list [.l yview] $log
+ list [format {%.6g %.6g} {*}[.l yview]] $log
} {{0.3 0.8} {}}
test listbox-11.6 {ChangeListboxView procedure, partial last line} {
mkPartial
@@ -1485,13 +1483,13 @@ test listbox-12.1 {ChangeListboxOffset procedure} {fonts} {
set log {}
.l xview 99
update
- list [.l xview] $log
+ list [format {%.6g %.6g} {*}[.l xview]] $log
} {{0.9 1} {{x 0.9 1}}}
test listbox-12.2 {ChangeListboxOffset procedure} {fonts} {
set log {}
.l xview moveto -.25
update
- list [.l xview] $log
+ list [format {%.6g %.6g} {*}[.l xview]] $log
} {{0 0.1} {{x 0 0.1}}}
test listbox-12.3 {ChangeListboxOffset procedure} {fonts} {
.l xview 10
@@ -1499,7 +1497,7 @@ test listbox-12.3 {ChangeListboxOffset procedure} {fonts} {
set log {}
.l xview 10
update
- list [.l xview] $log
+ list [format {%.6g %.6g} {*}[.l xview]] $log
} {{0.1 0.2} {}}
catch {destroy .l}
@@ -1516,7 +1514,7 @@ test listbox-13.1 {ListboxScanTo procedure} {fonts} {
.l scan mark 10 20
.l scan dragto [expr 10-$width] [expr 20-$height]
update
- list [.l xview] [.l yview]
+ list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0.2 0.4} {0.5 0.75}}
test listbox-13.2 {ListboxScanTo procedure} {fonts} {
.l yview 5
@@ -1524,10 +1522,10 @@ test listbox-13.2 {ListboxScanTo procedure} {fonts} {
.l scan mark 10 20
.l scan dragto 20 40
update
- set x [list [.l xview] [.l yview]]
+ set x [list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]]
.l scan dragto [expr 20-$width] [expr 40-$height]
update
- lappend x [.l xview] [.l yview]
+ lappend x [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0 0.2} {0 0.25} {0.2 0.4} {0.5 0.75}}
test listbox-13.3 {ListboxScanTo procedure} {fonts} {
.l yview moveto 1.0
@@ -1535,10 +1533,10 @@ test listbox-13.3 {ListboxScanTo procedure} {fonts} {
.l scan mark 10 20
.l scan dragto 5 10
update
- set x [list [.l xview] [.l yview]]
+ set x [list [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]]
.l scan dragto [expr 5+$width] [expr 10+$height]
update
- lappend x [.l xview] [.l yview]
+ lappend x [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
} {{0.8 1} {0.75 1} {0.64 0.84} {0.25 0.5}}
test listbox-14.1 {NearestListboxElement procedure, partial last line} {
@@ -1723,7 +1721,7 @@ test listbox-18.3 {ListboxUpdateVScrollbar procedure} {
set x
} {{{invalid command name "gorp"}} {invalid command name "gorp"
while executing
-"gorp 0 1"
+"gorp 0.0 1.0"
(vertical scrolling command executed by listbox)}}
if {[info exists bgerror]} {
rename bgerror {}
@@ -1755,7 +1753,7 @@ test listbox-19.2 {ListboxUpdateVScrollbar procedure} {
set x
} {{{invalid command name "bogus"}} {invalid command name "bogus"
while executing
-"bogus 0 1"
+"bogus 0.0 1.0"
(horizontal scrolling command executed by listbox)}}
set l [interp hidden]
@@ -1877,7 +1875,7 @@ test listbox-21.12 {ListboxListVarProc, cleanup item attributes} {
set x [list 0 1 2 3 4 5 6]
.l itemcget end -fg
} {}
-test listbox-21.12 {ListboxListVarProc, cleanup item attributes} {
+test listbox-21.12a {ListboxListVarProc, cleanup item attributes} {
catch {destroy .l}
set x [list a b c d e f g]
listbox .l -listvar x
@@ -1925,12 +1923,12 @@ test listbox-21.16 {ListboxListVarProc, update vertical scrollbar} {
.l yview scroll 3 units
update
set result {}
- lappend result [.l yview]
+ lappend result [format {%.6g %.6g} {*}[.l yview]]
set x [lreplace $x 3 3]
set x [lreplace $x 3 3]
set x [lreplace $x 3 3]
update
- lappend result [.l yview]
+ lappend result [format {%.6g %.6g} {*}[.l yview]]
set result
} [list {0.5 1} {0 1}]
@@ -2043,7 +2041,7 @@ test listbox-24.3 {itemcget} {
catch {.l itemcget 0} result
set result
} {wrong # args: should be ".l itemcget index option"}
-test listbox-24.3 {itemcget, itemcg shortcut} {
+test listbox-24.4 {itemcget, itemcg shortcut} {
catch {destroy .l}
listbox .l
.l insert end a b c d
@@ -2127,20 +2125,25 @@ test listbox-27.1 {widget deletion while active} {
} 0
test listbox-28.1 {listbox -activestyle} {
- catch {destroy .l}
+ destroy .l
listbox .l -activ non
.l cget -activestyle
} none
-test listbox-28.2 {listbox -activestyle} {
- catch {destroy .l}
+test listbox-28.2-nonwin {listbox -activestyle} {nonwin} {
+ destroy .l
+ listbox .l
+ .l cget -activestyle
+} dotbox
+test listbox-28.2-win {listbox -activestyle} {win} {
+ destroy .l
listbox .l
.l cget -activestyle
} underline
test listbox-28.3 {listbox -activestyle} {
- catch {destroy .l}
- listbox .l -activestyle dot
+ destroy .l
+ listbox .l -activestyle und
.l cget -activestyle
-} dotbox
+} underline
test listbox-29.1 {listbox selection behavior, -state disabled} {
destroy .l
@@ -2160,5 +2163,5 @@ deleteWindows
option clear
# cleanup
-::tcltest::cleanupTests
+cleanupTests
return