summaryrefslogtreecommitdiffstats
path: root/tests/text.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/text.test')
-rw-r--r--tests/text.test158
1 files changed, 136 insertions, 22 deletions
diff --git a/tests/text.test b/tests/text.test
index 8723d3d..84ed50e 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -29,6 +29,15 @@ test text-1.1 {configuration option: "autoseparators"} -setup {
} -cleanup {
destroy .t
} -result {1}
+test text-1.1b {configuration option: "autoseparators", default} -setup {
+ text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
+ pack .t
+ update
+} -body {
+ .t cget -autoseparators
+} -cleanup {
+ destroy .t
+} -result {1}
test text-1.2 {configuration option: "autoseparators"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -428,6 +437,15 @@ test text-1.43 {configuration option: "maxundo"} -setup {
} -cleanup {
destroy .t
} -result {5}
+test text-1.43b {configuration option: "maxundo", default} -setup {
+ text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
+ pack .t
+ update
+} -body {
+ .t cget -maxundo
+} -cleanup {
+ destroy .t
+} -result {0}
test text-1.44 {configuration option: "maxundo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -732,6 +750,15 @@ test text-1.75 {configuration option: "undo"} -setup {
} -cleanup {
destroy .t
} -result {1}
+test text-1.75b {configuration option: "undo", default} -setup {
+ text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
+ pack .t
+ update
+} -body {
+ .t cget -undo
+} -cleanup {
+ destroy .t
+} -result {0}
test text-1.76 {configuration option: "undo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -895,9 +922,9 @@ test text-2.8 {Tk_TextCmd procedure} -constraints {
.t tag cget sel -relief
} -cleanup {
destroy .t
-} -result {solid}
+} -result {flat}
test text-2.9 {Tk_TextCmd procedure} -constraints {
- unix
+ unix notAqua
} -body {
catch {destroy .t}
text .t
@@ -1458,7 +1485,19 @@ Line 7"
rename .t {}
rename test.t .t
destroy .t
-} -result {{edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} {insert 2.1 ef} {mark set insert 2.3} {see insert}}
+} -result [list {edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} \
+ {mark set tk::undoMarkL2 2.1} {mark set tk::undoMarkR2 2.4} \
+ {mark gravity tk::undoMarkL2 left} {mark gravity tk::undoMarkR2 right} \
+ {insert 2.1 ef} {mark set insert 2.3} {see insert} \
+ {mark set tk::undoMarkL1 2.1} {mark set tk::undoMarkR1 2.3} \
+ {mark gravity tk::undoMarkL1 left} {mark gravity tk::undoMarkR1 right} \
+ {mark names} \
+ {index tk::undoMarkL1} {index tk::undoMarkR1} \
+ {mark unset tk::undoMarkL1 tk::undoMarkR1} \
+ {index tk::undoMarkL2} {index tk::undoMarkR2} \
+ {mark unset tk::undoMarkL2 tk::undoMarkR2} \
+ {compare 2.1 > 2.3} {compare 2.6 > 2.3} ]
+
test text-8.23 {TextWidgetCmd procedure, "replace" option with undo} -setup {
text .t
} -body {
@@ -2604,7 +2643,7 @@ test text-10.37 {TextWidgetCmd procedure, "count" option} -setup {
} -result {3}
test text-10.38 {TextWidgetCmd procedure, "count" option} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
} -body {
.t configure -width 20 -height 10
update
@@ -2700,7 +2739,7 @@ test text-9.2.47 {TextWidgetCmd procedure, "count" option} -setup {
test text-11.1 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
} -body {
.t insert end "hello"
.t configure -wrap none
@@ -2717,7 +2756,7 @@ test text-11.1 {counting with tag priority eliding} -setup {
} -result {0 1 2 3 4 5 5 6}
test text-11.2 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
} -body {
.t insert end "hello"
.t tag configure elide1 -elide 0
@@ -2829,7 +2868,7 @@ test text-11.7 {counting with tag priority eliding} -setup {
} -result {5 5}
test text-11.8 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
set res {}
} -body {
.t insert end "hello"
@@ -2855,7 +2894,7 @@ test text-11.8 {counting with tag priority eliding} -setup {
} -result {0 0 0 0 3 2 1 1}
test text-11.9 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
set res {}
} -body {
.t tag configure WELCOME -elide 1
@@ -3405,7 +3444,7 @@ test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
.top.t configure -width 20 -height 10
- pack append .top .top.t top
+ pack .top.t
update
set geom [wm geometry .top]
set x [string range $geom 0 [string first + $geom]]
@@ -3422,7 +3461,7 @@ test text-14.19 {ConfigureText procedure} -setup {
} -body {
.top.t configure -width 20 -height 10 -setgrid 1
wm overrideredirect .top 1
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
update
wm geometry .top
@@ -3439,7 +3478,7 @@ test text-14.20 {ConfigureText procedure} -setup {
} -body {
.top.t configure -width 20 -height 10 -setgrid 1
wm overrideredirect .top 1
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
update
set result [wm geometry .top]
@@ -3729,7 +3768,7 @@ Line 4
test text-19.11 {DeleteChars procedure} -body {
toplevel .top
text .top.t -width 20 -height 5
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
.top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
update
@@ -3741,7 +3780,7 @@ test text-19.11 {DeleteChars procedure} -body {
test text-19.12 {DeleteChars procedure} -body {
toplevel .top
text .top.t -width 20 -height 5
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
.top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
.top.t yview 3.0
@@ -3801,7 +3840,7 @@ test text-19.16 {DeleteChars procedure, updates affecting topIndex} -setup {
wm geometry .top +0+0
update
} -body {
- .top.t insert end "abc def\n01 2345 678 9101112\nLine 3\nLine 4\nLine 5\n6\n7\n8\n"
+ .top.t insert end "abc def\n01 2a345 678 9101112\nLine 3\nLine 4\nLine 5\n6\n7\n8\n"
.top.t yview 2.4
.top.t delete 2.5
set x [.top.t index @0,0]
@@ -3814,7 +3853,7 @@ test text-19.16 {DeleteChars procedure, updates affecting topIndex} -setup {
test text-20.1 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3829,7 +3868,7 @@ b.0b.1b.2b.3b.4
c.0c}
test text-20.2 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3849,7 +3888,7 @@ b.0b.1b.2b.3b.4
c.0c}
test text-20.3 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3863,7 +3902,7 @@ test text-20.3 {TextFetchSelection procedure} -setup {
} -result {m}
test text-20.4 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3883,7 +3922,7 @@ test text-20.4 {TextFetchSelection procedure} -setup {
cj.0j.1j.2j.3j.4m}
test text-20.5 {TextFetchSelection procedure, long selections} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
set x ""
} -body {
@@ -3898,7 +3937,7 @@ test text-20.5 {TextFetchSelection procedure, long selections} -setup {
} -result {1}
-test text-21.1 {TkTextLostSelection procedure} -constraints unix -setup {
+test text-21.1 {TkTextLostSelection procedure} -constraints {x11} -setup {
text .t
.t insert 1.0 "Line 1"
entry .t.e
@@ -3913,7 +3952,7 @@ test text-21.1 {TkTextLostSelection procedure} -constraints unix -setup {
} -cleanup {
destroy .t .t2
} -result {}
-test text-21.2 {TkTextLostSelection procedure} -constraints win -setup {
+test text-21.2 {TkTextLostSelection procedure} -constraints aquaOrWin32 -setup {
text .t
.t insert 1.0 "Line 1"
entry .t.e
@@ -6396,8 +6435,23 @@ test text-27.16a {undo configuration options with peers} -body {
lappend res [.t edit canundo]
lappend res [.tt edit canundo]
} -cleanup {
- destroy .t
+ destroy .t .tt
} -result {1 1 0 0 100 100 1 1}
+test text-27.16b {undo configuration options with peers, defaults} -body {
+ text .t
+ .t peer create .tt
+ set res [.t cget -undo]
+ lappend res [.tt cget -undo]
+ lappend res [.t cget -autoseparators]
+ lappend res [.tt cget -autoseparators]
+ lappend res [.t cget -maxundo]
+ lappend res [.tt cget -maxundo]
+ .t insert end "The undo stack is common between peers"
+ lappend res [.t edit canundo]
+ lappend res [.tt edit canundo]
+} -cleanup {
+ destroy .t .tt
+} -result {0 0 1 1 0 0 0 0}
test text-27.17 {bug fix 1536735 - undo with empty text} -body {
text .t -undo 1
set r [.t edit modified]
@@ -6577,6 +6631,66 @@ test text-27.25 {<<UndoStack>> virtual event} -setup {
} -cleanup {
destroy .t
} -result {0 0 1 2 3 4 4 5 6 6 7 8 8 9}
+test text-27.26 {edit undo and edit redo return ranges} -setup {
+ destroy .t
+ set res {}
+} -body {
+ text .t -undo true -autoseparators false
+ .t insert end "Hello "
+ .t edit separator
+ .t insert end "World!\n"
+ .t insert 1.6 "GREAT "
+ .t insert end "Another edit here!!"
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+ .t edit separator
+ .t delete 1.6
+ .t delete 1.9 1.10
+ .t insert 1.9 L
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+ .t replace 1.6 1.10 Tcl/Tk
+ .t replace 2.8 2.12 "one bites the dust"
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+} -cleanup {
+ destroy .t
+} -result [list {1.6 2.0} \
+ {1.6 2.19} \
+ {1.6 1.7 1.10 1.12} \
+ {1.6 1.7 1.9 1.11} \
+ {1.6 1.16 2.8 2.19} \
+ {1.6 1.16 2.8 2.30} ]
+test text-27.27 {edit undo and edit redo return ranges} -setup {
+ destroy .t
+ set res {}
+} -body {
+ text .t -undo true -autoseparators false
+ for {set i 3} {$i >= 1} {incr i -1} {
+ .t insert 1.0 "Line $i\n"
+ }
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+} -cleanup {
+ destroy .t
+} -result [list {1.0 2.0} \
+ {1.0 4.0} ]
+test text-27.28 {edit undo and edit redo do not leave \
+ spurious temporary marks behind them} -setup {
+ destroy .t
+ set res {}
+} -body {
+ pack [text .t -undo true -autoseparators false]
+ .t insert end "Hello World.\n"
+ .t edit separator
+ .t insert end "Again hello.\n"
+ .t edit undo
+ lappend res [lsearch [.t mark names] tk::undoMark*]
+ .t edit redo
+ lappend res [lsearch [.t mark names] tk::undoMark*]
+} -cleanup {
+ destroy .t
+} -result [list -1 -1]
test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {