From 4e9bf9b552c1a8cd7812835265603677e6d9cbf6 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 3 Oct 2022 20:40:34 +0000 Subject: Stabilize font-47.2 and font-47.3 by making use of <> instead of waiting for some amount of time (race condition). Same approach as for frame-12.3 and textImage-4.2 (see [2be47c9f]). --- tests/font.test | 37 +++++++++++++++++++------------------ 1 file 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 <> [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 <> [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 { -- cgit v0.12