diff options
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 |