diff options
author | vincentdarley <vincentdarley> | 2003-11-15 02:33:47 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2003-11-15 02:33:47 (GMT) |
commit | 45415317ec3978b13c22b3af4800a6db1456364f (patch) | |
tree | ba9e32dbe2f68359525d8a6970e094993a73e5c4 /tests | |
parent | ca9dec159fe7b62d645e37f427b3e704169a1fea (diff) | |
download | tk-45415317ec3978b13c22b3af4800a6db1456364f.zip tk-45415317ec3978b13c22b3af4800a6db1456364f.tar.gz tk-45415317ec3978b13c22b3af4800a6db1456364f.tar.bz2 |
fix two more old text widget bugs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/textDisp.test | 114 |
1 files changed, 102 insertions, 12 deletions
diff --git a/tests/textDisp.test b/tests/textDisp.test index 9373f1d..30495b8 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textDisp.test,v 1.17 2003/11/13 18:30:42 vincentdarley Exp $ +# RCS: @(#) $Id: textDisp.test,v 1.18 2003/11/15 02:33:51 vincentdarley Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -1582,7 +1582,7 @@ test textDisp-13.9 {TkTextSeeCmd procedure} {textfonts} { lappend x [.t bbox 30.65] .t see 30.90 lappend x [.t bbox 30.90] -} [list [list 80 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 80 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight]] +} [list [list 74 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 138 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 138 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight] [list 74 [expr {9*$fixedDiff/2 + 66}] 7 $fixedHeight]] test textDisp-13.10 {TkTextSeeCmd procedure} {} { # SF Bug 641778 set w .tsee @@ -1640,7 +1640,7 @@ test textDisp-14.7 {TkTextXviewCmd procedure} { .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto .3 .t xview -} {0.303571428571 0.660714285714} +} {0.301020408163 0.658163265306} test textDisp-14.8 {TkTextXviewCmd procedure} { .t delete 1.0 end .t insert end xxxxxxxxx\n @@ -1659,10 +1659,10 @@ test textDisp-14.9 {TkTextXviewCmd procedure} { } {0.642857142857 1.0} test textDisp-14.10 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a} msg] $msg -} {1 {wrong # args: should be ".t xview scroll number units|pages"}} +} {1 {wrong # args: should be ".t xview scroll number units|pages|pixels"}} test textDisp-14.11 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a b c} msg] $msg -} {1 {wrong # args: should be ".t xview scroll number units|pages"}} +} {1 {wrong # args: should be ".t xview scroll number units|pages|pixels"}} test textDisp-14.12 {TkTextXviewCmd procedure} { list [catch {.t xview scroll gorp units} msg] $msg } {1 {expected integer but got "gorp"}} @@ -1672,9 +1672,9 @@ test textDisp-14.13 {TkTextXviewCmd procedure} { .t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto 0 - .t xview scroll 2 p + .t xview scroll 2 pa set x [.t index @0,22] - .t xview scroll -1 p + .t xview scroll -1 pa lappend x [.t index @0,22] .t xview scroll -2 pages lappend x [.t index @0,22] @@ -1696,7 +1696,7 @@ test textDisp-14.14 {TkTextXviewCmd procedure} { } {2.21 2.20 2.99 2.84} test textDisp-14.15 {TkTextXviewCmd procedure} { list [catch {.t xview scroll 14 globs} msg] $msg -} {1 {bad argument "globs": must be units or pages}} +} {1 {bad argument "globs": must be units, pages or pixels}} test textDisp-14.16 {TkTextXviewCmd procedure} { list [catch {.t xview flounder} msg] $msg } {1 {unknown option "flounder": must be moveto or scroll}} @@ -2033,7 +2033,7 @@ test textDisp-17.7 {TkTextScanCmd procedure} {textfonts} { set x [.t index @0,0] .t scan dragto 0 [expr {70 + $fixedDiff}] list $x [.t index @0,0] -} {6.13 2.6} +} {6.12 2.5} test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} { .t yview 1.0 .t xview moveto 0 @@ -2048,7 +2048,7 @@ test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} { .t xview scroll 100 units .t scan mark 90 60 .t scan dragto 10 0 - .t scan dragto 15 5 + .t scan dragto 14 5 .t index @0,0 } {18.44} .t configure -wrap word @@ -3230,6 +3230,97 @@ test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {textfonts update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] } [list {0.0233333333333 0.49} 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]] +test textDisp-29.2.1 {miscellaneous: lines wrap but are still too long} {textfonts} { + catch {destroy .t2} + toplevel .t2 + wm geometry .t2 +0+0 + text .t2.t -width 20 -height 10 -font $fixedFont \ + -wrap none -xscrollcommand ".t2.s set" + pack .t2.t -side top + scrollbar .t2.s -orient horizontal -command ".t2.t xview" + pack .t2.s -side bottom -fill x + .t2.t insert end 1\n + .t2.t insert end [string repeat "abc" 30] + .t2.t xview scroll 5 unit + update + .t2.t xview +} {0.0555555555556 0.277777777778} +test textDisp-29.2.2 {miscellaneous: lines wrap but are still too long} {textfonts} { + catch {destroy .t2} + toplevel .t2 + wm geometry .t2 +0+0 + text .t2.t -width 20 -height 10 -font $fixedFont \ + -wrap char -xscrollcommand ".t2.s set" + pack .t2.t -side top + scrollbar .t2.s -orient horizontal -command ".t2.t xview" + pack .t2.s -side bottom -fill x + .t2.t insert end 123 + frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised + .t2.t window create 1.1 -window .t2.t.f + .t2.t xview scroll 2 unit + update + list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] +} [list {0.0466666666667 0.513333333333} 300x50+-9+[expr {$fixedDiff + 18}] {}] +test textDisp-29.2.3 {miscellaneous: lines wrap but are still too long} {textfonts} { + catch {destroy .t2} + toplevel .t2 + wm geometry .t2 +0+0 + text .t2.t -width 20 -height 10 -font $fixedFont \ + -wrap char -xscrollcommand ".t2.s set" + pack .t2.t -side top + scrollbar .t2.s -orient horizontal -command ".t2.t xview" + pack .t2.s -side bottom -fill x + .t2.t insert end 123 + frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised + .t2.t window create 1.1 -window .t2.t.f + .t2.t xview scroll 7 pixels + update + list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] +} [list {0.0233333333333 0.49} 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]] +test textDisp-29.2.4 {miscellaneous: lines wrap but are still too long} {textfonts} { + catch {destroy .t2} + toplevel .t2 + wm geometry .t2 +0+0 + text .t2.t -width 20 -height 10 -font $fixedFont \ + -wrap char -xscrollcommand ".t2.s set" + pack .t2.t -side top + scrollbar .t2.s -orient horizontal -command ".t2.t xview" + pack .t2.s -side bottom -fill x + .t2.t insert end 123 + frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised + .t2.t window create 1.1 -window .t2.t.f + .t2.t xview scroll 17 pixels + update + list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] +} [list {0.0566666666667 0.523333333333} 300x50+-12+[expr {$fixedDiff + 18}] {}] +test textDisp-29.2.5 {miscellaneous: can show last character} { + catch {destroy .t2} + toplevel .t2 + wm geometry .t2 121x141+200+200 + text .t2.t -width 5 -height 5 -font {Arial 10} \ + -wrap none -xscrollcommand ".t2.s set" \ + -bd 2 -highlightthickness 0 -padx 1 + .t2.t insert end "WWWWWWWWWWWWi" + scrollbar .t2.s -orient horizontal -command ".t2.t xview" + grid .t2.t -row 0 -column 0 -sticky nsew + grid .t2.s -row 1 -column 0 -sticky ew + grid columnconfigure .t2 0 -weight 1 + grid rowconfigure .t2 0 -weight 1 + grid rowconfigure .t2 1 -weight 0 + update ; update + set xv [.t2.t xview] + set xd [expr {[lindex $xv 1] - [lindex $xv 0]}] + .t2.t xview moveto [expr {1.0-$xd}] + set iWidth [lindex [.t2.t bbox end-2c] 2] + .t2.t xview scroll 2 units + set iWidth2 [lindex [.t2.t bbox end-2c] 2] + + if {($iWidth == $iWidth2) && $iWidth > 2} { + set result "correct" + } else { + set result "not correct" + } +} {correct} test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {textfonts} { catch {destroy .t2} toplevel .t2 @@ -3246,8 +3337,7 @@ test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {textfonts .t2.t xview scroll 200 units update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] -} [list {0.536666666667 1.0} 300x50+-156+[expr {$fixedDiff + 18}] {}] - +} [list {0.533333333333 1.0} 300x50+-155+[expr {$fixedDiff + 18}] {}] test textDisp-30.1 {elidden text complications} {knownBug} { .t2.t delete 1.0 end .t2.t insert 1.0 "1111\n2222\n3333" |