diff options
Diffstat (limited to 'tests/spinbox.test')
-rw-r--r-- | tests/spinbox.test | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/tests/spinbox.test b/tests/spinbox.test index 7b7da12..0fe1c33 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -5,10 +5,7 @@ # 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 proc scroll args { @@ -446,8 +443,8 @@ test spinbox-3.64 {SpinboxWidgetCmd procedure, "selection to" widget command} { } {1 {wrong # args: should be ".e selection to index"}} test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} { .e xview 5 - .e xview -} {0.0537634 0.268817} + format {%.6f %.6f} {*}[.e xview] +} {0.053763 0.268817} test spinbox-3.66 {SpinboxWidgetCmd procedure, "xview" widget command} { list [catch {.e xview gorp} msg] $msg } {1 {bad spinbox index "gorp"}} @@ -455,7 +452,7 @@ test spinbox-3.67 {SpinboxWidgetCmd procedure, "xview" widget command} { .e xview 0 .e icursor 10 .e xview insert - .e xview + format {%.6f %.6f} {*}[.e xview] } {0.107527 0.322581} test spinbox-3.68 {SpinboxWidgetCmd procedure, "xview" widget command} { list [catch {.e xview moveto foo bar} msg] $msg @@ -465,7 +462,7 @@ test spinbox-3.69 {SpinboxWidgetCmd procedure, "xview" widget command} { } {1 {expected floating-point number but got "foo"}} test spinbox-3.70 {SpinboxWidgetCmd procedure, "xview" widget command} { .e xview moveto 0.5 - .e xview + format {%.6f %.6f} {*}[.e xview] } {0.505376 0.72043} test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} { list [catch {.e xview scroll 24} msg] $msg @@ -476,13 +473,13 @@ test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} { test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} { .e xview moveto 0 .e xview scroll 1 pages - .e xview + format {%.6f %.6f} {*}[.e xview] } {0.193548 0.408602} test spinbox-3.74 {SpinboxWidgetCmd procedure, "xview" widget command} { .e xview moveto .9 update .e xview scroll -2 p - .e xview + format {%.6f %.6f} {*}[.e xview] } {0.397849 0.612903} test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} { .e xview 30 @@ -520,12 +517,12 @@ test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} { set x {} .e xview moveto .1 - lappend x [lindex [.e xview] 0] + lappend x [format {%.6f} [lindex [.e xview] 0]] .e xview moveto .11 - lappend x [lindex [.e xview] 0] + lappend x [format {%.6f} [lindex [.e xview] 0]] .e xview moveto .12 - lappend x [lindex [.e xview] 0] -} {0.0957447 0.106383 0.117021} + lappend x [format {%.6f} [lindex [.e xview] 0]] +} {0.095745 0.106383 0.117021} test spinbox-3.82 {SpinboxWidgetCmd procedure} { list [catch {.e gorp} msg] $msg } {1 {bad option "gorp": must be bbox, cget, configure, delete, get, icursor, identify, index, insert, invoke, scan, selection, set, validate, or xview}} @@ -604,8 +601,8 @@ test spinbox-5.7 {ConfigureSpinbox procedure} { .e insert end "01234567890" update .e configure -width 5 - set scrollInfo -} {0 0.363636} + format {%.6f %.6f} {*}$scrollInfo +} {0.000000 0.363636} test spinbox-5.8 {ConfigureSpinbox procedure} {fonts} { catch {destroy .e} spinbox .e -width 0 @@ -729,15 +726,15 @@ test spinbox-7.1 {InsertChars procedure} { .e insert 0 abcde .e insert 2 XXX update - list [.e get] $contents $scrollInfo -} {abXXXcde abXXXcde {0 1}} + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] +} {abXXXcde abXXXcde {0.000000 1.000000}} test spinbox-7.2 {InsertChars procedure} { .e delete 0 end .e insert 0 abcde .e insert 500 XXX update - list [.e get] $contents $scrollInfo -} {abcdeXXX abcdeXXX {0 1}} + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] +} {abcdeXXX abcdeXXX {0.000000 1.000000}} test spinbox-7.3 {InsertChars procedure} { .e delete 0 end .e insert 0 0123456789 @@ -823,22 +820,22 @@ test spinbox-8.1 {DeleteChars procedure} { .e insert 0 abcde .e delete 2 4 update - list [.e get] $contents $scrollInfo -} {abe abe {0 1}} + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] +} {abe abe {0.000000 1.000000}} test spinbox-8.2 {DeleteChars procedure} { .e delete 0 end .e insert 0 abcde .e delete -2 2 update - list [.e get] $contents $scrollInfo -} {cde cde {0 1}} + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] +} {cde cde {0.000000 1.000000}} test spinbox-8.3 {DeleteChars procedure} { .e delete 0 end .e insert 0 abcde .e delete 3 1000 update - list [.e get] $contents $scrollInfo -} {abc abc {0 1}} + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] +} {abc abc {0.000000 1.000000}} test spinbox-8.4 {DeleteChars procedure} { .e delete 0 end .e insert 0 0123456789abcde @@ -1134,26 +1131,26 @@ test spinbox-13.9 {GetSpinboxIndex procedure} { list [.e index sel.first] [.e index sel.last] } {1 6} selection clear .e -test spinbox-13.10 {GetSpinboxIndex procedure} {unixOnly} { +test spinbox-13.10 {GetSpinboxIndex procedure} unix { # On unix, when selection is cleared, spinbox widget's internal # selection range is reset. list [catch {.e index sel.first} msg] $msg } {1 {selection isn't in widget .e}} -test spinbox-13.11 {GetSpinboxIndex procedure} {macOrPc} { +test spinbox-13.11 {GetSpinboxIndex procedure} win { # On mac and pc, when selection is cleared, spinbox widget remembers # last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. list [catch {selection get}] [.e index sel.first] } {1 1} -test spinbox-13.12 {GetSpinboxIndex procedure} {unixOnly} { +test spinbox-13.12 {GetSpinboxIndex procedure} unix { list [catch {.e index sbogus} msg] $msg } {1 {selection isn't in widget .e}} -test spinbox-13.13 {GetSpinboxIndex procedure} {macOrPc} { +test spinbox-13.13 {GetSpinboxIndex procedure} win { list [catch {.e index sbogus} msg] $msg } {1 {bad spinbox index "sbogus"}} -test spinbox-13.14 {GetSpinboxIndex procedure} {macOrPc} { +test spinbox-13.14 {GetSpinboxIndex procedure} win { list [catch {selection get}] [catch {.e index sbogus}] } {1 1} test spinbox-13.15 {GetSpinboxIndex procedure} { @@ -1237,12 +1234,12 @@ update test spinbox-16.1 {SpinboxVisibleRange procedure} {fonts} { .e delete 0 end .e insert 0 ............................. - .e xview -} {0 0.827586} -test spinbox-15.4 {SpinboxVisibleRange procedure} { + format {%.6f %.6f} {*}[.e xview] +} {0.000000 0.827586} +test spinbox-16.2 {SpinboxVisibleRange procedure} { .e delete 0 end - .e xview -} {0 1} + format {%.6f %.6f} {*}[.e xview] +} {0.000000 1.000000} catch {destroy .e} spinbox .e -width 10 -xscrollcommand scroll -font $fixed @@ -1252,21 +1249,21 @@ test spinbox-17.1 {SpinboxUpdateScrollbar procedure} { .e delete 0 end .e insert 0 123 update - set scrollInfo -} {0 1} + format {%.6f %.6f} {*}$scrollInfo +} {0.000000 1.000000} test spinbox-17.2 {SpinboxUpdateScrollbar procedure} { .e delete 0 end .e insert 0 0123456789abcdef .e xview 3 update - set scrollInfo -} {0.1875 0.8125} + format {%.6f %.6f} {*}$scrollInfo +} {0.187500 0.812500} test spinbox-17.3 {SpinboxUpdateScrollbar procedure} { .e delete 0 end .e insert 0 abcdefghijklmnopqrs .e xview 6 update - set scrollInfo + format {%.6f %.6f} {*}$scrollInfo } {0.315789 0.842105} test spinbox-17.4 {SpinboxUpdateScrollbar procedure} { destroy .e @@ -1282,7 +1279,7 @@ test spinbox-17.4 {SpinboxUpdateScrollbar procedure} { list $x $errorInfo } {{invalid command name "thisisnotacommand"} {invalid command name "thisisnotacommand" while executing -"thisisnotacommand 0 1" +"thisisnotacommand 0.0 1.0" (horizontal scrolling command executed by .e)}} set l [interp hidden] @@ -1598,5 +1595,5 @@ catch {unset ::e ::vVals} option clear # cleanup -::tcltest::cleanupTests +cleanupTests return |