diff options
author | dgp <dgp@users.sourceforge.net> | 2002-07-12 21:08:48 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2002-07-12 21:08:48 (GMT) |
commit | c67bb2bfa2e4f3a9aff167a37f0d2bb6f06b67cc (patch) | |
tree | 324b81919ba9b29c1d80c92b462203c6220febbd /tests/textMark.test | |
parent | 92b5df1f4c8a5885e387c9f91b89b4ac70d00abd (diff) | |
download | tk-c67bb2bfa2e4f3a9aff167a37f0d2bb6f06b67cc.zip tk-c67bb2bfa2e4f3a9aff167a37f0d2bb6f06b67cc.tar.gz tk-c67bb2bfa2e4f3a9aff167a37f0d2bb6f06b67cc.tar.bz2 |
* Converted several files in the Tk test suite for testing by
tcltest 2.1.
Diffstat (limited to 'tests/textMark.test')
-rw-r--r-- | tests/textMark.test | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/tests/textMark.test b/tests/textMark.test index 775c252..6eae772 100644 --- a/tests/textMark.test +++ b/tests/textMark.test @@ -6,19 +6,17 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textMark.test,v 1.3 1999/04/16 01:51:41 stanton Exp $ +# RCS: @(#) $Id: textMark.test,v 1.4 2002/07/12 21:08:49 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - source [file join [pwd] [file dirname [info script]] defs.tcl] -} +package require tcltest 2.1 +namespace import -force tcltest::test +namespace import -force tcltest::testConstraint +eval tcltest::configure $argv catch {destroy .t} -if [catch {text .t -font {Courier 12} -width 20 -height 10}] { - puts "The font needed by these tests isn't available, so I'm" - puts "going to skip the tests." - ::tcltest::cleanupTests - return -} +testConstraint courier12 [expr {[catch { + text .t -font {Courier 12} -width 20 -height 10 + }] == 0}] pack append . .t {top expand fill} update .t debug on @@ -41,83 +39,83 @@ bOy GIrl .#@? x_yz !@#$% Line 7" -test textMark-1.1 {TkTextMarkCmd - missing option} { +test textMark-1.1 {TkTextMarkCmd - missing option} courier12 { list [catch {.t mark} msg] $msg } {1 {wrong # args: should be ".t mark option ?arg arg ...?"}} -test textMark-1.2 {TkTextMarkCmd - bogus option} { +test textMark-1.2 {TkTextMarkCmd - bogus option} courier12 { list [catch {.t mark gorp} msg] $msg } {1 {bad mark option "gorp": must be gravity, names, next, previous, set, or unset}} -test textMark-1.3 {TkTextMarkCmd - "gravity" option} { +test textMark-1.3 {TkTextMarkCmd - "gravity" option} courier12 { list [catch {.t mark gravity foo} msg] $msg } {1 {there is no mark named "foo"}} -test textMark-1.4 {TkTextMarkCmd - "gravity" option} { +test textMark-1.4 {TkTextMarkCmd - "gravity" option} courier12 { .t mark unset x .t mark set x 1.3 .t insert 1.3 x list [.t mark gravity x] [.t index x] } {right 1.4} -test textMark-1.5 {TkTextMarkCmd - "gravity" option} { +test textMark-1.5 {TkTextMarkCmd - "gravity" option} courier12 { .t mark unset x .t mark set x 1.3 .t mark g x left .t insert 1.3 x list [.t mark gravity x] [.t index x] } {left 1.3} -test textMark-1.6 {TkTextMarkCmd - "gravity" option} { +test textMark-1.6 {TkTextMarkCmd - "gravity" option} courier12 { .t mark unset x .t mark set x 1.3 .t mark gravity x right .t insert 1.3 x list [.t mark gravity x] [.t index x] } {right 1.4} -test textMark-1.7 {TkTextMarkCmd - "gravity" option} { +test textMark-1.7 {TkTextMarkCmd - "gravity" option} courier12 { list [catch {.t mark gravity x gorp} msg] $msg } {1 {bad mark gravity "gorp": must be left or right}} -test textMark-1.8 {TkTextMarkCmd - "gravity" option} { +test textMark-1.8 {TkTextMarkCmd - "gravity" option} courier12 { list [catch {.t mark gravity} msg] $msg } {1 {wrong # args: should be ".t mark gravity markName ?gravity?"}} -test textMark-2.1 {TkTextMarkCmd - "names" option} { +test textMark-2.1 {TkTextMarkCmd - "names" option} courier12 { list [catch {.t mark names 2} msg] $msg } {1 {wrong # args: should be ".t mark names"}} .t mark unset x -test textMark-2.2 {TkTextMarkCmd - "names" option} { +test textMark-2.2 {TkTextMarkCmd - "names" option} courier12 { lsort [.t mark n] } {current insert} -test textMark-2.3 {TkTextMarkCmd - "names" option} { +test textMark-2.3 {TkTextMarkCmd - "names" option} courier12 { .t mark set a 1.1 .t mark set "b c" 2.3 lsort [.t mark names] } {a {b c} current insert} -test textMark-3.1 {TkTextMarkCmd - "set" option} { +test textMark-3.1 {TkTextMarkCmd - "set" option} courier12 { list [catch {.t mark set a} msg] $msg } {1 {wrong # args: should be ".t mark set markName index"}} -test textMark-3.2 {TkTextMarkCmd - "set" option} { +test textMark-3.2 {TkTextMarkCmd - "set" option} courier12 { list [catch {.t mark s a b c} msg] $msg } {1 {wrong # args: should be ".t mark set markName index"}} -test textMark-3.3 {TkTextMarkCmd - "set" option} { +test textMark-3.3 {TkTextMarkCmd - "set" option} courier12 { list [catch {.t mark set a @x} msg] $msg } {1 {bad text index "@x"}} -test textMark-3.4 {TkTextMarkCmd - "set" option} { +test textMark-3.4 {TkTextMarkCmd - "set" option} courier12 { .t mark set a 1.2 .t index a } 1.2 -test textMark-3.5 {TkTextMarkCmd - "set" option} { +test textMark-3.5 {TkTextMarkCmd - "set" option} courier12 { .t mark set a end .t index a } {8.0} -test textMark-4.1 {TkTextMarkCmd - "unset" option} { +test textMark-4.1 {TkTextMarkCmd - "unset" option} courier12 { list [catch {.t mark unset} msg] $msg } {0 {}} -test textMark-4.2 {TkTextMarkCmd - "unset" option} { +test textMark-4.2 {TkTextMarkCmd - "unset" option} courier12 { .t mark set a 1.2 .t mark set b 2.3 .t mark unset a b list [catch {.t index a} msg] $msg [catch {.t index b} msg2] $msg2 } {1 {bad text index "a"} 1 {bad text index "b"}} -test textMark-4.3 {TkTextMarkCmd - "unset" option} { +test textMark-4.3 {TkTextMarkCmd - "unset" option} courier12 { .t mark set a 1.2 .t mark set b 2.3 .t mark set 49ers 3.1 @@ -125,14 +123,14 @@ test textMark-4.3 {TkTextMarkCmd - "unset" option} { lsort [.t mark names] } {current insert} -test textMark-5.1 {TkTextMarkCmd - miscellaneous} { +test textMark-5.1 {TkTextMarkCmd - miscellaneous} courier12 { list [catch {.t mark} msg] $msg } {1 {wrong # args: should be ".t mark option ?arg arg ...?"}} -test textMark-5.2 {TkTextMarkCmd - miscellaneous} { +test textMark-5.2 {TkTextMarkCmd - miscellaneous} courier12 { list [catch {.t mark foo} msg] $msg } {1 {bad mark option "foo": must be gravity, names, next, previous, set, or unset}} -test textMark-6.1 {TkTextMarkSegToIndex} { +test textMark-6.1 {TkTextMarkSegToIndex} courier12 { .t mark set a 1.2 .t mark set b 1.2 .t mark set c 1.2 @@ -141,79 +139,79 @@ test textMark-6.1 {TkTextMarkSegToIndex} { } {1.2 1.2 1.2 1.4} catch {eval {.t mark unset} [.t mark names]} -test textMark-7.1 {MarkFindNext - invalid mark name} { +test textMark-7.1 {MarkFindNext - invalid mark name} courier12 { catch {.t mark next bogus} x set x } {bad text index "bogus"} -test textMark-7.2 {MarkFindNext - marks at same location} { +test textMark-7.2 {MarkFindNext - marks at same location} courier12 { .t mark set insert 2.0 .t mark set current 2.0 .t mark next current } {insert} -test textMark-7.3 {MarkFindNext - numerical starting mark} { +test textMark-7.3 {MarkFindNext - numerical starting mark} courier12 { .t mark set current 1.0 .t mark set insert 1.0 .t mark next 1.0 } {insert} -test textMark-7.4 {MarkFindNext - mark on the same line} { +test textMark-7.4 {MarkFindNext - mark on the same line} courier12 { .t mark set current 1.0 .t mark set insert 1.1 .t mark next current } {insert} -test textMark-7.5 {MarkFindNext - mark on the next line} { +test textMark-7.5 {MarkFindNext - mark on the next line} courier12 { .t mark set current 1.end .t mark set insert 2.0 .t mark next current } {insert} -test textMark-7.6 {MarkFindNext - mark far away} { +test textMark-7.6 {MarkFindNext - mark far away} courier12 { .t mark set current 1.2 .t mark set insert 7.0 .t mark next current } {insert} -test textMark-7.7 {MarkFindNext - mark on top of end} { +test textMark-7.7 {MarkFindNext - mark on top of end} courier12 { .t mark set current end .t mark next end } {current} -test textMark-7.8 {MarkFindNext - no next mark} { +test textMark-7.8 {MarkFindNext - no next mark} courier12 { .t mark set current 1.0 .t mark set insert 3.0 .t mark next insert } {} -test textMark-8.1 {MarkFindPrev - invalid mark name} { +test textMark-8.1 {MarkFindPrev - invalid mark name} courier12 { catch {.t mark prev bogus} x set x } {bad text index "bogus"} -test textMark-8.2 {MarkFindPrev - marks at same location} { +test textMark-8.2 {MarkFindPrev - marks at same location} courier12 { .t mark set insert 2.0 .t mark set current 2.0 .t mark prev insert } {current} -test textMark-8.3 {MarkFindPrev - numerical starting mark} { +test textMark-8.3 {MarkFindPrev - numerical starting mark} courier12 { .t mark set current 1.0 .t mark set insert 1.0 .t mark prev 1.1 } {current} -test textMark-8.4 {MarkFindPrev - mark on the same line} { +test textMark-8.4 {MarkFindPrev - mark on the same line} courier12 { .t mark set current 1.0 .t mark set insert 1.1 .t mark prev insert } {current} -test textMark-8.5 {MarkFindPrev - mark on the previous line} { +test textMark-8.5 {MarkFindPrev - mark on the previous line} courier12 { .t mark set current 1.end .t mark set insert 2.0 .t mark prev insert } {current} -test textMark-8.6 {MarkFindPrev - mark far away} { +test textMark-8.6 {MarkFindPrev - mark far away} courier12 { .t mark set current 1.2 .t mark set insert 7.0 .t mark prev insert } {current} -test textMark-8.7 {MarkFindPrev - mark on top of end} { +test textMark-8.7 {MarkFindPrev - mark on top of end} courier12 { .t mark set insert 3.0 .t mark set current end .t mark prev end } {insert} -test textMark-8.8 {MarkFindPrev - no previous mark} { +test textMark-8.8 {MarkFindPrev - no previous mark} courier12 { .t mark set current 1.0 .t mark set insert 3.0 .t mark prev current |