summaryrefslogtreecommitdiffstats
path: root/tests/textDisp.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/textDisp.test')
-rw-r--r--tests/textDisp.test100
1 files changed, 51 insertions, 49 deletions
diff --git a/tests/textDisp.test b/tests/textDisp.test
index ebaa6d8..f2eb47d 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -39,9 +39,9 @@ option add *Text.highlightThickness $twht
catch {destroy .f .t}
frame .f -width 100 -height 20
-pack append . .f left
+pack .f -side left
-set fixedFont {Courier -12}
+set fixedFont {"Courier New" -12}
# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics $fixedFont -linespace]
# 7 on all platforms
@@ -65,7 +65,7 @@ set bigAscent [font metrics $bigFont -ascent]
set ascentDiff [expr {$bigAscent - $fixedAscent}]
text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll
-pack append . .t {top expand fill}
+pack .t -expand 1 -fill both
.t tag configure big -font $bigFont
.t debug on
wm geometry . {}
@@ -253,8 +253,8 @@ test textDisp-2.5 {LayoutDLine, word wrap} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This isx some sample text for testing."
- list [.t bbox 1.13] [.t bbox 1.14] [.t bbox 1.19]
-} [list [list 96 5 49 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 40 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+ list [.t bbox 1.13] [.t bbox 1.19] [.t bbox 1.20] [.t bbox 1.21]
+} [list [list 96 5 $fixedWidth $fixedHeight] [list 138 5 $fixedWidth $fixedHeight] [list 145 5 0 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] $fixedWidth $fixedHeight]]
test textDisp-2.6 {LayoutDLine, word wrap} {
.t configure -wrap word
.t delete 1.0 end
@@ -353,16 +353,16 @@ test textDisp-2.16 {LayoutDLine, justification} {textfonts} {
.t tag configure x -justify center
.t tag add x 1.1 1.20
.t tag add x 1.21 1.end
- list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
-} [list [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 43 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+ list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.41] [.t bbox 2.0]
+} [list [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 61 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
test textDisp-2.17 {LayoutDLine, justification} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
- .t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
+ .t insert 1.0 "Lots of very long words, enough to force word wrap\nThen\nmore lines"
.t tag configure x -justify center
- .t tag add x 1.20
- list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
-} [list [list 5 5 7 $fixedHeight] [list 19 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+ .t tag add x 1.18
+ list [.t bbox 1.0] [.t bbox 1.18] [.t bbox 1.35] [.t bbox 2.0]
+} [list [list 5 5 7 $fixedHeight] [list 15 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
test textDisp-2.18 {LayoutDLine, justification} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
@@ -599,7 +599,7 @@ test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
wm overrideredirect . 1
}
frame .f2 -width 20 -height 100
- pack before .f .f2 top
+ pack .f2 -before .f
wm geom . 103x103
update
.t configure -wrap none -borderwidth 2
@@ -1952,13 +1952,15 @@ test textDisp-15.8 {Scrolling near end of window} {
.tf.f.t insert end "\nLine $i"
}
update ; after 1000 ; update
+ set refind [.tf.f.t index @0,[winfo height .tf.f.t]]
# Should scroll and should not crash!
.tf.f.t yview scroll 1 unit
# Check that it has scrolled
- set res [.tf.f.t index @0,[expr [winfo height .tf.f.t] - 15]]
+ set newind [.tf.f.t index @0,[winfo height .tf.f.t]]
+ set res [.tf.f.t compare $newind > $refind]
destroy .tf
set res
-} {12.0}
+} {1}
.t configure -wrap char
.t delete 1.0 end
@@ -2337,7 +2339,7 @@ test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} {textfonts} {
set x [.t index @0,0]
.t scan dragto 0 [expr {70 + $fixedDiff}]
list $x [.t index @0,0]
-} {9.15 8.31}
+} {9.0 8.0}
.t configure -xscrollcommand scroll -yscrollcommand {}
test textDisp-18.1 {GetXView procedure} {
.t configure -wrap none
@@ -2563,7 +2565,7 @@ test textDisp-19.10.1 {Widget manipulation causes height miscount} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
.t yview insert
update
.t count -update -ypixels 1.0 end
@@ -2577,7 +2579,7 @@ test textDisp-19.11 {GetYView procedure} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
.t yview insert
update
.t count -update -ypixels 1.0 end
@@ -2599,7 +2601,7 @@ test textDisp-19.11.5.1 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.5
} {0}
test textDisp-19.11.6 {TextWidgetCmd procedure, "count -displaylines"} {
- .t count -displaylines 16.0 16.20
+ .t count -displaylines 16.0 16.24
} {1}
test textDisp-19.11.7 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.40
@@ -2652,14 +2654,14 @@ test textDisp-19.11.17 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
[.t index "13.0 +2d lines"] [.t index "13.1 +3d lines"] \
[.t index "13.0 +4d lines"]
-} {15.5 16.0 15.0 16.0 16.15 16.33}
+} {15.5 16.0 15.0 16.0 16.21 16.39}
test textDisp-19.11.18 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
list [.t index "15.5 -2d lines"] \
[.t index "16.0 -2d lines"] [.t index "15.0 -2d lines"] \
- [.t index "16.0 -3d lines"] [.t index "16.17 -4d lines"] \
- [.t index "16.36 -5d lines"]
+ [.t index "16.0 -3d lines"] [.t index "16.23 -4d lines"] \
+ [.t index "16.42 -5d lines"]
} {11.5 14.0 11.0 11.0 11.2 11.3}
test textDisp-19.11.19 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
@@ -2673,14 +2675,14 @@ test textDisp-19.11.20 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
[.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \
[.t index "13.0 +4d lines"]
-} {16.38 16.50 16.33 16.50 16.67 17.0}
+} {16.44 16.57 16.39 16.57 16.74 17.0}
test textDisp-19.11.21 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
- list [.t index "16.38 -2d lines"] \
- [.t index "16.50 -3d lines"] [.t index "16.33 -2d lines"] \
- [.t index "16.53 -4d lines"] [.t index "16.69 -4d lines"] \
- [.t index "17.1 -5d lines"]
+ list [.t index "16.44 -2d lines"] \
+ [.t index "16.57 -3d lines"] [.t index "16.39 -2d lines"] \
+ [.t index "16.60 -4d lines"] [.t index "16.76 -4d lines"] \
+ [.t index "17.0 -5d lines"]
} {11.5 11.0 11.0 10.3 11.2 11.0}
test textDisp-19.11.22 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
@@ -2688,7 +2690,7 @@ test textDisp-19.11.22 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "end -3d lines"] [.t index "1.0 -2d lines"] \
[.t index "1.0 +4d lines"] [.t index "1.0 +50d lines"] \
[.t index "end -50d lines"]
-} {17.0 16.33 1.0 5.0 17.0 1.0}
+} {17.0 16.39 1.0 5.0 17.0 1.0}
test textDisp-19.11.23 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.3" "16.0 +1displaylines"
@@ -2697,7 +2699,7 @@ test textDisp-19.11.23 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
[.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \
[.t index "13.0 +4d lines"]
-} {16.17 16.33 16.28 16.46 16.28 16.49 16.65 16.72}
+} {16.23 16.44 16.39 16.57 16.39 16.60 16.77 16.79}
.t tag remove elide 1.0 end
test textDisp-19.11.24 {TextWidgetCmd procedure, "index +/-displaylines"} {
list [.t index "11.5 + -1 display lines"] \
@@ -2746,7 +2748,7 @@ test textDisp-19.14 {GetYView procedure} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
# Need to update so everything is calculated.
update ; .t count -update -ypixels 1.0 end
update ; after 10 ; update
@@ -2766,7 +2768,7 @@ test textDisp-19.15 {GetYView procedure} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a bit little left on the last line."
update
.t configure -yscrollcommand scrollError
proc bgerror args {
@@ -2794,7 +2796,7 @@ test textDisp-19.16 {count -ypixels} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
# Need to update so everything is calculated.
update ; .t count -update -ypixels 1.0 end ; update
set res {}
@@ -2871,28 +2873,28 @@ for {set i 2} {$i <= 200} {incr i} {
.t configure -wrap word
.t delete 50.0 51.0
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
-test textDisp-20.1 {FindDLine} {textfonts} {
+test textDisp-20.1 {FindDLine} {
.t yview 48.0
list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \
[.t dlineinfo 58.0]
} [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
-test textDisp-20.2 {FindDLine} {textfonts} {
+test textDisp-20.2 {FindDLine} {
.t yview 100.0
.t yview -pickplace 53.0
- list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.15]
-} [list [list 3 [expr {-1 - $fixedDiff/2}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
-test textDisp-20.3 {FindDLine} {textfonts} {
+ list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21]
+} [list [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
+test textDisp-20.3 {FindDLine} {
.t yview 100.0
.t yview 49.0
- list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 57.0]
-} [list [list 3 [expr {$fixedDiff + 16}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
-test textDisp-20.4 {FindDLine} {textfonts} {
+ list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 57.0]
+} [list [list 3 [expr {$fixedDiff + 16}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+test textDisp-20.4 {FindDLine} {
.t yview 100.0
.t yview 42.0
- list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
-} [list [list 3 [expr {8*$fixedDiff + 107}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+ list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 50.40]
+} [list [list 3 [expr {8*$fixedDiff + 107}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
.t config -wrap none
-test textDisp-20.5 {FindDLine} {textfonts} {
+test textDisp-20.5 {FindDLine} {
.t yview 100.0
.t yview 48.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
@@ -2903,7 +2905,7 @@ test textDisp-21.1 {TkTextPixelIndex} {textfonts} {
.t yview 48.0
list [.t index @-10,-10] [.t index @6,6] [.t index @22,6] \
[.t index @102,6] [.t index @38,[expr {$fixedHeight * 4 + 3}]] [.t index @44,67]
-} {48.0 48.0 48.2 48.7 50.40 50.40}
+} {48.0 48.0 48.2 48.7 50.45 50.45}
.t insert end \n
test textDisp-21.2 {TkTextPixelIndex} {textfonts} {
.t yview 195.0
@@ -2959,7 +2961,7 @@ test textDisp-22.1 {TkTextCharBbox} {textfonts} {
.t yview 48.0
list [.t bbox 47.2] [.t bbox 48.0] [.t bbox 50.5] [.t bbox 50.40] \
[.t bbox 58.0]
-} [list {} [list 3 3 7 $fixedHeight] [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] [list 38 [expr {3+4*$fixedHeight}] 7 $fixedHeight] {}]
+} [list {} [list 3 3 7 $fixedHeight] [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] [list 3 [expr {3+4*$fixedHeight}] 7 $fixedHeight] {}]
test textDisp-22.2 {TkTextCharBbox} {textfonts} {
.t config -wrap none
.t yview 48.0
@@ -3083,13 +3085,13 @@ test textDisp-23.1 {TkTextDLineInfo} {textfonts} {
.t yview 48.0
list [.t dlineinfo 47.3] [.t dlineinfo 48.0] [.t dlineinfo 50.40] \
[.t dlineinfo 56.0]
-} [list {} [list 3 3 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {4*$fixedDiff + 55}] 126 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+} [list {} [list 3 3 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {4*$fixedDiff + 55}] 91 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
test textDisp-23.2 {TkTextDLineInfo} {textfonts} {
.t config -bd 4 -wrap word
update
.t yview 48.0
.t dlineinfo 50.40
-} [list 7 [expr {4*$fixedDiff + 59}] 126 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]
+} [list 7 [expr {4*$fixedDiff + 59}] 91 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]
.t config -bd 0
test textDisp-23.3 {TkTextDLineInfo} {textfonts} {
.t config -wrap none
@@ -3284,11 +3286,11 @@ test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} {textfonts} {
test textDisp-24.18 {TkTextCharLayoutProc, -wrap word} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
- .t insert 1.0 "xThis is a line that wraps around"
+ .t insert 1.0 "xxThis is a line that wraps around"
wm geom . {}
update
- list [.t bbox 1.14] [.t bbox 1.15] [.t bbox 1.16]
-} [list [list 101 3 7 $fixedHeight] [list 108 3 35 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+ list [.t bbox 1.15] [.t bbox 1.16] [.t bbox 1.17]
+} [list [list 108 3 7 $fixedHeight] [list 115 3 28 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.19 {TkTextCharLayoutProc, -wrap word} {textfonts} {
.t configure -wrap word
.t delete 1.0 end