summaryrefslogtreecommitdiffstats
path: root/tests/textMark.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-01-25 21:13:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-01-25 21:13:39 (GMT)
commitf309ff804398b57a180a79ebaaa297a8343a1c84 (patch)
treeeecb0149dc58d041678d5df28192820f1ff55ae1 /tests/textMark.test
parent46763e67f1830a5bb94b2576b9029f0b21aa789f (diff)
parent4a92b56b21aedd59eba10bfe67c863da54968786 (diff)
downloadtk-f309ff804398b57a180a79ebaaa297a8343a1c84.zip
tk-f309ff804398b57a180a79ebaaa297a8343a1c84.tar.gz
tk-f309ff804398b57a180a79ebaaa297a8343a1c84.tar.bz2
[Bug-1630271]: segfault/infinite loop when a mark is before -startline
Diffstat (limited to 'tests/textMark.test')
-rw-r--r--tests/textMark.test40
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/textMark.test b/tests/textMark.test
index 174f674..c1138ac 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -136,6 +136,40 @@ test textMark-6.1 {TkTextMarkSegToIndex} haveCourier12 {
.t mark set d 1.4
list [.t index a] [.t index b] [.t index c ] [.t index d]
} {1.2 1.2 1.2 1.4}
+test textMark-6.2 {TkTextMarkNameToIndex, with mark outside -startline/-endline range - bug 1630271} -body {
+ .t mark set insert 1.0
+ .t configure -startline 2
+ set res [list [.t index insert] [.t index insert-1c] [.t get insert]]
+ .t mark set insert end
+ .t configure -endline 4
+ lappend res [.t index insert]
+} -cleanup {
+ .t configure -startline {} -endline {}
+} -result {1.0 1.0 a 2.5}
+test textMark-6.3 {TkTextMarkNameToIndex, with mark outside -startline/-endline range - bug 1630271} -body {
+ .t mark set mymark 1.0
+ .t configure -startline 2
+ list [catch {.t index mymark} msg] $msg
+} -cleanup {
+ .t configure -startline {} -endline {}
+ .t mark unset mymark
+} -result {1 {bad text index "mymark"}}
+test textMark-6.4 {TkTextMarkNameToIndex, with mark outside -startline/-endline range - bug 1630271} -body {
+ .t mark set mymark 1.0
+ .t configure -startline 2
+ set res [list [catch {.t index mymark} msg] $msg]
+ lappend res [.pt index mymark]
+ .t configure -startline {}
+ .pt configure -startline 4
+ lappend res [.t index mymark]
+ lappend res [catch {.pt index mymark} msg] $msg
+ lappend res [.t get mymark]
+ lappend res [catch {.pt get mymark} msg] $msg
+} -cleanup {
+ .t configure -startline {} -endline {}
+ .pt configure -startline {} -endline {}
+ .t mark unset mymark
+} -result {1 {bad text index "mymark"} 1.0 1.0 1 {bad text index "mymark"} L 1 {bad text index "mymark"}}
catch {eval {.t mark unset} [.t mark names]}
test textMark-7.1 {MarkFindNext - invalid mark name} haveCourier12 {
@@ -180,8 +214,8 @@ test textMark-7.9 {MarkFindNext - mark set in a text widget and retrieved from a
.t mark unset {*}[.t mark names]
} -body {
.t mark set mymark 1.0
- set res [list [.pt mark next 1.0] [.pt mark next mymark] [.pt mark next insert]]
-} -result {mymark insert current}
+ lsort [list [.pt mark next 1.0] [.pt mark next mymark] [.pt mark next insert]]
+} -result {current insert mymark}
test textMark-8.1 {MarkFindPrev - invalid mark name} -constraints haveCourier12 -setup {
.t mark unset {*}[.t mark names]
@@ -242,7 +276,7 @@ test textMark-8.9 {MarkFindPrev - mark set in a text widget and retrieved from a
.t mark unset {*}[.t mark names]
} -body {
.t mark set mymark 1.0
- set res [list [.pt mark prev end] [.pt mark prev current] [.pt mark prev insert]]
+ lsort [list [.pt mark prev end] [.pt mark prev current] [.pt mark prev insert]]
} -result {current insert mymark}
catch {destroy .t}