summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-11-07 15:36:24 (GMT)
committervincentdarley <vincentdarley>2003-11-07 15:36:24 (GMT)
commitf4b5ed83cac2135eee47665181613178a33293ee (patch)
treea1d683e81cad5acc063a7a19da19b30cb5e568b6 /tests
parent2a739cee5e02ba828e59bcf8348ff158ef53db67 (diff)
downloadtk-f4b5ed83cac2135eee47665181613178a33293ee.zip
tk-f4b5ed83cac2135eee47665181613178a33293ee.tar.gz
tk-f4b5ed83cac2135eee47665181613178a33293ee.tar.bz2
better elide tag handling
Diffstat (limited to 'tests')
-rw-r--r--tests/text.test111
-rw-r--r--tests/textWind.test5
2 files changed, 112 insertions, 4 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
diff --git a/tests/textWind.test b/tests/textWind.test
index 24499ed..7c006ff 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: textWind.test,v 1.11 2003/11/04 23:37:51 vincentdarley Exp $
+# RCS: @(#) $Id: textWind.test,v 1.12 2003/11/07 15:36:27 vincentdarley Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -467,8 +467,7 @@ test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} {textf
frame .t.f.f -width 10 -height 20 -bg $color
}
set msg {}
- update
- .t bbox 1.5 ; update ; after 100
+ while {[llength $msg] < 2} {update ; .t bbox 1.5 ; after 10}
lappend msg [.t bbox 1.5] [winfo exists .t.f.f]
} [list {{can't embed .t.f.f relative to .t}} {{window name "f" already exists in parent}} [list 40 [expr {11+$fixedDiff/2}] 0 0] 1]
test textWind-10.4.1 {EmbWinLayoutProc procedure, error in creating window} {textfonts} {