diff options
author | vincentdarley <vincentdarley> | 2003-11-07 15:36:24 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2003-11-07 15:36:24 (GMT) |
commit | f4b5ed83cac2135eee47665181613178a33293ee (patch) | |
tree | a1d683e81cad5acc063a7a19da19b30cb5e568b6 /tests/text.test | |
parent | 2a739cee5e02ba828e59bcf8348ff158ef53db67 (diff) | |
download | tk-f4b5ed83cac2135eee47665181613178a33293ee.zip tk-f4b5ed83cac2135eee47665181613178a33293ee.tar.gz tk-f4b5ed83cac2135eee47665181613178a33293ee.tar.bz2 |
better elide tag handling
Diffstat (limited to 'tests/text.test')
-rw-r--r-- | tests/text.test | 111 |
1 files changed, 110 insertions, 1 deletions
diff --git a/tests/text.test b/tests/text.test index 0622a03..6e32ffd 100644 --- a/tests/text.test +++ b/tests/text.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: text.test,v 1.23 2003/10/31 09:02:15 vincentdarley Exp $ +# RCS: @(#) $Id: text.test,v 1.24 2003/11/07 15:36:27 vincentdarley Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -598,6 +598,115 @@ test text-9.2.43 {TextWidgetCmd procedure, "count" option} { .t count -lines -chars -indices -displaylines 1.0 end } {3 903 903 45} .t configure -wrap none + +# Newer tags are higher priority +.t tag configure elide1 -elide 0 +.t tag configure elide2 -elide 1 +.t tag configure elide3 -elide 0 +.t tag configure elide4 -elide 1 + +test text-0.2.44.0 {counting with tag priority eliding} { + .t delete 1.0 end + .t insert end "hello" + list [.t count -displaychars 1.0 1.0] \ + [.t count -displaychars 1.0 1.1] \ + [.t count -displaychars 1.0 1.2] \ + [.t count -displaychars 1.0 1.3] \ + [.t count -displaychars 1.0 1.4] \ + [.t count -displaychars 1.0 1.5] \ + [.t count -displaychars 1.0 1.6] \ + [.t count -displaychars 1.0 2.6] \ +} {0 1 2 3 4 5 5 6} +test text-0.2.44 {counting with tag priority eliding} { + .t delete 1.0 end + .t insert end "hello" + .t tag add elide1 1.2 1.4 + .t count -displaychars 1.0 1.5 +} {5} +test text-0.2.45 {counting with tag priority eliding} { + .t delete 1.0 end + .t insert end "hello" + .t tag add elide2 1.2 1.4 + .t count -displaychars 1.0 1.5 +} {3} +test text-0.2.46 {counting with tag priority eliding} { + set res {} + .t delete 1.0 end + .t insert end "hello" + .t tag add elide2 1.2 1.4 + .t tag add elide1 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] + .t delete 1.0 end + .t insert end "hello" + .t tag add elide1 1.2 1.4 + .t tag add elide2 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] +} {3 3} +test text-0.2.47 {counting with tag priority eliding} { + set res {} + .t delete 1.0 end + .t insert end "hello" + .t tag add elide2 1.2 1.4 + .t tag add elide3 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] + .t delete 1.0 end + .t insert end "hello" + .t tag add elide3 1.2 1.4 + .t tag add elide3 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] +} {5 5} +test text-0.2.48 {counting with tag priority eliding} { + set res {} + .t delete 1.0 end + .t insert end "hello" + .t tag add elide2 1.2 1.4 + .t tag add elide3 1.2 1.4 + .t tag add elide4 1.2 1.4 + .t tag add elide1 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] + .t delete 1.0 end + .t insert end "hello" + .t tag add elide1 1.2 1.4 + .t tag add elide4 1.2 1.4 + .t tag add elide2 1.2 1.4 + .t tag add elide3 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] +} {3 3} +test text-0.2.49 {counting with tag priority eliding} { + set res {} + .t delete 1.0 end + .t insert end "hello" + .t tag add elide2 1.2 1.4 + .t tag add elide3 1.2 1.4 + .t tag add elide1 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] + .t delete 1.0 end + .t insert end "hello" + .t tag add elide1 1.2 1.4 + .t tag add elide2 1.2 1.4 + .t tag add elide3 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] +} {5 5} +test text-0.2.50 {counting with tag priority eliding} { + set res {} + .t delete 1.0 end + .t insert end "hello" + .t tag add elide2 1.0 1.5 + .t tag add elide1 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] + lappend res [.t count -displaychars 1.1 1.5] + lappend res [.t count -displaychars 1.2 1.5] + lappend res [.t count -displaychars 1.3 1.5] + .t delete 1.0 end + .t insert end "hello" + .t tag add elide1 1.0 1.5 + .t tag add elide2 1.2 1.4 + lappend res [.t count -displaychars 1.0 1.5] + lappend res [.t count -displaychars 1.1 1.5] + lappend res [.t count -displaychars 1.2 1.5] + lappend res [.t count -displaychars 1.3 1.5] +} {0 0 0 0 3 2 1 1} + .t delete 1.0 end .t insert end $current unset current |