diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scrollbar.test | 31 | ||||
-rw-r--r-- | tests/spinbox.test | 68 |
2 files changed, 50 insertions, 49 deletions
diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 5c567c6..33fd592 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: scrollbar.test,v 1.21 2008/07/23 23:24:26 nijtmans Exp $ +# RCS: @(#) $Id: scrollbar.test,v 1.22 2008/10/06 23:42:58 patthoyts Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -216,13 +216,13 @@ test scrollbar-3.24 {ScrollbarWidgetCmd procedure, "delta" option} { list [catch {.s delta 18 xxyz} msg] $msg } {1 {expected integer but got "xxyz"}} test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} { - .s delta 20 0 + format {%.6g} [.s delta 20 0] } {0} test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} { - .s delta 0 20 + format {%.6g} [.s delta 0 20] } [format %.6g [expr 20.0/([getTroughSize .s]-1)]] test scrollbar-3.27 {ScrollbarWidgetCmd procedure, "delta" option} { - .s delta 0 -20 + format {%.6g} [.s delta 0 -20] } [format %.6g [expr -20.0/([getTroughSize .s]-1)]] test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} { toplevel .t -width 250 -height 100 @@ -230,8 +230,8 @@ test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} { scrollbar .t.s -orient horizontal -borderwidth 2 place .t.s -width 201 update - set result [list [.t.s delta 0 20] \ - [.t.s delta [expr [getTroughSize .t.s] - 1] 0]] + set result [list [format {%.6g} [.t.s delta 0 20]] \ + [format {%.6g} [.t.s delta [expr [getTroughSize .t.s] - 1] 0]]] destroy .t set result } {0 1} @@ -248,26 +248,27 @@ test scrollbar-3.32 {ScrollbarWidgetCmd procedure, "fraction" option} { list [catch {.s fraction 24 bogus} msg] $msg } {1 {expected integer but got "bogus"}} test scrollbar-3.33 {ScrollbarWidgetCmd procedure, "fraction" option} { - .s fraction 0 0 + format {%.6g} [.s fraction 0 0] } {0} test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} { - .s fraction 0 1000 + format {%.6g} [.s fraction 0 1000] } {1} test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { - .s fraction 4 21 + format {%.6g} [.s fraction 4 21] } [format %.6g [expr (21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)]] test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} unix { - .s fraction 4 179 + format {%.6g} [.s fraction 4 179] } {1} test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} { - .s fraction 4 [expr 200 - [testmetrics cyvscroll .s]] + format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s]]] } {1} test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} unix { - .s fraction 4 178 + format {%.6g} [.s fraction 4 178] } {0.993711} test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} { - expr [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s] - 2]] \ + expr \ + [format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s] - 2]]] \ == [format %g [expr (200.0 - [testmetrics cyvscroll .s]*2 - 2) \ / ($height - 1 - [testmetrics cyvscroll .s]*2)]] } 1 @@ -279,7 +280,7 @@ place .t.s -width 201 update test scrollbar-3.41 {ScrollbarWidgetCmd procedure, "fraction" option} { - .t.s fraction 100 0 + format {%.6g} [.t.s fraction 100 0] } {0.5} if {[testConstraint testmetrics]} { place configure .t.s -width [expr 2*[testmetrics cxhscroll .t.s]+1] @@ -288,7 +289,7 @@ if {[testConstraint testmetrics]} { } update test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} { - .t.s fraction 100 0 + format {%.6g} [.t.s fraction 100 0] } {0} destroy .t test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} { diff --git a/tests/spinbox.test b/tests/spinbox.test index 5393c4f..2f7d411 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: spinbox.test,v 1.11 2008/07/23 23:24:25 nijtmans Exp $ +# RCS: @(#) $Id: spinbox.test,v 1.12 2008/10/06 23:42:58 patthoyts Exp $ package require tcltest 2.2 namespace import ::tcltest::* @@ -1708,10 +1708,10 @@ test spinbox-3.70 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 5 - .e xview + format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e -} -result {0.0537634 0.268817} +} -result {0.053763 0.268817} test spinbox-3.71 {EntryWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1731,7 +1731,7 @@ test spinbox-3.72 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e xview 0 .e icursor 10 .e xview insert - .e xview + format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.107527 0.322581} @@ -1761,10 +1761,10 @@ test spinbox-3.75 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview moveto 0.5 - .e xview + format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e -} -result {0.505376 0.72043} +} -result {0.505376 0.720430} test spinbox-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e @@ -1796,7 +1796,7 @@ test spinbox-3.78 {EntryWidgetCmd procedure, "xview" widget command} -setup { update .e xview moveto 0 .e xview scroll 1 pages - .e xview + format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.193548 0.408602} @@ -1810,7 +1810,7 @@ test spinbox-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e xview moveto .9 update .e xview scroll -2 p - .e xview + format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.397849 0.612903} @@ -1903,14 +1903,14 @@ test spinbox-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup { # 0.106383 0.117021 0.117021 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] + lappend x [format {%.6f} [lindex [.e xview] 0]] } -cleanup { destroy .e -} -result {0.0957447 0.106383 0.117021} +} -result {0.095745 0.106383 0.117021} test spinbox-3.87 {EntryWidgetCmd procedure} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 @@ -2017,10 +2017,10 @@ test spinbox-4.7 {ConfigureEntry procedure} -setup { .e insert end "01234567890" update .e configure -width 5 - return $scrollInfo + return [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {0 0.363636} +} -result {0.000000 0.363636} test spinbox-4.8 {ConfigureEntry procedure} -constraints { fonts @@ -2206,10 +2206,10 @@ test spinbox-6.1 {InsertChars procedure} -setup { .e insert 0 abcde .e insert 2 XXX update - list [.e get] $contents $scrollInfo + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {abXXXcde abXXXcde {0 1}} +} -result {abXXXcde abXXXcde {0.000000 1.000000}} test spinbox-6.2 {InsertChars procedure} -setup { unset -nocomplain contents @@ -2221,10 +2221,10 @@ test spinbox-6.2 {InsertChars procedure} -setup { .e insert 0 abcde .e insert 500 XXX update - list [.e get] $contents $scrollInfo + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {abcdeXXX abcdeXXX {0 1}} +} -result {abcdeXXX abcdeXXX {0.000000 1.000000}} test spinbox-6.3 {InsertChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -2353,10 +2353,10 @@ test spinbox-7.1 {DeleteChars procedure} -setup { .e insert 0 abcde .e delete 2 4 update - list [.e get] $contents $scrollInfo + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {abe abe {0 1}} +} -result {abe abe {0.000000 1.000000}} test spinbox-7.2 {DeleteChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 @@ -2367,10 +2367,10 @@ test spinbox-7.2 {DeleteChars procedure} -setup { .e insert 0 abcde .e delete -2 2 update - list [.e get] $contents $scrollInfo + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {cde cde {0 1}} +} -result {cde cde {0.000000 1.000000}} test spinbox-7.3 {DeleteChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 @@ -2381,10 +2381,10 @@ test spinbox-7.3 {DeleteChars procedure} -setup { .e insert 0 abcde .e delete 3 1000 update - list [.e get] $contents $scrollInfo + list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {abc abc {0 1}} +} -result {abc abc {0.000000 1.000000}} test spinbox-7.4 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e @@ -3144,16 +3144,16 @@ test spinbox-15.1 {EntryVisibleRange procedure} -constraints fonts -body { pack .e update .e insert 0 "............................." - .e xview + format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e -} -result {0 0.827586} +} -result {0.000000 0.827586} test spinbox-16.2 {EntryVisibleRange procedure} -body { spinbox .e - .e xview + format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e -} -result {0 1} +} -result {0.000000 1.000000} test spinbox-16.1 {EntryUpdateScrollbar procedure} -body { @@ -3162,27 +3162,27 @@ test spinbox-16.1 {EntryUpdateScrollbar procedure} -body { .e delete 0 end .e insert 0 123 update - return $scrollInfo + return [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {0 1} +} -result {0.000000 1.000000} test spinbox-16.2 {EntryUpdateScrollbar procedure} -body { spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e .e insert 0 0123456789abcdef .e xview 3 update - return $scrollInfo + return [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e -} -result {0.1875 0.8125} +} -result {0.187500 0.812500} test spinbox-16.3 {EntryUpdateScrollbar procedure} -body { spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12} pack .e .e insert 0 abcdefghijklmnopqrs .e xview 6 update - return $scrollInfo + return [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {0.315789 0.842105} @@ -3201,7 +3201,7 @@ test spinbox-16.4 {EntryUpdateScrollbar procedure} -setup { rename bgerror {} } -result {{invalid command name "thisisnotacommand"} {invalid command name "thisisnotacommand" while executing -"thisisnotacommand 0 1" +"thisisnotacommand 0.0 1.0" (horizontal scrolling command executed by .e)}} |