diff options
author | vincentdarley <vincentdarley> | 2005-02-14 23:00:29 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2005-02-14 23:00:29 (GMT) |
commit | 6e1a009795f451583308dda6b41c6249b637933c (patch) | |
tree | 270430be093e44a3695b7cae46647d503a619044 /tests | |
parent | 496ad1df6abb7e07d1c616e01bb3715ad49ab695 (diff) | |
download | tk-6e1a009795f451583308dda6b41c6249b637933c.zip tk-6e1a009795f451583308dda6b41c6249b637933c.tar.gz tk-6e1a009795f451583308dda6b41c6249b637933c.tar.bz2 |
fix to newline eliding in text widget
Diffstat (limited to 'tests')
-rw-r--r-- | tests/textDisp.test | 40 | ||||
-rw-r--r-- | tests/textIndex.test | 3 |
2 files changed, 36 insertions, 7 deletions
diff --git a/tests/textDisp.test b/tests/textDisp.test index d0bb9a8..501a788 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textDisp.test,v 1.33 2004/12/04 00:04:41 dkf Exp $ +# RCS: @(#) $Id: textDisp.test,v 1.34 2005/02/14 23:03:25 vincentdarley Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -2404,11 +2404,12 @@ test textDisp-19.11.22 {TextWidgetCmd procedure, "index +displaylines"} { test textDisp-19.11.23 {TextWidgetCmd procedure, "index +displaylines"} { .t tag remove elide 1.0 end .t tag add elide "12.3" "16.0 +1displaylines" - list [.t index "11.5 +2d lines"] \ + list [.t index "11.5 +1d lines"] [.t index "11.5 +2d lines"] \ + [.t index "12.0 +1d lines"] \ [.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \ [.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \ [.t index "13.0 +4d lines"] -} {16.21 16.33 16.16 16.50 16.67 17.0} +} {16.17 16.33 16.28 16.46 16.28 16.49 16.65 17.0} .t tag remove elide 1.0 end test textDisp-19.11.24 {TextWidgetCmd procedure, "index +/-displaylines"} { list [.t index "11.5 + -1 display lines"] \ @@ -3369,15 +3370,20 @@ test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {textfonts update list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3] } [list {0.533333333333 1.0} 300x50+-155+[expr {$fixedDiff + 18}] {}] -test textDisp-30.1 {elidden text complications} {knownBug} { +test textDisp-30.1 {elidden text joining multiple logical lines} { .t2.t delete 1.0 end .t2.t insert 1.0 "1111\n2222\n3333" .t2.t tag configure elidden -elide 1 -background red .t2.t tag add elidden 1.2 3.2 - # Known Bug: the newline at 1.4 will not be elidden. - # Each logical line must have its own DLines .t2.t count -displaylines 1.0 end } {1} +test textDisp-30.2 {elidden text joining multiple logical lines} { + .t2.t delete 1.0 end + .t2.t insert 1.0 "1111\n2222\n3333" + .t2.t tag configure elidden -elide 1 -background red + .t2.t tag add elidden 1.2 2.2 + .t2.t count -displaylines 1.0 end +} {2} catch {destroy .t2} .t configure -height 1 @@ -3491,6 +3497,28 @@ test textDisp-31.6 {line update index shifting} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]] +test textDisp-31.7 {line update index shifting, elided} { + # The 'update' and 'delay' must be long enough to ensure all + # asynchronous updates have been performed. + set res {} + .t delete 1.0 end + lappend res [.t count -update -ypixels 1.0 end] + .t insert 1.0 "abc\nabc" + .t insert 1.0 "abc\n" + lappend res [.t count -update -ypixels 1.0 end] + .t tag configure elide -elide 1 + .t tag add elide 1.3 2.1 + lappend res [.t count -ypixels 1.0 end] + update ; after 1000 ; update + lappend res [.t count -ypixels 1.0 end] + .t delete 1.0 3.0 + lappend res [.t count -ypixels 1.0 end] + update ; after 1000 ; update + lappend res [.t count -ypixels 1.0 end] + set res +} [list [expr {$fixedHeight * 1}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 2}] [expr {$fixedHeight * 1}] [expr {$fixedHeight * 1}]] +return + test textDisp-32.0 {everything elided} { # Must not crash pack [text .tt] diff --git a/tests/textIndex.test b/tests/textIndex.test index b4c7d11..6527349 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -6,11 +6,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textIndex.test,v 1.14 2004/09/10 12:13:43 vincentdarley Exp $ +# RCS: @(#) $Id: textIndex.test,v 1.15 2005/02/14 23:03:26 vincentdarley Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands +namespace import -force tcltest::test catch {destroy .t} text .t -font {Courier -12} -width 20 -height 10 |