diff options
author | mdejong <mdejong@noemail.net> | 2004-08-09 23:48:10 (GMT) |
---|---|---|
committer | mdejong <mdejong@noemail.net> | 2004-08-09 23:48:10 (GMT) |
commit | 4ddbdd7d16af1f176da9204c278265ebb7e4c01b (patch) | |
tree | f357f6aa844b20cc3bf79bb0a11fc51406fff627 /tests | |
parent | fcc1ce6d3910637b5cfd56fe38027247489d9341 (diff) | |
download | tk-4ddbdd7d16af1f176da9204c278265ebb7e4c01b.zip tk-4ddbdd7d16af1f176da9204c278265ebb7e4c01b.tar.gz tk-4ddbdd7d16af1f176da9204c278265ebb7e4c01b.tar.bz2 |
* tests/canvText.test:
* win/tkWinFont.c (Tk_MeasureChars): Fix for text
wrapping problem that appeared using canvas text
under Win32. A long wrapping string that had
leading spaces was being incorrectly wrapped.
This change makes the Win32 implementation behave
the same as the Unix implementation. [Patch 100628
FossilOrigin-Name: 7e61c798b1cf7128587e88862a4a464fb93ce0b0
Diffstat (limited to 'tests')
-rw-r--r-- | tests/canvText.test | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/tests/canvText.test b/tests/canvText.test index 21f09a6..9400b2b 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: canvText.test,v 1.12 2003/02/09 07:48:22 hobbs Exp $ +# RCS: @(#) $Id: canvText.test,v 1.12.2.1 2004/08/09 23:48:11 mdejong Exp $ package require tcltest 2.1 namespace import -force tcltest::configure @@ -516,6 +516,61 @@ test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} { .c find enclosed 99 99 [expr $x2 + $i] [expr $y2 + 1] } 1 +test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} { + catch {destroy .c} + set c [canvas .c -bg black -width 964] + pack $c + $c delete all + after 1000 "set done 1" ; vwait done + + set f {Arial 28 bold} + + set s1 { Yeah-ah-ah-ah-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-oh-Yow} + set s2 { Yeah ah ah ah oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh oh Yow} + + $c create text 21 18 \ + -font $f \ + -text $s1 \ + -fill white \ + -width 922 \ + -anchor nw \ + -tags tbox1 + eval {$c create rect} [$c bbox tbox1] -outline red + + $c create text 21 160 \ + -font $f \ + -text $s2 \ + -fill white \ + -width 922 \ + -anchor nw \ + -tags tbox2 + eval {$c create rect} [$c bbox tbox2] -outline red + + after 1000 "set done 1" ; vwait done + + set results [list] + + $c select from tbox2 4 + $c select to tbox2 8 + lappend results [selection get] + + $c select from tbox1 4 + $c select to tbox1 8 + lappend results [selection get] + + array set metrics [font metrics $f] + set x [expr {21 + [font measure $f " "] \ + + ([font measure {Arial 28 bold} "Y"] / 2)}] + set y1 [expr {18 + ($metrics(-linespace) / 2)}] + set y2 [expr {160 + ($metrics(-linespace) / 2)}] + + lappend results [$c index tbox1 @$x,$y1] + lappend results [$c index tbox2 @$x,$y2] + + set results +} {{Yeah } Yeah- 4 4} + + # cleanup ::tcltest::cleanupTests return |