summaryrefslogtreecommitdiffstats
path: root/tests/text.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2015-11-14 13:05:04 (GMT)
committerfvogel <fvogelnew1@free.fr>2015-11-14 13:05:04 (GMT)
commit026e3c1a89685f0cc95502bfb70e6132128c1c58 (patch)
tree5c35c0b4b63b4fa1aa3ed3ad8e68c2cb62db23f2 /tests/text.test
parent4fe451bdce628ec817ecdebadbcd7f46dc967b41 (diff)
parentb965bde49f462725f54d29e9e8b8008f79fe43b9 (diff)
downloadtk-026e3c1a89685f0cc95502bfb70e6132128c1c58.zip
tk-026e3c1a89685f0cc95502bfb70e6132128c1c58.tar.gz
tk-026e3c1a89685f0cc95502bfb70e6132128c1c58.tar.bz2
TIP #438 - <<TextLineHeightsInvalid>> event added, with corresponding new tests
Diffstat (limited to 'tests/text.test')
-rw-r--r--tests/text.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/text.test b/tests/text.test
index d8ed533..7e754e2 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -1025,6 +1025,34 @@ test text-11a.12 {TextWidgetCmd procedure, "pendingyupdate" option} {
set fraction2 [lindex [.top.yt yview] 0]
lappend res [expr {$fraction1 == $fraction2}]
} {1 1 1}
+test text-11a.21 {"<<TextLineHeightsInvalid>>" event} {
+ destroy .top.yt .top
+ toplevel .top
+ pack [text .top.yt]
+ set content {}
+ for {set i 1} {$i < 300} {incr i} {
+ append content [string repeat "$i " 15] \n
+ }
+ .top.yt insert 1.0 $content
+ update
+ bind .top.yt <<TextLineHeightsInvalid>> { if {%d == 0} {set yud(%W) 1} }
+ # wait for end of line metrics calculation to get correct $fraction1
+ # as a reference
+ if {[.top.yt pendingyupdate]} {vwait yud(.top.yt)}
+ .top.yt yview moveto 1
+ set fraction1 [lindex [.top.yt yview] 0]
+ set res [expr {$fraction1 > 0}]
+ .top.yt delete 1.0 end
+ .top.yt insert 1.0 $content
+ # synchronously wait for completion of line metrics calculation
+ # and ensure the test is relevant
+ set waited 0
+ if {[.top.yt pendingyupdate]} {set waited 1 ; vwait yud(.top.yt)}
+ lappend res $waited
+ .top.yt yview moveto $fraction1
+ set fraction2 [lindex [.top.yt yview] 0]
+ lappend res [expr {$fraction1 == $fraction2}]
+} {1 1 1}
# edit, mark, scan, search, see, tag, window, xview and yview actions are tested elsewhere.