diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/entry.test | 23 | ||||
| -rw-r--r-- | tests/scrollbar.test | 5 | ||||
| -rw-r--r-- | tests/spinbox.test | 23 | ||||
| -rw-r--r-- | tests/textDisp.test | 15 |
4 files changed, 39 insertions, 27 deletions
diff --git a/tests/entry.test b/tests/entry.test index 931221e..f1de5ce 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -14,6 +14,8 @@ tcltest::loadTestedCommands # Import utility procs for specific functional areas namespace import -force ::tk::test::scroll::* +set scrollCmdPrefix [list scrollInfo set] + # For trace add variable proc override args { global x @@ -1684,7 +1686,7 @@ test entry-5.7 {ConfigureEntry procedure} -setup { entry .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e ; update idletasks } -body { - .e configure -font {Courier -12} -width 4 -xscrollcommand [list scrollInfo set] + .e configure -font {Courier -12} -width 4 -xscrollcommand $scrollCmdPrefix .e insert end "01234567890" update scrollInfo set wrong @@ -1930,7 +1932,7 @@ test entry-7.1 {InsertChars procedure} -setup { pack .e ; update idletasks focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix update scrollInfo set wrong .e insert 0 abcde @@ -1947,7 +1949,7 @@ test entry-7.2 {InsertChars procedure} -setup { pack .e ; update idletasks focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix update scrollInfo set wrong .e insert 0 abcde @@ -2017,7 +2019,7 @@ test entry-7.7 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e ; update idletasks } -body { - .e configure -xscrollcommand [list scrollInfo set] + .e configure -xscrollcommand $scrollCmdPrefix .e insert 0 0123456789 .e icursor 4 .e insert 4 XXX @@ -2081,7 +2083,7 @@ test entry-8.1 {DeleteChars procedure} -setup { pack .e ; update idletasks focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix update scrollInfo set wrong .e insert 0 abcde @@ -2097,7 +2099,7 @@ test entry-8.2 {DeleteChars procedure} -setup { pack .e ; update idletasks focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix update scrollInfo set wrong .e insert 0 abcde @@ -2113,7 +2115,7 @@ test entry-8.3 {DeleteChars procedure} -setup { pack .e ; update idletasks focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix update scrollInfo set wrong .e insert 0 abcde @@ -2960,7 +2962,7 @@ test entry-16.4 {EntryVisibleRange procedure} -body { test entry-17.1 {EntryUpdateScrollbar procedure} -body { - entry .e -width 10 -xscrollcommand [list scrollInfo set] -font {Courier -12} + entry .e -width 10 -xscrollcommand $scrollCmdPrefix -font {Courier -12} pack .e update scrollInfo set wrong @@ -2972,7 +2974,7 @@ test entry-17.1 {EntryUpdateScrollbar procedure} -body { destroy .e } -result {0.000000 1.000000} test entry-17.2 {EntryUpdateScrollbar procedure} -body { - entry .e -width 10 -xscrollcommand [list scrollInfo set] -font {Courier -12} + entry .e -width 10 -xscrollcommand $scrollCmdPrefix -font {Courier -12} pack .e update scrollInfo set wrong @@ -2984,7 +2986,7 @@ test entry-17.2 {EntryUpdateScrollbar procedure} -body { destroy .e } -result {0.187500 0.812500} test entry-17.3 {EntryUpdateScrollbar procedure} -body { - entry .e -width 10 -xscrollcommand [list scrollInfo set] -font {Courier -12} + entry .e -width 10 -xscrollcommand $scrollCmdPrefix -font {Courier -12} pack .e update scrollInfo set wrong @@ -3627,6 +3629,7 @@ test entry-25.3 {Bug [2a32225cd1] - Navigation in a password made of several wor # # option clear +unset scrollCmdPrefix namespace forget ::tk::test::scroll::* cleanupTests return diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 298a28e..eb1078c 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -14,6 +14,8 @@ tcltest::loadTestedCommands # Import utility procs for specific functional areas namespace import -force ::tk::test::scroll::* +set scrollCmdPrefix [list scrollInfo set] + proc getTroughSize {w} { if {[testConstraint testmetrics]} { # Only Windows has [testmetrics] @@ -135,7 +137,7 @@ test scrollbar-2.5 {Tk_ScrollbarCmd procedure} -setup { destroy .s } -result .s -scrollbar .s -orient vertical -command [list scrollInfo set] -highlightthickness 2 -bd 2 +scrollbar .s -orient vertical -command $scrollCmdPrefix -highlightthickness 2 -bd 2 pack .s -side right -fill y update test scrollbar-3.1 {ScrollbarWidgetCmd procedure} { @@ -758,6 +760,7 @@ catch {destroy .t} # CLEANUP # +unset scrollCmdPrefix namespace forget ::tk::test::scroll::* cleanupTests return diff --git a/tests/spinbox.test b/tests/spinbox.test index dc6717d..ee1fb30 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -14,6 +14,8 @@ tcltest::loadTestedCommands # Import utility procs for specific functional areas namespace import -force ::tk::test::scroll::* +set scrollCmdPrefix [list scrollInfo set] + # For trace add variable proc override args { global x @@ -2009,7 +2011,7 @@ test spinbox-5.7 {ConfigureSpinbox procedure} -setup { spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { - .e configure -font {Courier -12} -width 4 -xscrollcommand [list scrollInfo set] + .e configure -font {Courier -12} -width 4 -xscrollcommand $scrollCmdPrefix .e insert end "01234567890" update scrollInfo set wrong @@ -2215,7 +2217,7 @@ test spinbox-7.1 {InsertChars procedure} -setup { pack .e focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix .e insert 0 abcde update scrollInfo set wrong @@ -2232,7 +2234,7 @@ test spinbox-7.2 {InsertChars procedure} -setup { pack .e focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix .e insert 0 abcde update scrollInfo set wrong @@ -2302,7 +2304,7 @@ test spinbox-7.7 {InsertChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { - .e configure -xscrollcommand [list scrollInfo set] + .e configure -xscrollcommand $scrollCmdPrefix .e insert 0 0123456789 .e icursor 4 .e insert 4 XXX @@ -2366,7 +2368,7 @@ test spinbox-8.1 {DeleteChars procedure} -setup { pack .e focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix .e insert 0 abcde update scrollInfo set wrong @@ -2382,7 +2384,7 @@ test spinbox-8.2 {DeleteChars procedure} -setup { pack .e focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix .e insert 0 abcde update scrollInfo set wrong @@ -2398,7 +2400,7 @@ test spinbox-8.3 {DeleteChars procedure} -setup { pack .e focus .e } -body { - .e configure -textvariable contents -xscrollcommand [list scrollInfo set] + .e configure -textvariable contents -xscrollcommand $scrollCmdPrefix .e insert 0 abcde update scrollInfo set wrong @@ -3199,7 +3201,7 @@ test spinbox-16.2 {SpinboxVisibleRange procedure} -body { test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body { - spinbox .e -width 10 -xscrollcommand [list scrollInfo set] -font {Courier -12} + spinbox .e -width 10 -xscrollcommand $scrollCmdPrefix -font {Courier -12} pack .e update scrollInfo set wrong @@ -3211,7 +3213,7 @@ test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body { destroy .e } -result {0.000000 1.000000} test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body { - spinbox .e -width 10 -xscrollcommand [list scrollInfo set] -font {Courier -12} + spinbox .e -width 10 -xscrollcommand $scrollCmdPrefix -font {Courier -12} pack .e .e insert 0 0123456789abcdef update @@ -3223,7 +3225,7 @@ test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body { destroy .e } -result {0.187500 0.812500} test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body { - spinbox .e -width 10 -xscrollcommand [list scrollInfo set] -font {Courier -12} + spinbox .e -width 10 -xscrollcommand $scrollCmdPrefix -font {Courier -12} pack .e update scrollInfo set wrong @@ -3918,6 +3920,7 @@ test spinbox-25.3 {Bugs [2a32225cd1] and [9fa3e08243]} -setup { # # option clear +unset scrollCmdPrefix namespace forget ::tk::test::scroll::* cleanupTests return diff --git a/tests/textDisp.test b/tests/textDisp.test index a7c4aae..1d17591 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -14,6 +14,8 @@ namespace import -force tcltest::test # Import utility procs for specific functional areas namespace import -force ::tk::test::scroll::* +set scrollCmdPrefix [list scrollInfo set] + # The delay procedure needs to wait long enough for the asynchronous updates # performed by the text widget to run. proc delay {} { @@ -92,7 +94,7 @@ Some of the upcoming tests will probably fail." # Option -width 20 (characters) below is a fundamental assumption of many # upcoming tests when wrapping enters in play # Also -height 10 (lines) is an important assumption -text .t -font $fixedFont -width 20 -height 10 -yscrollcommand [list scrollInfo set] +text .t -font $fixedFont -width 20 -height 10 -yscrollcommand $scrollCmdPrefix pack .t -expand 1 -fill both .t tag configure big -font $bigFont .t debug on @@ -1089,7 +1091,7 @@ test textDisp-6.8 {DisplayText, vertical scrollbar updates} { .t count -update -ypixels 1.0 end ; update scrollInfo get } [list 0.0 [expr {10.0/13}]] -.t configure -yscrollcommand {} -xscrollcommand [list scrollInfo set] +.t configure -yscrollcommand {} -xscrollcommand $scrollCmdPrefix test textDisp-6.9 {DisplayText, horizontal scrollbar updates} { .t configure -wrap none .t delete 1.0 end @@ -1331,7 +1333,7 @@ test textDisp-8.10 {TkTextChanged} haveBigFontTwiceLargerThanTextFont { test textDisp-8.11 {TkTextChanged, scrollbar notification when changes are off-screen} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n" - .t configure -yscrollcommand [list scrollInfo set] + .t configure -yscrollcommand $scrollCmdPrefix update scrollInfo set "" .t insert end "a\nb\nc\n" @@ -2666,7 +2668,7 @@ test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} { update lequal [list $x [.t index @0,0]] $expected } {1} -.t configure -xscrollcommand [list scrollInfo set] -yscrollcommand {} +.t configure -xscrollcommand $scrollCmdPrefix -yscrollcommand {} test textDisp-18.1 {GetXView procedure} { .t configure -wrap none @@ -2768,7 +2770,7 @@ test textDisp-18.8 {GetXView procedure} { catch {rename bgerror {}} catch {rename bogus {}} -.t configure -xscrollcommand {} -yscrollcommand [list scrollInfo set] +.t configure -xscrollcommand {} -yscrollcommand $scrollCmdPrefix test textDisp-19.1 {GetYView procedure} { .t configure -wrap char .t delete 1.0 end @@ -3105,7 +3107,7 @@ test textDisp-19.15 {GetYView procedure} { .t delete 1.0 end update rename bgerror {} - .t configure -yscrollcommand [list scrollInfo set] + .t configure -yscrollcommand $scrollCmdPrefix set x } {{{scrolling error}} {scrolling error while executing @@ -4923,6 +4925,7 @@ test textDisp-36.1 {Display bug with 'yview insert'} -constraints {knownBug} -se # CLEANUP # +unset scrollCmdPrefix namespace forget ::tk::test::scroll::* deleteWindows option clear |
