summaryrefslogtreecommitdiffstats
path: root/tests/text.test
diff options
context:
space:
mode:
authorericm <ericm>2000-07-21 23:44:11 (GMT)
committerericm <ericm>2000-07-21 23:44:11 (GMT)
commit5649a675dfb76712afa08a8711459fc263bdbeb3 (patch)
tree972ef52cd15e825d853c81e50d7fb3be9ef8d63e /tests/text.test
parent531de37de6e419357d2eee46ebcfcbec5ad70974 (diff)
downloadtk-5649a675dfb76712afa08a8711459fc263bdbeb3.zip
tk-5649a675dfb76712afa08a8711459fc263bdbeb3.tar.gz
tk-5649a675dfb76712afa08a8711459fc263bdbeb3.tar.bz2
* tests/text.test: Added tests for searching when text is elided.
* generic/tkText.c (TextSearchCmd): Text search was not returning the correct index when the search covered (but did not search) elided characters; corrected this by adjusting the match index by the number of elided characters preceeding the start of the match, just as is done with embedded windows, etc. [Bug: 5470].
Diffstat (limited to 'tests/text.test')
-rw-r--r--tests/text.test31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/text.test b/tests/text.test
index 651e7d8..1d3a7bd 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.10 2000/02/03 17:29:58 ericm Exp $
+# RCS: @(#) $Id: text.test,v 1.11 2000/07/21 23:44:12 ericm Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -1110,7 +1110,36 @@ test text-20.65 {TextSearchCmd, unicode with non-text segments} {
set result
} {1.3 3}
+test text-20.66 {TextSearchCmd, hidden text does not affect match index} {
+ eval destroy [winfo child .]
+ pack [text .t2]
+ .t2 insert end "12345H7890"
+ .t2 search 7 1.0
+} 1.6
+test text-20.67 {TextSearchCmd, hidden text does not affect match index} {
+ eval destroy [winfo child .]
+ pack [text .t2]
+ .t2 insert end "12345H7890"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 1.5
+ .t2 search 7 1.0
+} 1.6
+test text-20.68 {TextSearchCmd, hidden text does not affect match index} {
+ eval destroy [winfo child .]
+ pack [text .t2]
+ .t2 insert end "foobar\nbarbaz\nbazboo"
+ .t2 search boo 1.0
+} 3.3
+test text-20.69 {TextSearchCmd, hidden text does not affect match index} {
+ eval destroy [winfo child .]
+ pack [text .t2]
+ .t2 insert end "foobar\nbarbaz\nbazboo"
+ .t2 tag configure hidden -elide true
+ .t2 tag add hidden 2.0 3.0
+ .t2 search boo 1.0
+} 3.3
+
eval destroy [winfo child .]
text .t2 -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100
pack .t2