summaryrefslogtreecommitdiffstats
path: root/tests/textIndex.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2021-04-18 11:45:48 (GMT)
committerfvogel <fvogelnew1@free.fr>2021-04-18 11:45:48 (GMT)
commitc7001ef810392979672d06f30e272c43a679cb01 (patch)
treef45bfd3a438a6b080d7e0155f3ff33efec504e40 /tests/textIndex.test
parente697be6fa9901a1479c2b0de7b064d3b8b27b72c (diff)
parent4f342cf8461171eafee55086646adde29dd8631c (diff)
downloadtk-c7001ef810392979672d06f30e272c43a679cb01.zip
tk-c7001ef810392979672d06f30e272c43a679cb01.tar.gz
tk-c7001ef810392979672d06f30e272c43a679cb01.tar.bz2
Fix [34db75c0ac]: Text peer widget error on Down arrow key when passed -endline line. Also, propagate the fix for [1630271fff] from marks to embedded images and windows.
Diffstat (limited to 'tests/textIndex.test')
-rw-r--r--tests/textIndex.test37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 2d42b8e..f2cccac 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -964,6 +964,43 @@ test textIndex-25.1 {IndexCountBytesOrdered, bug [3f1f79abcf]} {
destroy .t2
} {}
+test textIndex-26.1 {GetIndex restricts the returned index to -starline/-endline in peers, bug [34db75c0ac]} {
+ set res {}
+ pack [text .t2]
+ .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n"
+ pack [.t2 peer create .p2 -startline 2 -endline 3]
+ lappend res [.p2 index "end"]
+ lappend res [.p2 index "end lineend"]
+ lappend res [.p2 index "end display lineend"]
+ destroy .t2 .p2
+ set res
+} {2.0 2.0 2.0}
+test textIndex-26.2 {GetIndex errors out if mark, image, window, or tag is outside peer -starline/-endline, bug [34db75c0ac]} {
+ set res {}
+ pack [text .t2]
+ .t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n"
+ pack [.t2 peer create .p2 -startline 2 -endline 3]
+ .p2 configure -startline 3 -endline {}
+ .t2 mark set mymark 1.0
+ catch {.p2 index mymark} msg
+ lappend res [.t2 index mymark] $msg
+ image create photo redsquare -width 5 -height 5
+ redsquare put red -to 0 0 4 4
+ .t2 image create 1.0 -image redsquare
+ catch {.p2 index redsquare} msg
+ lappend res [.t2 index redsquare] $msg
+ frame .f -width 10 -height 10 -bg blue
+ .t2 window create 1.2 -window .f
+ catch {.p2 index .f} msg
+ lappend res [.t2 index .f] $msg
+ .t2 tag add mytag 1.3
+ catch {.p2 index mytag.first} msg
+ lappend res [.t2 index mytag.first] $msg
+ destroy .t2 .p2
+ set res
+} {1.0 {bad text index "mymark"} 1.0 {bad text index "redsquare"} 1.2\
+ {bad text index ".f"} 1.3 {text doesn't contain any characters tagged with "mytag"}}
+
# cleanup
rename textimage {}
catch {destroy .t}