summaryrefslogtreecommitdiffstats
path: root/tests/textIndex.test
diff options
context:
space:
mode:
authorstanton <stanton>1999-04-16 01:51:06 (GMT)
committerstanton <stanton>1999-04-16 01:51:06 (GMT)
commit03656f44f81469f459031fa3a4a7b09c8bc77712 (patch)
tree31378e81bd58f8c726fc552d6b30cbf3ca07497b /tests/textIndex.test
parent404fc236f34304df53b7e44bc7971d786b87d453 (diff)
downloadtk-03656f44f81469f459031fa3a4a7b09c8bc77712.zip
tk-03656f44f81469f459031fa3a4a7b09c8bc77712.tar.gz
tk-03656f44f81469f459031fa3a4a7b09c8bc77712.tar.bz2
* Merged 8.1 branch into the main trunk
Diffstat (limited to 'tests/textIndex.test')
-rw-r--r--tests/textIndex.test527
1 files changed, 432 insertions, 95 deletions
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 1744834..2bfdbc1 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -3,21 +3,22 @@
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+# All rights reserved.
#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: textIndex.test,v 1.2 1998/09/14 18:23:51 stanton Exp $
+# RCS: @(#) $Id: textIndex.test,v 1.3 1999/04/16 01:51:41 stanton Exp $
+
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ source [file join [pwd] [file dirname [info script]] defs.tcl]
+}
+
+# Some tests require the testtext command
-if {[string compare test [info procs test]] == 1} then \
- {source defs}
+set ::tcltest::testConfig(testtext) \
+ [expr {[info commands testtext] != {}}]
catch {destroy .t}
-if [catch {text .t -font {Courier 12} -width 20 -height 10}] {
- puts "The font needed by these tests isn't available, so I'm"
- puts "going to skip the tests."
- return
-}
+text .t -font {Courier -12} -width 20 -height 10
pack append . .t {top expand fill}
update
.t debug on
@@ -35,73 +36,181 @@ wm deiconify .
abcdefghijklm
12345
Line 4
-bOy GIrl .#@? x_yz
+b\u4e4fy GIrl .#@? x_yz
!@#$%
Line 7"
-test textIndex-1.1 {TkTextMakeIndex} {
+image create photo textimage -width 10 -height 10
+textimage put red -to 0 0 9 9
+
+test textIndex-1.1 {TkTextMakeByteIndex} {testtext} {
+ # (lineIndex < 0)
+ testtext .t byteindex -1 3
+} {1.0 0}
+test textIndex-1.2 {TkTextMakeByteIndex} {testtext} {
+ # (lineIndex < 0), because lineIndex == strtol(argv[2]) - 1
+ testtext .t byteindex 0 3
+} {1.0 0}
+test textIndex-1.3 {TkTextMakeByteIndex} {testtext} {
+ # not (lineIndex < 0)
+ testtext .t byteindex 1 3
+} {1.3 3}
+test textIndex-1.4 {TkTextMakeByteIndex} {testtext} {
+ # (byteIndex < 0)
+ testtext .t byteindex 3 -1
+} {3.0 0}
+test textIndex-1.5 {TkTextMakeByteIndex} {testtext} {
+ # not (byteIndex < 0)
+ testtext .t byteindex 3 3
+} {3.3 3}
+test textIndex-1.6 {TkTextMakeByteIndex} {testtext} {
+ # (indexPtr->linePtr == NULL)
+ testtext .t byteindex 9 2
+} {8.0 0}
+test textIndex-1.7 {TkTextMakeByteIndex} {testtext} {
+ # not (indexPtr->linePtr == NULL)
+ testtext .t byteindex 7 2
+} {7.2 2}
+test textIndex-1.8 {TkTextMakeByteIndex: shortcut for 0} {testtext} {
+ # (byteIndex == 0)
+ testtext .t byteindex 1 0
+} {1.0 0}
+test textIndex-1.9 {TkTextMakeByteIndex: shortcut for 0} {testtext} {
+ # not (byteIndex == 0)
+ testtext .t byteindex 3 80
+} {3.5 5}
+test textIndex-1.10 {TkTextMakeByteIndex: verify index is in range} {testtext} {
+ # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr)
+ # one segment
+
+ testtext .t byteindex 3 5
+} {3.5 5}
+test textIndex-1.11 {TkTextMakeByteIndex: verify index is in range} {testtext} {
+ # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr)
+ # index += segPtr->size
+ # Multiple segments, make sure add segment size to index.
+
+ .t mark set foo 3.2
+ set x [testtext .t byteindex 3 7]
+ .t mark unset foo
+ set x
+} {3.5 5}
+test textIndex-1.12 {TkTextMakeByteIndex: verify index is in range} {testtext} {
+ # (segPtr == NULL)
+ testtext .t byteindex 3 7
+} {3.5 5}
+test textIndex-1.13 {TkTextMakeByteIndex: verify index is in range} {testtext} {
+ # not (segPtr == NULL)
+ testtext .t byteindex 3 4
+} {3.4 4}
+test textIndex-1.14 {TkTextMakeByteIndex: verify index is in range} {testtext} {
+ # (index + segPtr->size > byteIndex)
+ # in this segment.
+
+ testtext .t byteindex 3 4
+} {3.4 4}
+test textIndex-1.15 {TkTextMakeByteIndex: verify index is in range} {testtext} {
+ # (index + segPtr->size > byteIndex), index != 0
+ # in this segment.
+
+ .t mark set foo 3.2
+ set x [testtext .t byteindex 3 4]
+ .t mark unset foo
+ set x
+} {3.4 4}
+test textIndex-1.16 {TkTextMakeByteIndex: UTF-8 characters} {testtext} {
+ testtext .t byteindex 5 100
+} {5.18 20}
+test textIndex-1.17 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \
+ {testtext} {
+ # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType))
+ # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f).
+
+ set x [testtext .t byteindex 5 2]
+ list $x [.t get insert]
+} {{5.2 4} y}
+test textIndex-1.18 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \
+ {testtext} {
+ # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType))
+ testtext .t byteindex 5 1
+ .t get insert
+} "\u4e4f"
+
+test textIndex-2.1 {TkTextMakeCharIndex} {
+ # (lineIndex < 0)
.t index -1.3
} 1.0
-test textIndex-1.2 {TkTextMakeIndex} {
+test textIndex-2.2 {TkTextMakeCharIndex} {
+ # (lineIndex < 0), because lineIndex == strtol(argv[2]) - 1
.t index 0.3
} 1.0
-test textIndex-1.3 {TkTextMakeIndex} {
+test textIndex-2.3 {TkTextMakeCharIndex} {
+ # not (lineIndex < 0)
.t index 1.3
} 1.3
-test textIndex-1.4 {TkTextMakeIndex} {
+test textIndex-2.4 {TkTextMakeCharIndex} {
+ # (charIndex < 0)
.t index 3.-1
} 3.0
-test textIndex-1.5 {TkTextMakeIndex} {
+test textIndex-2.5 {TkTextMakeCharIndex} {
+ # (charIndex < 0)
.t index 3.3
} 3.3
-test textIndex-1.6 {TkTextMakeIndex} {
+test textIndex-2.6 {TkTextMakeCharIndex} {
+ # (indexPtr->linePtr == NULL)
+ .t index 9.2
+} 8.0
+test textIndex-2.7 {TkTextMakeCharIndex} {
+ # not (indexPtr->linePtr == NULL)
+ .t index 7.2
+} 7.2
+test textIndex-2.8 {TkTextMakeCharIndex: verify index is in range} {
+ # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr)
+ # one segment
+
.t index 3.5
} 3.5
-test textIndex-1.7 {TkTextMakeIndex} {
- .t index 3.6
+test textIndex-2.9 {TkTextMakeCharIndex: verify index is in range} {
+ # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr)
+ # Multiple segments, make sure add segment size to index.
+
+ .t mark set foo 3.2
+ set x [.t index 3.7]
+ .t mark unset foo
+ set x
} 3.5
-test textIndex-1.8 {TkTextMakeIndex} {
+test textIndex-2.10 {TkTextMakeCharIndex: verify index is in range} {
+ # (segPtr == NULL)
.t index 3.7
} 3.5
-test textIndex-1.9 {TkTextMakeIndex} {
- .t index 7.2
-} 7.2
-test textIndex-1.10 {TkTextMakeIndex} {
- .t index 8.0
-} 8.0
-test textIndex-1.11 {TkTextMakeIndex} {
- .t index 8.1
-} 8.0
-test textIndex-1.12 {TkTextMakeIndex} {
- .t index 9.0
-} 8.0
+test textIndex-2.11 {TkTextMakeCharIndex: verify index is in range} {
+ # not (segPtr == NULL)
+ .t index 3.4
+} 3.4
+test textIndex-2.12 {TkTextMakeCharIndex: verify index is in range} {
+ # (segPtr->typePtr == &tkTextCharType)
+ # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f).
+
+ .t mark set insert 5.2
+ .t get insert
+} y
+test textIndex-2.13 {TkTextMakeCharIndex: verify index is in range} {
+ # not (segPtr->typePtr == &tkTextCharType)
+
+ .t image create 5.2 -image textimage
+ .t mark set insert 5.5
+ set x [.t get insert]
+ .t delete 5.2
+ set x
+} "G"
+test textIndex-2.14 {TkTextMakeCharIndex: verify index is in range} {
+ # (charIndex < segPtr->size)
-.t tag add x 2.3 2.6
-test textIndex-2.1 {TkTextIndexToSeg} {
- .t get 2.0
-} a
-test textIndex-2.2 {TkTextIndexToSeg} {
- .t get 2.2
-} c
-test textIndex-2.3 {TkTextIndexToSeg} {
- .t get 2.3
-} d
-test textIndex-2.4 {TkTextIndexToSeg} {
- .t get 2.6
-} g
-test textIndex-2.5 {TkTextIndexToSeg} {
- .t get 2.7
-} h
-test textIndex-2.6 {TkTextIndexToSeg} {
- .t get 2.12
-} m
-test textIndex-2.7 {TkTextIndexToSeg} {
- .t get 2.13
-} \n
-test textIndex-2.8 {TkTextIndexToSeg} {
- .t get 2.14
-} \n
-.t tag delete x
+ .t image create 5.0 -image textimage
+ set x [.t index 5.0]
+ .t delete 5.0
+ set x
+} 5.0
.t mark set foo 3.2
.t tag add x 2.8 2.11
@@ -242,8 +351,8 @@ test textIndex-10.4 {ForwBack} {
list [catch {.t index {2.3 - 3ch}} msg] $msg
} {0 2.0}
test textIndex-10.5 {ForwBack} {
- list [catch {.t index {2.3 + 3 lines}} msg] $msg
-} {0 5.3}
+ list [catch {.t index {1.3 + 3 lines}} msg] $msg
+} {0 4.3}
test textIndex-10.6 {ForwBack} {
list [catch {.t index {2.3 -1l}} msg] $msg
} {0 1.3}
@@ -253,97 +362,325 @@ test textIndex-10.7 {ForwBack} {
test textIndex-10.8 {ForwBack} {
list [catch {.t index {2.3 - 4 lines}} msg] $msg
} {0 1.3}
+test textIndex-10.9 {ForwBack} {
+ .t mark set insert 2.0
+ list [catch {.t index {insert -0 chars}} msg] $msg
+} {0 2.0}
+test textIndex-10.10 {ForwBack} {
+ .t mark set insert 2.end
+ list [catch {.t index {insert +0 chars}} msg] $msg
+} {0 2.13}
-test textIndex-11.1 {TkTextIndexForwChars} {
+test textIndex-11.1 {TkTextIndexForwBytes} {testtext} {
+ testtext .t forwbytes 2.3 -7
+} {1.3 3}
+test textIndex-11.2 {TkTextIndexForwBytes} {testtext} {
+ testtext .t forwbytes 2.3 5
+} {2.8 8}
+test textIndex-11.3 {TkTextIndexForwBytes} {testtext} {
+ testtext .t forwbytes 2.3 10
+} {2.13 13}
+test textIndex-11.4 {TkTextIndexForwBytes} {testtext} {
+ testtext .t forwbytes 2.3 11
+} {3.0 0}
+test textIndex-11.5 {TkTextIndexForwBytes} {testtext} {
+ testtext .t forwbytes 2.3 57
+} {7.6 6}
+test textIndex-11.6 {TkTextIndexForwBytes} {testtext} {
+ testtext .t forwbytes 2.3 58
+} {8.0 0}
+test textIndex-11.7 {TkTextIndexForwBytes} {testtext} {
+ testtext .t forwbytes 2.3 59
+} {8.0 0}
+
+test textIndex-12.1 {TkTextIndexForwChars} {
+ # (charCount < 0)
.t index {2.3 + -7 chars}
} 1.3
-test textIndex-11.2 {TkTextIndexForwChars} {
+test textIndex-12.2 {TkTextIndexForwChars} {
+ # not (charCount < 0)
.t index {2.3 + 5 chars}
} 2.8
-test textIndex-11.3 {TkTextIndexForwChars} {
+test textIndex-12.3 {TkTextIndexForwChars: find index} {
+ # for ( ; segPtr != NULL; segPtr = segPtr->nextPtr)
+ # one loop
+ .t index {2.3 + 9 chars}
+} 2.12
+test textIndex-12.4 {TkTextIndexForwChars: find index} {
+ # for ( ; segPtr != NULL; segPtr = segPtr->nextPtr)
+ # multiple loops
+ .t mark set foo 2.5
+ set x [.t index {2.3 + 9 chars}]
+ .t mark unset foo
+ set x
+} 2.12
+test textIndex-12.5 {TkTextIndexForwChars: find index} {
+ # for ( ; segPtr != NULL; segPtr = segPtr->nextPtr)
+ # border condition: last char
+
.t index {2.3 + 10 chars}
} 2.13
-test textIndex-11.4 {TkTextIndexForwChars} {
+test textIndex-12.6 {TkTextIndexForwChars: find index} {
+ # for ( ; segPtr != NULL; segPtr = segPtr->nextPtr)
+ # border condition: segPtr == NULL -> beginning of next line
+
.t index {2.3 + 11 chars}
} 3.0
-test textIndex-11.5 {TkTextIndexForwChars} {
- .t index {2.3 + 55 chars}
-} 7.6
-test textIndex-11.6 {TkTextIndexForwChars} {
+test textIndex-12.7 {TkTextIndexForwChars: find index} {
+ # (segPtr->typePtr == &tkTextCharType)
+ .t index {2.3 + 2 chars}
+} 2.5
+test textIndex-12.8 {TkTextIndexForwChars: find index} {
+ # (charCount == 0)
+ # No more chars, so we found byte offset.
+
+ .t index {2.3 + 2 chars}
+} 2.5
+test textIndex-12.9 {TkTextIndexForwChars: find index} {
+ # not (segPtr->typePtr == &tkTextCharType)
+
+ .t image create 2.4 -image textimage
+ set x [.t get {2.3 + 3 chars}]
+ .t delete 2.4
+ set x
+} "f"
+test textIndex-12.10 {TkTextIndexForwChars: find index} {
+ # dstPtr->byteIndex += segPtr->size - byteOffset
+ # When moving to next segment, account for bytes in last segment.
+ # Wrong answer would be 2.4
+
+ .t mark set foo 2.4
+ set x [.t index {2.3 + 5 chars}]
+ .t mark unset foo
+ set x
+} 2.8
+test textIndex-12.11 {TkTextIndexForwChars: go to next line} {
+ # (linePtr == NULL)
+ .t index {7.6 + 3 chars}
+} 8.0
+test textIndex-12.12 {TkTextIndexForwChars: go to next line} {
+ # Reset byteIndex to 0 now that we are on a new line.
+ # Wrong answer would be 2.9
+ .t index {1.3 + 6 chars}
+} 2.2
+test textIndex-12.13 {TkTextIndexForwChars} {
+ # right to end
.t index {2.3 + 56 chars}
} 8.0
-test textIndex-11.7 {TkTextIndexForwChars} {
+test textIndex-12.14 {TkTextIndexForwChars} {
+ # try to go past end
.t index {2.3 + 57 chars}
} 8.0
-test textIndex-12.1 {TkTextIndexBackChars} {
+test textIndex-13.1 {TkTextIndexBackBytes} {testtext} {
+ testtext .t backbytes 3.2 -10
+} {4.6 6}
+test textIndex-13.2 {TkTextIndexBackBytes} {testtext} {
+ testtext .t backbytes 3.2 2
+} {3.0 0}
+test textIndex-13.3 {TkTextIndexBackBytes} {testtext} {
+ testtext .t backbytes 3.2 3
+} {2.13 13}
+test textIndex-13.4 {TkTextIndexBackBytes} {testtext} {
+ testtext .t backbytes 3.2 22
+} {1.1 1}
+test textIndex-13.5 {TkTextIndexBackBytes} {testtext} {
+ testtext .t backbytes 3.2 23
+} {1.0 0}
+test textIndex-13.6 {TkTextIndexBackBytes} {testtext} {
+ testtext .t backbytes 3.2 24
+} {1.0 0}
+
+test textIndex-14.1 {TkTextIndexBackChars} {
+ # (charCount < 0)
.t index {3.2 - -10 chars}
} 4.6
-test textIndex-12.2 {TkTextIndexBackChars} {
+test textIndex-14.2 {TkTextIndexBackChars} {
+ # not (charCount < 0)
.t index {3.2 - 2 chars}
} 3.0
-test textIndex-12.3 {TkTextIndexBackChars} {
+test textIndex-14.3 {TkTextIndexBackChars: find starting segment} {
+ # for (segPtr = dstPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr)
+ # single loop
+
.t index {3.2 - 3 chars}
} 2.13
-test textIndex-12.4 {TkTextIndexBackChars} {
+test textIndex-14.4 {TkTextIndexBackChars: find starting segment} {
+ # for (segPtr = dstPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr)
+ # multiple loop
+
+ .t mark set foo1 2.5
+ .t mark set foo2 2.7
+ .t mark set foo3 2.10
+ set x [.t index {2.9 - 1 chars}]
+ .t mark unset foo1 foo2 foo3
+ set x
+} 2.8
+test textIndex-14.5 {TkTextIndexBackChars: find starting seg and offset} {
+ # for (segPtr = dstPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr)
+ # Make sure segSize was decremented. Wrong answer would be 2.10
+
+ .t mark set foo 2.2
+ set x [.t index {2.9 - 1 char}]
+ .t mark unset foo
+ set x
+} 2.8
+test textIndex-14.6 {TkTextIndexBackChars: back over characters} {
+ # (segPtr->typePtr == &tkTextCharType)
+
.t index {3.2 - 22 chars}
} 1.1
-test textIndex-12.5 {TkTextIndexBackChars} {
- .t index {3.2 - 23 chars}
-} 1.0
-test textIndex-12.6 {TkTextIndexBackChars} {
- .t index {3.2 - 24 chars}
+test textIndex-14.7 {TkTextIndexBackChars: loop backwards over chars} {
+ # (charCount == 0)
+ # No more chars, so we found byte offset.
+
+ .t index {3.4 - 2 chars}
+} 3.2
+test textIndex-14.8 {TkTextIndexBackChars: loop backwards over chars} {
+ # (p == start)
+ # Still more chars, but we reached beginning of segment
+
+ .t image create 5.6 -image textimage
+ set x [.t index {5.8 - 3 chars}]
+ .t delete 5.6
+ set x
+} 5.5
+test textIndex-14.9 {TkTextIndexBackChars: back over image} {
+ # not (segPtr->typePtr == &tkTextCharType)
+
+ .t image create 5.6 -image textimage
+ set x [.t get {5.8 - 4 chars}]
+ .t delete 5.6
+ set x
+} "G"
+test textIndex-14.10 {TkTextIndexBackChars: move to previous segment} {
+ # (segPtr != oldPtr)
+ # More segments to go
+
+ .t mark set foo 3.4
+ set x [.t index {3.5 - 2 chars}]
+ .t mark unset foo
+ set x
+} 3.3
+test textIndex-14.11 {TkTextIndexBackChars: move to previous segment} {
+ # not (segPtr != oldPtr)
+ # At beginning of line.
+
+ .t mark set foo 3.4
+ set x [.t index {3.5 - 10 chars}]
+ .t mark unset foo
+ set x
+} 2.9
+test textIndex-14.12 {TkTextIndexBackChars: move to previous line} {
+ # (lineIndex == 0)
+ .t index {1.5 - 10 chars}
} 1.0
+test textIndex-14.13 {TkTextIndexBackChars: move to previous line} {
+ # not (lineIndex == 0)
+ .t index {2.5 - 10 chars}
+} 1.2
+test textIndex-14.14 {TkTextIndexBackChars: move to previous line} {
+ # for (segPtr = oldPtr; segPtr != NULL; segPtr = segPtr->nextPtr)
+ # Set byteIndex to end of previous line so we can subtract more
+ # bytes from it. Otherwise we get an TkTextIndex with a negative
+ # byteIndex.
+
+ .t index {2.5 - 6 chars}
+} 1.6
+test textIndex-14.15 {TkTextIndexBackChars: UTF} {
+ .t get {5.3 - 1 chars}
+} y
+test textIndex-14.16 {TkTextIndexBackChars: UTF} {
+ .t get {5.3 - 2 chars}
+} \u4e4f
+test textIndex-14.17 {TkTextIndexBackChars: UTF} {
+ .t get {5.3 - 3 chars}
+} b
proc getword index {
.t get [.t index "$index wordstart"] [.t index "$index wordend"]
}
-test textIndex-13.1 {StartEnd} {
+test textIndex-15.1 {StartEnd} {
list [catch {.t index {2.3 lineend}} msg] $msg
} {0 2.13}
-test textIndex-13.2 {StartEnd} {
+test textIndex-15.2 {StartEnd} {
list [catch {.t index {2.3 linee}} msg] $msg
} {0 2.13}
-test textIndex-13.3 {StartEnd} {
+test textIndex-15.3 {StartEnd} {
list [catch {.t index {2.3 line}} msg] $msg
} {1 {bad text index "2.3 line"}}
-test textIndex-13.4 {StartEnd} {
+test textIndex-15.4 {StartEnd} {
list [catch {.t index {2.3 linestart}} msg] $msg
} {0 2.0}
-test textIndex-13.5 {StartEnd} {
+test textIndex-15.5 {StartEnd} {
list [catch {.t index {2.3 lines}} msg] $msg
} {0 2.0}
-test textIndex-13.6 {StartEnd} {
+test textIndex-15.6 {StartEnd} {
getword 5.3
} { }
-test textIndex-13.7 {StartEnd} {
+test textIndex-15.7 {StartEnd} {
getword 5.4
} GIrl
-test textIndex-13.8 {StartEnd} {
+test textIndex-15.8 {StartEnd} {
getword 5.7
} GIrl
-test textIndex-13.9 {StartEnd} {
+test textIndex-15.9 {StartEnd} {
getword 5.8
} { }
-test textIndex-13.10 {StartEnd} {
+test textIndex-15.10 {StartEnd} {
getword 5.14
} x_yz
-test textIndex-13.11 {StartEnd} {
+test textIndex-15.11 {StartEnd} {
getword 6.2
} #
-test textIndex-13.12 {StartEnd} {
+test textIndex-15.12 {StartEnd} {
getword 3.4
} 12345
.t tag add x 2.8 2.11
-test textIndex-13.13 {StartEnd} {
+test textIndex-15.13 {StartEnd} {
list [catch {.t index {2.2 worde}} msg] $msg
} {0 2.13}
-test textIndex-13.14 {StartEnd} {
+test textIndex-15.14 {StartEnd} {
list [catch {.t index {2.12 words}} msg] $msg
} {0 2.0}
-test textIndex-13.15 {StartEnd} {
+test textIndex-15.15 {StartEnd} {
list [catch {.t index {2.12 word}} msg] $msg
} {1 {bad text index "2.12 word"}}
+test testIndex-16.1 {TkTextPrintIndex} {
+ set t [text .t2]
+ $t insert end \n
+ $t window create end -window [button $t.b]
+ set result [$t index end-2c]
+ pack $t
+ catch {destroy $t}
+} 0
+
+
+test testIndex-16.2 {TkTextPrintIndex} {
+ set t [text .t2]
+ $t insert end \n
+ $t window create end -window [button $t.b]
+ set result [$t tag add {} end-2c]
+ pack $t
+ catch {destroy $t}
+} 0
+
+# cleanup
+rename textimage {}
catch {destroy .t}
-concat
+::tcltest::cleanupTests
+return
+
+
+
+
+
+
+
+
+
+
+
+
+