summaryrefslogtreecommitdiffstats
path: root/tests/textDisp.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/textDisp.test')
-rw-r--r--tests/textDisp.test110
1 files changed, 61 insertions, 49 deletions
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 7e02838..aeb1a70 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -17,10 +17,20 @@ if {[tk windowingsystem] == "aqua"} {
proc updateText {} {
update idletasks
}
+ proc delay {} {
+ update idletasks
+ after 100
+ update idletasks
+ }
} else {
proc updateText {} {
update
}
+ proc delay {} {
+ update
+ after 100
+ update
+ }
}
# The procedure below is used as the scrolling command for the text;
@@ -213,9 +223,9 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
.t delete 1.0 end
.t insert 1.0 "x\ty"
.t tag delete x y z
- .t tag configure x -tabs {50}
+ .t tag configure x -tabs 50
.t tag configure y -foreground black
- .t tag configure z -tabs {70}
+ .t tag configure z -tabs 70
.t tag add x 1.0 1.end
.t tag add y 1.0 1.end
.t tag add z 1.0 1.end
@@ -223,7 +233,7 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
set x [lindex [.t bbox 1.2] 0]
.t tag configure z -tabs {}
lappend x [lindex [.t bbox 1.2] 0]
- .t tag configure z -tabs {30}
+ .t tag configure z -tabs 30
.t tag raise x
update idletasks
lappend x [lindex [.t bbox 1.2] 0]
@@ -494,7 +504,7 @@ test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} {
.t tag add x 1.0 end
.t tag add y 1.1 end
lindex [.t bbox 1.3] 0
-} {75}
+} 75
test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} {textfonts} {
.t delete 1.0 end
.t tag delete x
@@ -708,7 +718,7 @@ test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
.t yview moveto 1
updateText
winfo ismapped .b
-} {0}
+} 0
.t configure -wrap word
.t delete 1.0 end
.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\n"
@@ -1818,7 +1828,7 @@ test textDisp-13.11 {TkTextSeeCmd procedure} {} {
set res [.top2.t2 compare $ref == $new]
destroy .top2
set res
-} {0}
+} 0
wm geom . {}
.t configure -wrap none
@@ -2007,7 +2017,7 @@ test textDisp-15.8 {Scrolling near end of window} {
set res [.tf.f.t compare $newind > $refind]
destroy .tf
set res
-} {1}
+} 1
.t configure -wrap char
.t delete 1.0 end
@@ -2167,7 +2177,7 @@ test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
incr res -1
}
set res
-} {102}
+} 102
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
.t configure -height 1
updateText
@@ -2635,66 +2645,66 @@ test textDisp-19.11 {GetYView procedure} {
} {0.5 1.0}
test textDisp-19.11.2 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.0 end
-} {20}
+} 20
test textDisp-19.11.3 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines end 1.0
-} {-20}
+} -20
test textDisp-19.11.4 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.1 1.3
-} {0}
+} 0
test textDisp-19.11.5 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.1
-} {0}
+} 0
test textDisp-19.11.5.1 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.5
-} {0}
+} 0
test textDisp-19.11.6 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.24
-} {1}
+} 1
test textDisp-19.11.7 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.40
-} {2}
+} 2
test textDisp-19.11.8 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 displaylineend +1c" "16.0 lineend"
-} {3}
+} 3
test textDisp-19.11.9 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 lineend"
-} {4}
+} 4
test textDisp-19.11.10 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.11 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +2displaylines"
-} {2}
+} 2
test textDisp-19.11.12 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 +1displayline" "16.0 +2displaylines -1c"
-} {0}
+} 0
.t tag configure elide -elide 1
test textDisp-19.11.13 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines +6c"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.14 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines displaylineend"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.15 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines -1c"
-} {3}
+} 3
test textDisp-19.11.15a {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.16 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
.t count -displaylines 12.0 16.0
-} {2}
+} 2
test textDisp-19.11.17 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
@@ -2715,7 +2725,7 @@ test textDisp-19.11.19 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
.t count -displaylines 12.0 17.0
-} {4}
+} 4
test textDisp-19.11.20 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
@@ -3482,7 +3492,7 @@ test textDisp-26.5 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.2
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1,456.234
@@ -3491,7 +3501,7 @@ test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.7] 0
-} {120}
+} 120
test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.456.234,7
@@ -3500,7 +3510,7 @@ test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.11] 0
-} {120}
+} 120
test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\ttest
@@ -3509,7 +3519,7 @@ test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1234
@@ -3518,7 +3528,7 @@ test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.234567
@@ -3527,7 +3537,7 @@ test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\tx=1.234567
@@ -3537,7 +3547,7 @@ test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.7
.t tag add y 1.9
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t delete 1.0 end
.t insert 1.0 a\tx1.234567
@@ -3550,7 +3560,7 @@ test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t window create 1.3 -window .b
updateText
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.13 {AdjustForTab procedure, not enough space} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "abc\txyz\tqrs\txyz\t0"
@@ -3707,7 +3717,7 @@ test textDisp-27.7.2 {SizeOfTab procedure, fractional tab interpolation problem}
.t configure -tabs $precisetab
updateText
expr {[lindex $res 0] - [lindex [.t bbox 1.20] 0]}
-} {0}
+} 0
.t configure -wrap char -tabs {} -width 20
updateText
@@ -3723,7 +3733,7 @@ test textDisp-27.9 {SizeOfTab procedure, left alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\txyzzyabc
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.3] [.t bbox 1.4]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3739,7 +3749,7 @@ test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a spac
.t delete 1.0 end
.t insert 1.0 abc\tdefghijklmnopqrst
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.5] [.t bbox 1.6]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3912,14 +3922,14 @@ test textDisp-30.1 {elidden text joining multiple logical lines} {
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 3.2
.t2.t count -displaylines 1.0 end
-} {1}
+} 1
test textDisp-30.2 {elidden text joining multiple logical lines} {
.t2.t delete 1.0 end
.t2.t insert 1.0 "1111\n2222\n3333"
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 2.2
.t2.t count -displaylines 1.0 end
-} {2}
+} 2
catch {destroy .t2}
.t configure -height 1
@@ -3969,12 +3979,12 @@ test textDisp-31.3 {line update index shifting} {
.t insert 1.0 "abc\n"
.t insert 1.0 "abc\n"
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
.t.f configure -height 100
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
@@ -4022,12 +4032,12 @@ test textDisp-31.6 {line update index shifting} {
.t insert 1.0 "abc\n"
.t insert 1.0 "abc\n"
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
textest configure -height 100
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
@@ -4044,11 +4054,11 @@ test textDisp-31.7 {line update index shifting, elided} {
.t tag configure elide -elide 1
.t tag add elide 1.3 2.1
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {$fixedHeight * 1}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 2}] [expr {$fixedHeight * 1}] [expr {$fixedHeight * 1}]]
@@ -4183,6 +4193,7 @@ test textDisp-32.3 "NULL undisplayProc problems: #1791052" -setup {
test textDisp-33.0 {one line longer than fits in the widget} {
pack [text .tt -wrap char]
+ updateText
.tt insert 1.0 [string repeat "more wrap + " 300]
updateText
.tt see 1.0
@@ -4191,6 +4202,7 @@ test textDisp-33.0 {one line longer than fits in the widget} {
test textDisp-33.1 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
+ updateText
.tt insert 1.0 [string repeat "more wrap + " 300]
updateText
.tt yview "1.0 +1 displaylines"
@@ -4204,12 +4216,12 @@ test textDisp-33.2 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
.tt debug 1
- update idletasks
+ updateText
set tk_textHeightCalc ""
- set timer [after 700 lappend tk_textHeightCalc "Timed out"]
+ set timer [after 200 lappend tk_textHeightCalc "Timed out"]
.tt insert 1.0 [string repeat "more wrap + " 1]
vwait tk_textHeightCalc
- after cancel timer
+ after cancel $timer
set tk_textHeightCalc
} {1.0}
test textDisp-33.3 {one line longer than fits in the widget} {
@@ -4224,7 +4236,7 @@ test textDisp-33.3 {one line longer than fits in the widget} {
# Each line should have been recalculated just once
.tt debug 0
expr {[llength $tk_textHeightCalc] == [.tt count -displaylines 1.0 end]}
-} {1}
+} 1
test textDisp-33.4 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]