summaryrefslogtreecommitdiffstats
path: root/tests/font.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-10-03 20:40:34 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-10-03 20:40:34 (GMT)
commit4e9bf9b552c1a8cd7812835265603677e6d9cbf6 (patch)
treed0fcdfc39b6adb5bca27adff62e15f6ec8d07ae6 /tests/font.test
parented1dff0d5d48627a73d3ccd2ae56cd5199dea685 (diff)
downloadtk-4e9bf9b552c1a8cd7812835265603677e6d9cbf6.zip
tk-4e9bf9b552c1a8cd7812835265603677e6d9cbf6.tar.gz
tk-4e9bf9b552c1a8cd7812835265603677e6d9cbf6.tar.bz2
Stabilize font-47.2 and font-47.3 by making use of <<TkWorldChanged>> instead of waiting for some amount of time (race condition). Same approach as for frame-12.3 and textImage-4.2 (see [2be47c9f]).
Diffstat (limited to 'tests/font.test')
-rw-r--r--tests/font.test37
1 files changed, 19 insertions, 18 deletions
diff --git a/tests/font.test b/tests/font.test
index bb6a250..1905884 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -2425,7 +2425,7 @@ test font-47.2 {Bug 3049518,TIP 608 - Canvas} -body {
15 [expr {15 + $theight}] \
-width 1 -joinstyle round -smooth true -fill {} -outline blue]
pack $c -fill both -expand 1 -side top
- tkwait visibility $c
+ update
# Lamda test functions
set circle_text {{w user_data text circ} {
@@ -2440,33 +2440,35 @@ test font-47.2 {Bug 3049518,TIP 608 - Canvas} -body {
lassign [$w bbox $text] x0 y0 x1 y1
set offset 5
set coord [lmap expr {
- $x0-$offset $y0-$offset $x1+$offset $y0-$offset
- $x1+$offset $y1+$offset $x0-$offset $y1+$offset
+ $x0-$offset $y0-$offset $x1+$offset $y0-$offset
+ $x1+$offset $y1+$offset $x0-$offset $y1+$offset
} {expr $expr}]
if {[catch {$w coord $circ $coord} err]} {
puts Error:$err
}
+ after idle {set fontwait 1}
}}
- set waitfor {{tag {time 333}} {after $time incr ::wait4; vwait ::wait4}}
set enclosed {{can id} {$can find enclosed {*}[$can bbox $id]}}
set results {}
apply $circle_text $c FontChanged $textid $circid
+ update
bind $c <<TkWorldChanged>> [list apply $circle_text %W %d $textid $circid]
- apply $waitfor 1
# Begin test:
set results {}
lappend results [apply $enclosed $c $circid]
+ set fontwait 0
font configure MyFont -size 26
- apply $waitfor 2
+ vwait fontwait
lappend results [apply $enclosed $c $circid]
+ set fontwait 0
font configure MyFont -size 9
- apply $waitfor 3
+ vwait fontwait
lappend results [apply $enclosed $c $circid]
- apply $waitfor 4
+ set fontwait 0
font configure MyFont -size 12
- apply $waitfor 5
+ vwait fontwait
lappend results [apply $enclosed $c $circid]
} -cleanup {
destroy $c
@@ -2508,11 +2510,7 @@ test font-47.3 {Bug 3049518, TIP 608 - Label} -body {
set size [font metrics [$w cget -font] -linespace]
set img [apply ${make-img} $size]
$w configure -image $img
- }}
-
- set waitfor {{tag {time 500}} {
- after $time incr ::wait4
- vwait ::wait4
+ after idle {set fontwait 1}
}}
set check {{w} {
@@ -2529,19 +2527,22 @@ test font-47.3 {Bug 3049518, TIP 608 - Label} -body {
set img [apply ${make-img} $size]
set l [label .t.l -compound left -image $img -text $text -font MyFont]
pack $l -side top -fill both -expand 1
+ update
bind $l <<TkWorldChanged>> [list apply $testWorldChanged %W %d]
set ::results {}
- apply $waitfor 0
apply $check $l
+ set fontwait 0
font configure MyFont -size 26
- apply $waitfor 1
+ vwait fontwait
apply $check $l
+ set fontwait 0
font configure MyFont -size 9
- apply $waitfor 2
+ vwait fontwait
apply $check $l
+ set fontwait 0
font configure MyFont -size 13
- apply $waitfor 3
+ vwait fontwait
apply $check $l
set results
} -cleanup {