summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2021-04-18 11:45:38 (GMT)
committerfvogel <fvogelnew1@free.fr>2021-04-18 11:45:38 (GMT)
commit4f342cf8461171eafee55086646adde29dd8631c (patch)
tree62e380fb45305913fdf1e8c608328e339990275f /tests
parent5c6873217a6652c98e1919d47deb0da3a46b0ed4 (diff)
parentedbabbf9f332476a02f8d6779ff5df28520a3af2 (diff)
downloadtk-4f342cf8461171eafee55086646adde29dd8631c.zip
tk-4f342cf8461171eafee55086646adde29dd8631c.tar.gz
tk-4f342cf8461171eafee55086646adde29dd8631c.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')
-rw-r--r--tests/textIndex.test37
-rw-r--r--tests/textMark.test11
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/textIndex.test b/tests/textIndex.test
index bd4e955..31ae495 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}
diff --git a/tests/textMark.test b/tests/textMark.test
index 043ff82..4d2e623 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -182,6 +182,17 @@ test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -bod
} -cleanup {
.t configure -startline {} -endline {}
} -result {1.0}
+test textMark-6.6 {attempt to move the insert mark beyond peer -endline - bug 34db75c0ac} -body {
+ .t peer create .p -startline 1 -endline 2
+ pack .p
+ update
+ .p mark set insert 1.2
+ focus -force .p
+ event generate .p <<NextLine>> ; # shall not error out
+ set res [.p index insert]
+} -cleanup {
+ destroy .p
+} -result {1.9}
test textMark-7.1 {MarkFindNext - invalid mark name} -body {
.t mark next bogus