diff options
author | fvogel <fvogelnew1@free.fr> | 2024-01-27 13:48:53 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2024-01-27 13:48:53 (GMT) |
commit | 39d0e46160c3d7562f25775ac8c645216333134e (patch) | |
tree | 8c9ad093b65aabc1a15530aee0e630829f3956cd /tests/font.test | |
parent | f9ee1aea25b4ab3d9e40b20a28d117bdc852bf9f (diff) | |
parent | f75524182f56f35a68bfb6f24ca83d38c8faaff8 (diff) | |
download | tk-39d0e46160c3d7562f25775ac8c645216333134e.zip tk-39d0e46160c3d7562f25775ac8c645216333134e.tar.gz tk-39d0e46160c3d7562f25775ac8c645216333134e.tar.bz2 |
Fix [8da7af2f8e]: slow widget creation if default font is not used.
Diffstat (limited to 'tests/font.test')
-rw-r--r-- | tests/font.test | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/tests/font.test b/tests/font.test index d57b998..4a264f8 100644 --- a/tests/font.test +++ b/tests/font.test @@ -596,12 +596,13 @@ test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { } -setup { destroy .b1 .b2 } -body { - set x {Times 16} + set x [font create font-15.1_font -family Times -size 16] lindex $x 0 button .b1 -font $x lindex $x 0 - testfont counts {Times 16} + testfont counts $x } -cleanup { + font delete font-15.1_font destroy .b1 .b2 } -result {{1 0}} test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { @@ -610,13 +611,14 @@ test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { destroy .b1 .b2 set result {} } -body { - set x {Times 16} + set x [font create font-15.2_font -family Times -size 16] button .b1 -font $x destroy .b1 - lappend result [testfont counts {Times 16}] + lappend result [testfont counts $x] button .b2 -font $x - lappend result [testfont counts {Times 16}] + lappend result [testfont counts $x] } -cleanup { + font delete font-15.2_font destroy .b2 } -result {{} {{1 1}}} test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints { @@ -625,13 +627,14 @@ test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints { destroy .b1 .b2 set result {} } -body { - set x {Times 16} + set x [font create font-15.3_font -family Times -size 16] button .b1 -font $x - lappend result [testfont counts {Times 16}] + lappend result [testfont counts $x] button .b2 -font $x pack .b1 .b2 -side top - lappend result [testfont counts {Times 16}] + lappend result [testfont counts $x] } -cleanup { + font delete font-15.3_font destroy .b1 .b2 } -result {{{1 1}} {{2 1}}} test font-15.4 {Tk_AllocFontFromObj procedure: bump ref count} -setup { @@ -747,22 +750,24 @@ test font-16.1 {Tk_NameOfFont procedure} -setup { test font-17.1 {Tk_FreeFontFromObj - reference counts} -constraints { - testfont + testfont } -setup { destroy .b1 .b2 .b3 set result {} } -body { - set x {Courier 12} + set x [font create font-17.1_font -family Courier -size 12] button .b1 -font $x button .b3 -font $x button .b2 -font $x - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts $x] destroy .b1 - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts $x] destroy .b2 - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts $x] destroy .b3 - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts $x] +} -cleanup { + font delete font-17.1_font } -result {{{3 1}} {{2 1}} {{1 1}} {}} test font-17.2 {Tk_FreeFont procedure: one ref} -setup { destroy .t.f @@ -834,21 +839,24 @@ test font-18.1 {FreeFontObjProc} -constraints testfont -setup { destroy .b1 set result {} } -body { - set x [join {Courier 12} { }] + set f [font create font-18.1_font -family Courier -size 12] + set x [join [list $f 50] { }] button .b1 -font $x - set y [join {Courier 12} { }] + set y [join [list $f 50] { }] .b1 configure -font $y - set z [join {Courier 12} { }] + set z [join [list $f 50] { }] .b1 configure -font $z - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts [list $f 50]] set x red - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts [list $f 50]] set z 32 - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts [list $f 50]] destroy .b1 - lappend result [testfont counts {Courier 12}] + lappend result [testfont counts [list $f 50]] set y bogus return $result +} -cleanup { + font delete font-18.1_font } -result {{{1 3}} {{1 2}} {{1 1}} {}} |