summaryrefslogtreecommitdiffstats
path: root/tests/text.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2015-11-21 09:08:52 (GMT)
committerfvogel <fvogelnew1@free.fr>2015-11-21 09:08:52 (GMT)
commit6da3f989a4249675d97ecad8989d070f87966068 (patch)
tree46787e083f3ee21082c17033447f1a4908071643 /tests/text.test
parent1238f724da65d098cb652af93972b4d0ac6e8f72 (diff)
downloadtk-6da3f989a4249675d97ecad8989d070f87966068.zip
tk-6da3f989a4249675d97ecad8989d070f87966068.tar.gz
tk-6da3f989a4249675d97ecad8989d070f87966068.tar.bz2
Improved the tests a bit
Diffstat (limited to 'tests/text.test')
-rw-r--r--tests/text.test55
1 files changed, 45 insertions, 10 deletions
diff --git a/tests/text.test b/tests/text.test
index 3ba85b7..563f61b 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -960,13 +960,25 @@ test text-11.10 {TextWidgetCmd procedure, "insert" option} {
list [.t get 1.0 1.end] [.t tag ranges bold] [.t tag ranges silly]
} {{First second} {1.0 1.5} {1.5 1.12}}
-test text-11a.1 {TextWidgetCmd procedure, "sync" option} {
+test text-11a.1 {TextWidgetCmd procedure, "sync" option} -setup {
destroy .yt
+} -body {
text .yt
list [catch {.yt sync mytext} msg] $msg
-} {1 {wrong # args: should be ".yt sync ?-command command?"}}
-test text-11a.2 {TextWidgetCmd procedure, "sync" option} {
+} -cleanup {
+ destroy .yt
+} -result {1 {wrong # args: should be ".yt sync ?-command command?"}}
+test text-11a.2 {TextWidgetCmd procedure, "sync" option with -command} -setup {
+ destroy .yt
+} -body {
+ text .yt
+ list [catch {.yt sync -comx foo} msg] $msg
+} -cleanup {
+ destroy .yt
+} -result {1 {wrong option "-comx": should be "-command"}}
+test text-11a.3 {TextWidgetCmd procedure, "sync" option} -setup {
destroy .top.yt .top
+} -body {
toplevel .top
pack [text .top.yt]
set content {}
@@ -993,14 +1005,31 @@ test text-11a.2 {TextWidgetCmd procedure, "sync" option} {
.top.yt yview moveto $fraction1
set fraction2 [lindex [.top.yt yview] 0]
lappend res [expr {$fraction1 == $fraction2}]
-} {1 0 1}
-test text-11a.11 {TextWidgetCmd procedure, "pendingsync" option} {
+} -cleanup {
+ destroy .top.yt .top
+} -result {1 0 1}
+test text-11a.4 {TextWidgetCmd procedure, "sync" option with -command} -setup {
+ destroy .yt
+} -body {
+ set ::x 0
+ pack [text .yt] -expand 1 -fill both
+ .yt sync -command [list set ::x 1]
+ set ::x
+} -cleanup {
+ destroy .yt
+} -result {1}
+
+test text-11a.11 {TextWidgetCmd procedure, "pendingsync" option} -setup {
destroy .yt
+} -body {
text .yt
list [catch {.yt pendingsync mytext} msg] $msg
-} {1 {wrong # args: should be ".yt pendingsync"}}
-test text-11a.12 {TextWidgetCmd procedure, "pendingsync" option} {
+} -cleanup {
+ destroy .yt
+} -result {1 {wrong # args: should be ".yt pendingsync"}}
+test text-11a.12 {TextWidgetCmd procedure, "pendingsync" option} -setup {
destroy .top.yt .top
+} -body {
toplevel .top
pack [text .top.yt]
set content {}
@@ -1024,9 +1053,13 @@ test text-11a.12 {TextWidgetCmd procedure, "pendingsync" option} {
.top.yt yview moveto $fraction1
set fraction2 [lindex [.top.yt yview] 0]
lappend res [expr {$fraction1 == $fraction2}]
-} {1 1 1}
-test text-11a.21 {"<<WidgetViewSync>>" event} {
+} -cleanup {
+ destroy .top.yt .top
+} -result {1 1 1}
+
+test text-11a.21 {"<<WidgetViewSync>>" event} -setup {
destroy .top.yt .top
+} -body {
toplevel .top
pack [text .top.yt]
set content {}
@@ -1052,7 +1085,9 @@ test text-11a.21 {"<<WidgetViewSync>>" event} {
.top.yt yview moveto $fraction1
set fraction2 [lindex [.top.yt yview] 0]
lappend res [expr {$fraction1 == $fraction2}]
-} {1 1 1}
+} -cleanup {
+ destroy .top.yt .top
+} -result {1 1 1}
# edit, mark, scan, search, see, tag, window, xview and yview actions are tested elsewhere.