From 68c988ff855b9dbfb491f6986db826f591b6f1d2 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 17 Jun 2004 22:38:55 +0000 Subject: Steps towards systematization of test constraints in Tk test suite --- ChangeLog | 6 ++ tests/bind.test | 4 +- tests/bitmap.test | 4 +- tests/border.test | 4 +- tests/clrpick.test | 74 +++++++-------- tests/color.test | 4 +- tests/config.test | 4 +- tests/constraints.tcl | 63 +++++++++--- tests/cursor.test | 4 +- tests/frame.test | 41 ++++---- tests/raise.test | 4 +- tests/scrollbar.test | 8 +- tests/send.test | 3 +- tests/textDisp.test | 6 +- tests/textIndex.test | 5 +- tests/textMark.test | 85 +++++++++-------- tests/textTag.test | 248 ++++++++++++++++++++++++------------------------ tests/textWind.test | 12 +-- tests/unixFont.test | 18 ++-- tests/unixWm.test | 4 +- tests/visual.test | 15 ++- tests/winClipboard.test | 4 +- tests/winDialog.test | 12 ++- tests/window.test | 5 +- tests/winfo.test | 14 +-- 25 files changed, 317 insertions(+), 334 deletions(-) diff --git a/ChangeLog b/ChangeLog index e828336..b7046ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-06-17 Donal K. Fellows + + * tests/constraints.tcl, tests/*.test: Systematization of test + constraints so many common and basic constraints are defined once + with a single name. + 2004-06-16 Joe English * unix/tkUnixWm.c, win/tkWinWm.c, macosx/tkMacOSXWm.c, diff --git a/tests/bind.test b/tests/bind.test index 9117204..b9f2200 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: bind.test,v 1.13 2004/05/23 17:34:48 dkf Exp $ +# RCS: @(#) $Id: bind.test,v 1.14 2004/06/17 22:38:56 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -214,8 +214,6 @@ test bind-5.1 {Tk_CreateBindingTable procedure} { .b.c bind foo } {} -testConstraint testcbind [llength [info commands testcbind]] - test bind-6.1 {Tk_DeleteBindTable procedure} { catch {destroy .b.c} canvas .b.c diff --git a/tests/bitmap.test b/tests/bitmap.test index 95d04a9..3186cad 100644 --- a/tests/bitmap.test +++ b/tests/bitmap.test @@ -6,14 +6,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: bitmap.test,v 1.5 2004/05/23 17:34:48 dkf Exp $ +# RCS: @(#) $Id: bitmap.test,v 1.6 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint testbitmap [llength [info commands testbitmap]] - test bitmap-1.1 {Tk_AllocBitmapFromObj - converting internal reps} testbitmap { set x gray25 lindex $x 0 diff --git a/tests/border.test b/tests/border.test index 81cea0b..185a894 100644 --- a/tests/border.test +++ b/tests/border.test @@ -5,14 +5,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: border.test,v 1.5 2004/05/23 17:34:48 dkf Exp $ +# RCS: @(#) $Id: border.test,v 1.6 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint testborder [llength [info commands testborder]] - if {[testConstraint pseudocolor8]} { toplevel .t -visual {pseudocolor 8} -colormap new wm geom .t +0+0 diff --git a/tests/clrpick.test b/tests/clrpick.test index 70f1a52..9396dbb 100644 --- a/tests/clrpick.test +++ b/tests/clrpick.test @@ -5,13 +5,47 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: clrpick.test,v 1.10 2004/05/23 17:34:48 dkf Exp $ +# RCS: @(#) $Id: clrpick.test,v 1.11 2004/06/17 22:38:57 dkf Exp $ # package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands +if {[testConstraint defaultPseudocolor8]} { + # let's soak up a bunch of colors...so that + # machines with small color palettes still fail. + # some tests will be skipped if there are no more colors + set numcolors 32 + testConstraint colorsLeftover 1 + set i 0 + canvas .c + pack .c -expand 1 -fill both + while {$i<$numcolors} { + set color \#[format "%02x%02x%02x" $i [expr $i+1] [expr $i+3]] + .c create rectangle [expr 10+$i] [expr 10+$i] [expr 50+$i] [expr 50+$i] -fill $color -outline $color + incr i + } + set i 0 + while {$i<$numcolors} { + set color [.c itemcget $i -fill] + if {$color != ""} { + foreach {r g b} [winfo rgb . $color] {} + set r [expr $r/256] + set g [expr $g/256] + set b [expr $b/256] + if {"$color" != "#[format %02x%02x%02x $r $g $b]"} { + testConstraint colorsLeftover 0 + } + } + .c delete $i + incr i + } + destroy .c +} else { + testConstraint colorsLeftover 0 +} + test clrpick-1.1 {tk_chooseColor command} { list [catch {tk_chooseColor -foo} msg] $msg } {1 {bad option "-foo": must be -initialcolor, -parent, or -title}} @@ -31,19 +65,15 @@ foreach option $options { test clrpick-1.3 {tk_chooseColor command} { list [catch {tk_chooseColor -foo bar} msg] $msg } {1 {bad option "-foo": must be -initialcolor, -parent, or -title}} - test clrpick-1.4 {tk_chooseColor command} { list [catch {tk_chooseColor -initialcolor} msg] $msg } {1 {value for "-initialcolor" missing}} - test clrpick-1.5 {tk_chooseColor command} { list [catch {tk_chooseColor -parent foo.bar} msg] $msg } {1 {bad window path name "foo.bar"}} - test clrpick-1.6 {tk_chooseColor command} { list [catch {tk_chooseColor -initialcolor badbadbaadcolor} msg] $msg } {1 {unknown color name "badbadbaadcolor"}} - test clrpick-1.7 {tk_chooseColor command} { list [catch {tk_chooseColor -initialcolor ##badbadbaadcolor} msg] $msg } {1 {invalid color name "##badbadbaadcolor"}} @@ -126,37 +156,6 @@ set verylongstring $verylongstring$verylongstring #set verylongstring $verylongstring$verylongstring #set verylongstring $verylongstring$verylongstring -# let's soak up a bunch of colors...so that -# machines with small color palettes still fail. -# some tests will be skipped if there are no more colors -set numcolors 32 -testConstraint colorsLeftover 1 -set i 0 -canvas .c -pack .c -expand 1 -fill both -while {$i<$numcolors} { - set color \#[format "%02x%02x%02x" $i [expr $i+1] [expr $i+3]] - .c create rectangle [expr 10+$i] [expr 10+$i] [expr 50+$i] [expr 50+$i] -fill $color -outline $color - incr i -} -set i 0 -while {$i<$numcolors} { - set color [.c itemcget $i -fill] - if {$color != ""} { - foreach {r g b} [winfo rgb . $color] {} - set r [expr $r/256] - set g [expr $g/256] - set b [expr $b/256] - if {"$color" != "#[format %02x%02x%02x $r $g $b]"} { - testConstraint colorsLeftover 0 - } - } - .c delete $i - incr i -} - -destroy .c - set color #404040 test clrpick-2.1 {tk_chooseColor command} \ {nonUnixUserInteraction colorsLeftover} { @@ -164,7 +163,6 @@ test clrpick-2.1 {tk_chooseColor command} \ tk_chooseColor -title "Press Ok $verylongstring" -initialcolor $color \ -parent $parent } "$color" - set color #808040 test clrpick-2.2 {tk_chooseColor command} \ {nonUnixUserInteraction colorsLeftover} { @@ -172,13 +170,11 @@ test clrpick-2.2 {tk_chooseColor command} \ ToChooseColorByKey $parent 128 128 64 tk_chooseColor -parent $parent -title "choose $colors" } "$color" - test clrpick-2.3 {tk_chooseColor command} \ {nonUnixUserInteraction colorsLeftover} { ToPressButton $parent ok tk_chooseColor -parent $parent -title "Press OK" } "$color" - test clrpick-2.4 {tk_chooseColor command} {nonUnixUserInteraction} { ToPressButton $parent cancel tk_chooseColor -parent $parent -title "Press Cancel" diff --git a/tests/color.test b/tests/color.test index 1cf5d37..1be8097 100644 --- a/tests/color.test +++ b/tests/color.test @@ -5,14 +5,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: color.test,v 1.7 2003/04/01 21:06:20 dgp Exp $ +# RCS: @(#) $Id: color.test,v 1.8 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint testcolor [llength [info commands testcolor]] - # cname -- # Returns a proper name for a color, given its intensities. # diff --git a/tests/config.test b/tests/config.test index 2822a21..f27bb8d 100644 --- a/tests/config.test +++ b/tests/config.test @@ -6,14 +6,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: config.test,v 1.7 2003/04/01 21:06:20 dgp Exp $ +# RCS: @(#) $Id: config.test,v 1.8 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint testobjconfig [llength [info commands testobjconfig]] - proc killTables {} { # Note: it's important to delete chain2 before chain1, because # chain2 depends on chain1. If chain1 is deleted first, the diff --git a/tests/constraints.tcl b/tests/constraints.tcl index 2da8938..db1aa88 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -144,16 +144,38 @@ namespace eval tk { namespace import -force tk::test::* namespace import -force tcltest::testConstraint + testConstraint userInteraction 0 -testConstraint nonUnixUserInteraction [expr {[testConstraint userInteraction] - || [testConstraint unix]}] -testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)] -testConstraint noExceed [expr {![testConstraint unix] - || [catch {font actual "\{xyz"}]}] +testConstraint nonUnixUserInteraction [expr { + [testConstraint userInteraction] || [testConstraint unix] +}] +testConstraint haveDISPLAY [info exists env(DISPLAY)] +testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)] +testConstraint noExceed [expr { + ![testConstraint unix] || [catch {font actual "\{xyz"}] +}] + +# constraints for testing facilities defined in the tktest executable... testConstraint testImageType [expr {[lsearch [image types] test] >= 0}] -testConstraint testembed [llength [info commands testembed]] -testConstraint testwrapper [llength [info commands testwrapper]] -testConstraint testfont [llength [info commands testfont]] +testConstraint testbitmap [llength [info commands testbitmap]] +testConstraint testborder [llength [info commands testborder]] +testConstraint testcbind [llength [info commands testcbind]] +testConstraint testclipboard [llength [info commands testclipboard]] +testConstraint testcolor [llength [info commands testcolor]] +testConstraint testcursor [llength [info commands testcursor]] +testConstraint testembed [llength [info commands testembed]] +testConstraint testfont [llength [info commands testfont]] +testConstraint testmakeexist [llength [info commands testmakeexist]] +testConstraint testmenubar [llength [info commands testmenubar]] +testConstraint testmenubar [llength [info commands testmenubar]] +testConstraint testmetrics [llength [info commands testmetrics]] +testConstraint testobjconfig [llength [info commands testobjconfig]] +testConstraint testsend [llength [info commands testsend]] +testConstraint testtext [llength [info commands testtext]] +testConstraint testwinevent [llength [info commands testwinevent]] +testConstraint testwrapper [llength [info commands testwrapper]] + +# constraint to see what sort of fonts are available testConstraint fonts 1 destroy .e entry .e -width 0 -font {Helvetica -12} -bd 1 @@ -172,11 +194,28 @@ destroy .t if {![string match {{22 3 6 15} {31 18 [34] 15}} $x]} { testConstraint fonts 0 } -testConstraint pseudocolor8 [expr {([catch { - toplevel .t -visual {pseudocolor 8} -colormap new - }] == 0) && ([winfo depth .t] == 8)}] +testConstraint textfonts [expr { + [testConstraint fonts] || $tcl_platform(platform) eq "windows" +}] + +# constraints for the visuals available.. +testConstraint pseudocolor8 [expr { + ([catch { + toplevel .t -visual {pseudocolor 8} -colormap new + }] == 0) && ([winfo depth .t] == 8) +}] destroy .t -testConstraint haveTruecolor24 [expr {[lsearch [winfo visualsavailable .] {truecolor 24}] != -1}] +testConstraint haveTruecolor24 [expr { + [lsearch -exact [winfo visualsavailable .] {truecolor 24}] >= 0 +}] +testConstraint haveGrayscale8 [expr { + [lsearch -exact [winfo visualsavailable .] {grayscale 8}] >= 0 +}] +testConstraint defaultPseudocolor8 [expr { + ([winfo visual .] eq "pseudocolor") && ([winfo depth .] == 8) +}] + +# constraint based on whether our display is secure setupbg set app [dobg {tk appname}] testConstraint secureserver 0 diff --git a/tests/cursor.test b/tests/cursor.test index b5ce675..da8b758 100644 --- a/tests/cursor.test +++ b/tests/cursor.test @@ -6,14 +6,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: cursor.test,v 1.12 2004/05/23 17:34:48 dkf Exp $ +# RCS: @(#) $Id: cursor.test,v 1.13 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint testcursor [llength [info commands testcursor]] - test cursor-1.1 {Tk_AllocCursorFromObj - converting internal reps} {testcursor} { set x watch lindex $x 0 diff --git a/tests/frame.test b/tests/frame.test index 75e77c8..ab50de5 100644 --- a/tests/frame.test +++ b/tests/frame.test @@ -7,20 +7,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: frame.test,v 1.12 2004/06/06 11:28:14 patthoyts Exp $ +# RCS: @(#) $Id: frame.test,v 1.13 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint haveDISPLAY [info exists env(DISPLAY)] -testConstraint edibleColors [expr { - ([winfo visual .] == "pseudocolor") && ([winfo depth .] == 8) -}] -testConstraint haveGrayscale8 [expr { - [lsearch -exact [winfo visualsavailable .] {grayscale 8}] >= 0 -}] - # eatColors -- # Creates a toplevel window and allocates enough colors in it to # use up all the slots in the colormap. @@ -349,28 +341,29 @@ test frame-3.10 {TkCreateFrame procedure, -use option} -setup { option clear } -result {0 0 140 300} -# The tests below require specific display characteristics. Even so, -# they are non-portable: some machines don't seem to ever run out of +# The tests below require specific display characteristics (i.e. that +# they are run on a pseudocolor display of depth 8). Even so, they +# are non-portable: some machines don't seem to ever run out of # colors. -if {[testConstraint edibleColors]} { +if {[testConstraint defaultPseudocolor8]} { eatColors .t1 } -test frame-3.11 {TkCreateFrame procedure} {edibleColors nonPortable} { +test frame-3.11 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} { catch {destroy .t} toplevel .t -width 300 -height 200 -bg #475601 wm geometry .t +0+0 update colorsFree .t } {0} -test frame-3.12 {TkCreateFrame procedure} {edibleColors nonPortable} { +test frame-3.12 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} { catch {destroy .t} toplevel .t -width 300 -height 200 -bg #475601 -colormap new wm geometry .t +0+0 update colorsFree .t } {1} -test frame-3.13 {TkCreateFrame procedure} {edibleColors nonPortable} { +test frame-3.13 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} { catch {destroy .t} option add *t.class Toplevel2 option add *Toplevel2.colormap new @@ -380,7 +373,7 @@ test frame-3.13 {TkCreateFrame procedure} {edibleColors nonPortable} { option clear colorsFree .t } {1} -test frame-3.14 {TkCreateFrame procedure} {edibleColors nonPortable} { +test frame-3.14 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} { catch {destroy .t} option add *t.class Toplevel3 option add *Toplevel3.Colormap new @@ -393,7 +386,7 @@ test frame-3.14 {TkCreateFrame procedure} {edibleColors nonPortable} { test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -setup { catch {destroy .t} catch {destroy .x} -} -constraints {edibleColors unixOnly nonPortable} -body { +} -constraints {defaultPseudocolor8 unixOnly nonPortable} -body { toplevel .t -container 1 -width 300 -height 120 wm geometry .t +0+0 toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green -colormap new @@ -402,14 +395,14 @@ test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -setup { } -cleanup { destroy .t } -result {0 1} -test frame-3.16 {TkCreateFrame procedure} {edibleColors nonPortable} { +test frame-3.16 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} { catch {destroy .t} toplevel .t -width 300 -height 200 -bg #475601 -visual default wm geometry .t +0+0 update colorsFree .t } {0} -test frame-3.17 {TkCreateFrame procedure} {edibleColors nonPortable} { +test frame-3.17 {TkCreateFrame procedure} {defaultPseudocolor8 nonPortable} { catch {destroy .t} toplevel .t -width 300 -height 200 -bg #475601 -visual default \ -colormap new @@ -417,14 +410,14 @@ test frame-3.17 {TkCreateFrame procedure} {edibleColors nonPortable} { update colorsFree .t } {1} -test frame-3.18 {TkCreateFrame procedure} {edibleColors haveGrayscale8 nonPortable} { +test frame-3.18 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} { catch {destroy .t} toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343 wm geometry .t +0+0 update colorsFree .t 131 131 131 } {1} -test frame-3.19 {TkCreateFrame procedure} {edibleColors haveGrayscale8 nonPortable} { +test frame-3.19 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} { catch {destroy .t} option add *t.class T4 option add *T4.visual {grayscale 8} @@ -434,7 +427,7 @@ test frame-3.19 {TkCreateFrame procedure} {edibleColors haveGrayscale8 nonPortab option clear list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4] } {1 {grayscale 8}} -test frame-3.20 {TkCreateFrame procedure} {edibleColors haveGrayscale8 nonPortable} { +test frame-3.20 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} { catch {destroy .t} set x ok option add *t.class T5 @@ -445,7 +438,7 @@ test frame-3.20 {TkCreateFrame procedure} {edibleColors haveGrayscale8 nonPortab option clear list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4] } {1 {grayscale 8}} -test frame-3.21 {TkCreateFrame procedure} {edibleColors haveGrayscale8 nonPortable} { +test frame-3.21 {TkCreateFrame procedure} {defaultPseudocolor8 haveGrayscale8 nonPortable} { catch {destroy .t} set x ok toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343 @@ -453,7 +446,7 @@ test frame-3.21 {TkCreateFrame procedure} {edibleColors haveGrayscale8 nonPortab update colorsFree .t 131 131 131 } {1} -if {[testConstraint edibleColors]} { +if {[testConstraint defaultPseudocolor8]} { destroy .t1 } test frame-3.22 {TkCreateFrame procedure, default dimensions} -setup { diff --git a/tests/raise.test b/tests/raise.test index 21650f2..cdd525d 100644 --- a/tests/raise.test +++ b/tests/raise.test @@ -8,14 +8,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: raise.test,v 1.9 2004/05/23 17:34:49 dkf Exp $ +# RCS: @(#) $Id: raise.test,v 1.10 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint testmakeexist [llength [info commands testmakeexist]] - # Procedure to create a bunch of overlapping windows, which should # make it easy to detect differences in order. diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 7c0b3a7..9773b54 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -7,18 +7,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: scrollbar.test,v 1.12 2004/05/23 17:34:49 dkf Exp $ +# RCS: @(#) $Id: scrollbar.test,v 1.13 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -## testmetrics is a win/mac only test command -## -testConstraint testmetrics [llength [info commands testmetrics]] - -update - proc scroll args { global scrollInfo set scrollInfo $args diff --git a/tests/send.test b/tests/send.test index 83677d9..bf1690e 100644 --- a/tests/send.test +++ b/tests/send.test @@ -10,14 +10,13 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: send.test,v 1.10 2003/07/09 21:18:36 dkf Exp $ +# RCS: @(#) $Id: send.test,v 1.11 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint xhost [llength [auto_execok xhost]] -testConstraint testsend [llength [info commands testsend]] # Compute a script that will load Tk into a child interpreter. diff --git a/tests/textDisp.test b/tests/textDisp.test index 3205ddb..69d23d6 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -6,17 +6,13 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textDisp.test,v 1.26 2004/06/04 10:51:18 vincentdarley Exp $ +# RCS: @(#) $Id: textDisp.test,v 1.27 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test -tcltest::testConstraint textfonts [expr { - [tcltest::testConstraint fonts] || $tcl_platform(platform) eq "windows" -}] - # The procedure below is used as the scrolling command for the text; # it just saves the scrolling information in a variable "scrollInfo". diff --git a/tests/textIndex.test b/tests/textIndex.test index 1dd486a..b3cf64e 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -6,15 +6,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textIndex.test,v 1.12 2004/05/23 17:34:49 dkf Exp $ +# RCS: @(#) $Id: textIndex.test,v 1.13 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -# Some tests require the testtext command -testConstraint testtext [llength [info commands testtext]] - catch {destroy .t} text .t -font {Courier -12} -width 20 -height 10 pack append . .t {top expand fill} diff --git a/tests/textMark.test b/tests/textMark.test index 712c724..4cd3ea2 100644 --- a/tests/textMark.test +++ b/tests/textMark.test @@ -6,16 +6,17 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textMark.test,v 1.8 2004/05/23 17:34:49 dkf Exp $ +# RCS: @(#) $Id: textMark.test,v 1.9 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands catch {destroy .t} -testConstraint courier12 [expr {[catch { - text .t -font {Courier 12} -width 20 -height 10 - }] == 0}] +text .t -width 20 -height 10 +testConstraint haveCourier12 [expr {[catch { + .t configure -font {Courier 12} +}] == 0}] pack append . .t {top expand fill} update .t debug on @@ -38,83 +39,83 @@ bOy GIrl .#@? x_yz !@#$% Line 7" -test textMark-1.1 {TkTextMarkCmd - missing option} courier12 { +test textMark-1.1 {TkTextMarkCmd - missing option} haveCourier12 { list [catch {.t mark} msg] $msg } {1 {wrong # args: should be ".t mark option ?arg arg ...?"}} -test textMark-1.2 {TkTextMarkCmd - bogus option} courier12 { +test textMark-1.2 {TkTextMarkCmd - bogus option} haveCourier12 { 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} courier12 { +test textMark-1.3 {TkTextMarkCmd - "gravity" option} haveCourier12 { list [catch {.t mark gravity foo} msg] $msg } {1 {there is no mark named "foo"}} -test textMark-1.4 {TkTextMarkCmd - "gravity" option} courier12 { +test textMark-1.4 {TkTextMarkCmd - "gravity" option} haveCourier12 { .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} courier12 { +test textMark-1.5 {TkTextMarkCmd - "gravity" option} haveCourier12 { .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} courier12 { +test textMark-1.6 {TkTextMarkCmd - "gravity" option} haveCourier12 { .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} courier12 { +test textMark-1.7 {TkTextMarkCmd - "gravity" option} haveCourier12 { 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} courier12 { +test textMark-1.8 {TkTextMarkCmd - "gravity" option} haveCourier12 { list [catch {.t mark gravity} msg] $msg } {1 {wrong # args: should be ".t mark gravity markName ?gravity?"}} -test textMark-2.1 {TkTextMarkCmd - "names" option} courier12 { +test textMark-2.1 {TkTextMarkCmd - "names" option} haveCourier12 { 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} courier12 { +test textMark-2.2 {TkTextMarkCmd - "names" option} haveCourier12 { lsort [.t mark na] } {current insert} -test textMark-2.3 {TkTextMarkCmd - "names" option} courier12 { +test textMark-2.3 {TkTextMarkCmd - "names" option} haveCourier12 { .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} courier12 { +test textMark-3.1 {TkTextMarkCmd - "set" option} haveCourier12 { 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} courier12 { +test textMark-3.2 {TkTextMarkCmd - "set" option} haveCourier12 { 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} courier12 { +test textMark-3.3 {TkTextMarkCmd - "set" option} haveCourier12 { list [catch {.t mark set a @x} msg] $msg } {1 {bad text index "@x"}} -test textMark-3.4 {TkTextMarkCmd - "set" option} courier12 { +test textMark-3.4 {TkTextMarkCmd - "set" option} haveCourier12 { .t mark set a 1.2 .t index a } 1.2 -test textMark-3.5 {TkTextMarkCmd - "set" option} courier12 { +test textMark-3.5 {TkTextMarkCmd - "set" option} haveCourier12 { .t mark set a end .t index a } {8.0} -test textMark-4.1 {TkTextMarkCmd - "unset" option} courier12 { +test textMark-4.1 {TkTextMarkCmd - "unset" option} haveCourier12 { list [catch {.t mark unset} msg] $msg } {0 {}} -test textMark-4.2 {TkTextMarkCmd - "unset" option} courier12 { +test textMark-4.2 {TkTextMarkCmd - "unset" option} haveCourier12 { .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} courier12 { +test textMark-4.3 {TkTextMarkCmd - "unset" option} haveCourier12 { .t mark set a 1.2 .t mark set b 2.3 .t mark set 49ers 3.1 @@ -122,14 +123,14 @@ test textMark-4.3 {TkTextMarkCmd - "unset" option} courier12 { lsort [.t mark names] } {current insert} -test textMark-5.1 {TkTextMarkCmd - miscellaneous} courier12 { +test textMark-5.1 {TkTextMarkCmd - miscellaneous} haveCourier12 { list [catch {.t mark} msg] $msg } {1 {wrong # args: should be ".t mark option ?arg arg ...?"}} -test textMark-5.2 {TkTextMarkCmd - miscellaneous} courier12 { +test textMark-5.2 {TkTextMarkCmd - miscellaneous} haveCourier12 { 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} courier12 { +test textMark-6.1 {TkTextMarkSegToIndex} haveCourier12 { .t mark set a 1.2 .t mark set b 1.2 .t mark set c 1.2 @@ -138,79 +139,79 @@ test textMark-6.1 {TkTextMarkSegToIndex} courier12 { } {1.2 1.2 1.2 1.4} catch {eval {.t mark unset} [.t mark names]} -test textMark-7.1 {MarkFindNext - invalid mark name} courier12 { +test textMark-7.1 {MarkFindNext - invalid mark name} haveCourier12 { catch {.t mark next bogus} x set x } {bad text index "bogus"} -test textMark-7.2 {MarkFindNext - marks at same location} courier12 { +test textMark-7.2 {MarkFindNext - marks at same location} haveCourier12 { .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} courier12 { +test textMark-7.3 {MarkFindNext - numerical starting mark} haveCourier12 { .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} courier12 { +test textMark-7.4 {MarkFindNext - mark on the same line} haveCourier12 { .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} courier12 { +test textMark-7.5 {MarkFindNext - mark on the next line} haveCourier12 { .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} courier12 { +test textMark-7.6 {MarkFindNext - mark far away} haveCourier12 { .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} courier12 { +test textMark-7.7 {MarkFindNext - mark on top of end} haveCourier12 { .t mark set current end .t mark next end } {current} -test textMark-7.8 {MarkFindNext - no next mark} courier12 { +test textMark-7.8 {MarkFindNext - no next mark} haveCourier12 { .t mark set current 1.0 .t mark set insert 3.0 .t mark next insert } {} -test textMark-8.1 {MarkFindPrev - invalid mark name} courier12 { +test textMark-8.1 {MarkFindPrev - invalid mark name} haveCourier12 { catch {.t mark prev bogus} x set x } {bad text index "bogus"} -test textMark-8.2 {MarkFindPrev - marks at same location} courier12 { +test textMark-8.2 {MarkFindPrev - marks at same location} haveCourier12 { .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} courier12 { +test textMark-8.3 {MarkFindPrev - numerical starting mark} haveCourier12 { .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} courier12 { +test textMark-8.4 {MarkFindPrev - mark on the same line} haveCourier12 { .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} courier12 { +test textMark-8.5 {MarkFindPrev - mark on the previous line} haveCourier12 { .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} courier12 { +test textMark-8.6 {MarkFindPrev - mark far away} haveCourier12 { .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} courier12 { +test textMark-8.7 {MarkFindPrev - mark on top of end} haveCourier12 { .t mark set insert 3.0 .t mark set current end .t mark prev end } {insert} -test textMark-8.8 {MarkFindPrev - no previous mark} courier12 { +test textMark-8.8 {MarkFindPrev - no previous mark} haveCourier12 { .t mark set current 1.0 .t mark set insert 3.0 .t mark prev current diff --git a/tests/textTag.test b/tests/textTag.test index 21de629..b3ef1fc 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textTag.test,v 1.10 2004/05/23 17:34:49 dkf Exp $ +# RCS: @(#) $Id: textTag.test,v 1.11 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -14,10 +14,10 @@ tcltest::loadTestedCommands namespace import -force tcltest::test catch {destroy .t} -tcltest::testConstraint courier12 [expr {[catch { - text .t -font {Courier 12} -width 20 -height 10 - }] == 0}] - +text .t -width 20 -height 10 +testConstraint haveCourier12 [expr {[catch { + .t configure -font {Courier 12} +}] == 0}] pack append . .t {top expand fill} update .t debug on @@ -84,219 +84,219 @@ foreach test { {expected boolean value but got "stupid"}} } { set name [lindex $test 0] - test textTag-1.$i {tag configuration options} courier12 { + test textTag-1.$i {tag configuration options} haveCourier12 { .t tag configure x $name [lindex $test 1] .t tag cget x $name } [lindex $test 2] incr i if {[lindex $test 3] != ""} { - test textTag-1.$i {configuration options} courier12 { + test textTag-1.$i {configuration options} haveCourier12 { list [catch {.t tag configure x $name [lindex $test 3]} msg] $msg } [list 1 [lindex $test 4]] } .t tag configure x $name [lindex [.t tag configure x $name] 3] incr i } -test textTag-2.1 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.1 {TkTextTagCmd - "add" option} haveCourier12 { list [catch {.t tag} msg] $msg } {1 {wrong # args: should be ".t tag option ?arg arg ...?"}} -test textTag-2.2 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.2 {TkTextTagCmd - "add" option} haveCourier12 { list [catch {.t tag gorp} msg] $msg } {1 {bad tag option "gorp": must be add, bind, cget, configure, delete, lower, names, nextrange, prevrange, raise, ranges, or remove}} -test textTag-2.3 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.3 {TkTextTagCmd - "add" option} haveCourier12 { list [catch {.t tag add foo} msg] $msg } {1 {wrong # args: should be ".t tag add tagName index1 ?index2 index1 index2 ...?"}} -test textTag-2.4 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.4 {TkTextTagCmd - "add" option} haveCourier12 { list [catch {.t tag add x gorp} msg] $msg } {1 {bad text index "gorp"}} -test textTag-2.5 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.5 {TkTextTagCmd - "add" option} haveCourier12 { list [catch {.t tag add x 1.2 gorp} msg] $msg } {1 {bad text index "gorp"}} -test textTag-2.6 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.6 {TkTextTagCmd - "add" option} haveCourier12 { .t tag add sel 3.2 3.4 .t tag add sel 3.2 3.0 .t tag ranges sel } {3.2 3.4} -test textTag-2.7 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.7 {TkTextTagCmd - "add" option} haveCourier12 { .t tag add x 1.0 1.end .t tag ranges x } {1.0 1.6} -test textTag-2.8 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.8 {TkTextTagCmd - "add" option} haveCourier12 { .t tag remove x 1.0 end .t tag add x 1.2 .t tag ranges x } {1.2 1.3} -test textTag-2.9 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.9 {TkTextTagCmd - "add" option} haveCourier12 { .t.e select from 0 .t.e select to 4 .t tag add sel 3.2 3.4 selection get } 34 -test textTag-2.11 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.11 {TkTextTagCmd - "add" option} haveCourier12 { .t.e select from 0 .t.e select to 4 .t configure -exportselection 0 .t tag add sel 3.2 3.4 selection get } Text -test textTag-2.12 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.12 {TkTextTagCmd - "add" option} haveCourier12 { .t tag remove sel 1.0 end .t tag add sel 1.1 1.5 2.4 3.1 4.2 4.4 .t tag ranges sel } {1.1 1.5 2.4 3.1 4.2 4.4} -test textTag-2.13 {TkTextTagCmd - "add" option} courier12 { +test textTag-2.13 {TkTextTagCmd - "add" option} haveCourier12 { .t tag remove sel 1.0 end .t tag add sel 1.1 1.5 2.4 .t tag ranges sel } {1.1 1.5 2.4 2.5} catch {.t tag delete x} -test textTag-3.1 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.1 {TkTextTagCmd - "bind" option} haveCourier12 { list [catch {.t tag bind} msg] $msg } {1 {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}} -test textTag-3.2 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.2 {TkTextTagCmd - "bind" option} haveCourier12 { list [catch {.t tag bind 1 2 3 4} msg] $msg } {1 {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"}} -test textTag-3.3 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.3 {TkTextTagCmd - "bind" option} haveCourier12 { .t tag bind x script1 .t tag bind x } script1 -test textTag-3.4 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.4 {TkTextTagCmd - "bind" option} haveCourier12 { list [catch {.t tag bind x script2} msg] $msg } {1 {bad event type or keysym "Gorp"}} -test textTag-3.5 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.5 {TkTextTagCmd - "bind" option} haveCourier12 { .t tag delete x .t tag bind x script1 list [catch {.t tag bind x script2} msg] $msg [.t tag bind x] } {1 {requested illegal events; only key, button, motion, enter, leave, and virtual events may be used} } -test textTag-3.6 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.6 {TkTextTagCmd - "bind" option} haveCourier12 { .t tag delete x .t tag bind x script1 .t tag bind x script2 .t tag bind x a xyzzy list [lsort [.t tag bind x]] [.t tag bind x ] [.t tag bind x a] } {{ a} script1 xyzzy} -test textTag-3.7 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.7 {TkTextTagCmd - "bind" option} haveCourier12 { .t tag delete x .t tag bind x script1 .t tag bind x +script2 .t tag bind x } {script1 script2} -test textTag-3.7 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.7 {TkTextTagCmd - "bind" option} haveCourier12 { .t tag delete x list [catch {.t tag bind x } msg] $msg } {0 {}} -test textTag-3.8 {TkTextTagCmd - "bind" option} courier12 { +test textTag-3.8 {TkTextTagCmd - "bind" option} haveCourier12 { .t tag delete x list [catch {.t tag bind x <} msg] $msg } {1 {no event type or button # or keysym}} -test textTag-4.1 {TkTextTagCmd - "cget" option} courier12 { +test textTag-4.1 {TkTextTagCmd - "cget" option} haveCourier12 { list [catch {.t tag cget a} msg] $msg } {1 {wrong # args: should be ".t tag cget tagName option"}} -test textTag-4.2 {TkTextTagCmd - "cget" option} courier12 { +test textTag-4.2 {TkTextTagCmd - "cget" option} haveCourier12 { list [catch {.t tag cget a b c} msg] $msg } {1 {wrong # args: should be ".t tag cget tagName option"}} -test textTag-4.3 {TkTextTagCmd - "cget" option} courier12 { +test textTag-4.3 {TkTextTagCmd - "cget" option} haveCourier12 { .t tag delete foo list [catch {.t tag cget foo bar} msg] $msg } {1 {tag "foo" isn't defined in text widget}} -test textTag-4.4 {TkTextTagCmd - "cget" option} courier12 { +test textTag-4.4 {TkTextTagCmd - "cget" option} haveCourier12 { list [catch {.t tag cget sel bogus} msg] $msg } {1 {unknown option "bogus"}} -test textTag-4.5 {TkTextTagCmd - "cget" option} courier12 { +test textTag-4.5 {TkTextTagCmd - "cget" option} haveCourier12 { .t tag delete x .t tag configure x -background red list [catch {.t tag cget x -background} msg] $msg } {0 red} -test textTag-5.1 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.1 {TkTextTagCmd - "configure" option} haveCourier12 { list [catch {.t tag configure} msg] $msg } {1 {wrong # args: should be ".t tag configure tagName ?option? ?value? ?option value ...?"}} -test textTag-5.2 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.2 {TkTextTagCmd - "configure" option} haveCourier12 { list [catch {.t tag configure x -foo} msg] $msg } {1 {unknown option "-foo"}} -test textTag-5.3 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.3 {TkTextTagCmd - "configure" option} haveCourier12 { list [catch {.t tag configure x -background red -underline} msg] $msg } {1 {value for "-underline" missing}} -test textTag-5.4 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.4 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x .t tag configure x -underline yes .t tag configure x -underline } {-underline {} {} {} yes} -test textTag-5.5 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.5 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x .t tag configure x -overstrike on .t tag cget x -overstrike } {on} -test textTag-5.6 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.6 {TkTextTagCmd - "configure" option} haveCourier12 { list [catch {.t tag configure x -overstrike foo} msg] $msg } {1 {expected boolean value but got "foo"}} -test textTag-5.7 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.7 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -underline stupid} msg] $msg } {1 {expected boolean value but got "stupid"}} -test textTag-5.8 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.8 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x .t tag configure x -justify left .t tag configure x -justify } {-justify {} {} {} left} -test textTag-5.9 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.9 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -justify bogus} msg] $msg } {1 {bad justification "bogus": must be left, right, or center}} -test textTag-5.10 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.10 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -justify fill} msg] $msg } {1 {bad justification "fill": must be left, right, or center}} -test textTag-5.11 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.11 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x .t tag configure x -offset 2 .t tag configure x -offset } {-offset {} {} {} 2} -test textTag-5.12 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.12 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -offset 1.0q} msg] $msg } {1 {bad screen distance "1.0q"}} -test textTag-5.13 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.13 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x .t tag configure x -lmargin1 2 -lmargin2 4 -rmargin 5 list [.t tag configure x -lmargin1] [.t tag configure x -lmargin2] \ [.t tag configure x -rmargin] } {{-lmargin1 {} {} {} 2} {-lmargin2 {} {} {} 4} {-rmargin {} {} {} 5}} -test textTag-5.14 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.14 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -lmargin1 2.0x} msg] $msg } {1 {bad screen distance "2.0x"}} -test textTag-5.15 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.15 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -lmargin2 gorp} msg] $msg } {1 {bad screen distance "gorp"}} -test textTag-5.16 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.16 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -rmargin 140.1.1} msg] $msg } {1 {bad screen distance "140.1.1"}} .t tag delete x -test textTag-5.17 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.17 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x .t tag configure x -spacing1 2 -spacing2 4 -spacing3 6 list [.t tag configure x -spacing1] [.t tag configure x -spacing2] \ [.t tag configure x -spacing3] } {{-spacing1 {} {} {} 2} {-spacing2 {} {} {} 4} {-spacing3 {} {} {} 6}} -test textTag-5.18 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.18 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -spacing1 2.0x} msg] $msg } {1 {bad screen distance "2.0x"}} -test textTag-5.19 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.19 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -spacing1 lousy} msg] $msg } {1 {bad screen distance "lousy"}} -test textTag-5.20 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.20 {TkTextTagCmd - "configure" option} haveCourier12 { .t tag delete x list [catch {.t tag configure x -spacing1 4.2.3} msg] $msg } {1 {bad screen distance "4.2.3"}} -test textTag-5.21 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.21 {TkTextTagCmd - "configure" option} haveCourier12 { .t configure -selectborderwidth 2 -selectforeground blue \ -selectbackground black .t tag configure sel -borderwidth 4 -foreground green -background yellow @@ -306,19 +306,19 @@ test textTag-5.21 {TkTextTagCmd - "configure" option} courier12 { } set x } {4 green yellow} -test textTag-5.22 {TkTextTagCmd - "configure" option} courier12 { +test textTag-5.22 {TkTextTagCmd - "configure" option} haveCourier12 { .t configure -selectborderwidth 20 .t tag configure sel -borderwidth {} .t cget -selectborderwidth } {} -test textTag-6.1 {TkTextTagCmd - "delete" option} courier12 { +test textTag-6.1 {TkTextTagCmd - "delete" option} haveCourier12 { list [catch {.t tag delete} msg] $msg } {1 {wrong # args: should be ".t tag delete tagName ?tagName ...?"}} -test textTag-6.2 {TkTextTagCmd - "delete" option} courier12 { +test textTag-6.2 {TkTextTagCmd - "delete" option} haveCourier12 { list [catch {.t tag delete zork} msg] $msg } {0 {}} -test textTag-6.3 {TkTextTagCmd - "delete" option} courier12 { +test textTag-6.3 {TkTextTagCmd - "delete" option} haveCourier12 { .t tag delete x .t tag config x -background black .t tag config y -foreground white @@ -326,14 +326,14 @@ test textTag-6.3 {TkTextTagCmd - "delete" option} courier12 { .t tag delete y z lsort [.t tag names] } {sel x} -test textTag-6.4 {TkTextTagCmd - "delete" option} courier12 { +test textTag-6.4 {TkTextTagCmd - "delete" option} haveCourier12 { .t tag config x -background black .t tag config y -foreground white .t tag config z -background black eval .t tag delete [.t tag names] .t tag names } {sel} -test textTag-6.5 {TkTextTagCmd - "delete" option} courier12 { +test textTag-6.5 {TkTextTagCmd - "delete" option} haveCourier12 { .t tag bind x foo .t tag delete x .t tag configure x -background black @@ -347,39 +347,39 @@ proc tagsetup {} { .t tag configure $i -background black } } -test textTag-7.1 {TkTextTagCmd - "lower" option} courier12 { +test textTag-7.1 {TkTextTagCmd - "lower" option} haveCourier12 { list [catch {.t tag lower} msg] $msg } {1 {wrong # args: should be ".t tag lower tagName ?belowThis?"}} -test textTag-7.2 {TkTextTagCmd - "lower" option} courier12 { +test textTag-7.2 {TkTextTagCmd - "lower" option} haveCourier12 { list [catch {.t tag lower foo} msg] $msg } {1 {tag "foo" isn't defined in text widget}} -test textTag-7.3 {TkTextTagCmd - "lower" option} courier12 { +test textTag-7.3 {TkTextTagCmd - "lower" option} haveCourier12 { list [catch {.t tag lower sel bar} msg] $msg } {1 {tag "bar" isn't defined in text widget}} -test textTag-7.4 {TkTextTagCmd - "lower" option} courier12 { +test textTag-7.4 {TkTextTagCmd - "lower" option} haveCourier12 { tagsetup .t tag lower c .t tag names } {c sel a b d} -test textTag-7.5 {TkTextTagCmd - "lower" option} courier12 { +test textTag-7.5 {TkTextTagCmd - "lower" option} haveCourier12 { tagsetup .t tag lower d b .t tag names } {sel a d b c} -test textTag-7.6 {TkTextTagCmd - "lower" option} courier12 { +test textTag-7.6 {TkTextTagCmd - "lower" option} haveCourier12 { tagsetup .t tag lower a c .t tag names } {sel b a c d} -test textTag-8.1 {TkTextTagCmd - "names" option} courier12 { +test textTag-8.1 {TkTextTagCmd - "names" option} haveCourier12 { list [catch {.t tag names a b} msg] $msg } {1 {wrong # args: should be ".t tag names ?index?"}} -test textTag-8.2 {TkTextTagCmd - "names" option} courier12 { +test textTag-8.2 {TkTextTagCmd - "names" option} haveCourier12 { tagsetup .t tag names } {sel a b c d} -test textTag-8.3 {TkTextTagCmd - "names" option} courier12 { +test textTag-8.3 {TkTextTagCmd - "names" option} haveCourier12 { tagsetup .t tag add "a b" 2.1 2.6 .t tag add c 2.4 2.7 @@ -390,148 +390,148 @@ test textTag-8.3 {TkTextTagCmd - "names" option} courier12 { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 -test textTag-9.1 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.1 {TkTextTagCmd - "nextrange" option} haveCourier12 { list [catch {.t tag nextrange x} msg] $msg } {1 {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}} -test textTag-9.2 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.2 {TkTextTagCmd - "nextrange" option} haveCourier12 { list [catch {.t tag nextrange x 1 2 3} msg] $msg } {1 {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"}} -test textTag-9.3 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.3 {TkTextTagCmd - "nextrange" option} haveCourier12 { list [catch {.t tag nextrange foo 1.0} msg] $msg } {0 {}} -test textTag-9.4 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.4 {TkTextTagCmd - "nextrange" option} haveCourier12 { list [catch {.t tag nextrange x foo} msg] $msg } {1 {bad text index "foo"}} -test textTag-9.5 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.5 {TkTextTagCmd - "nextrange" option} haveCourier12 { list [catch {.t tag nextrange x 1.0 bar} msg] $msg } {1 {bad text index "bar"}} -test textTag-9.6 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.6 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 1.0 } {2.3 2.5} -test textTag-9.7 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.7 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 2.2 } {2.3 2.5} -test textTag-9.8 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.8 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 2.3 } {2.3 2.5} -test textTag-9.9 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.9 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 2.4 } {2.9 3.1} -test textTag-9.10 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.10 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 2.4 2.9 } {} -test textTag-9.11 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.11 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 2.4 2.10 } {2.9 3.1} -test textTag-9.12 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.12 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 2.4 2.11 } {2.9 3.1} -test textTag-9.13 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.13 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 7.0 } {7.2 7.3} -test textTag-9.14 {TkTextTagCmd - "nextrange" option} courier12 { +test textTag-9.14 {TkTextTagCmd - "nextrange" option} haveCourier12 { .t tag nextrange x 7.3 } {} -test textTag-10.1 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.1 {TkTextTagCmd - "prevrange" option} haveCourier12 { list [catch {.t tag prevrange x} msg] $msg } {1 {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"}} -test textTag-10.2 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.2 {TkTextTagCmd - "prevrange" option} haveCourier12 { list [catch {.t tag prevrange x 1 2 3} msg] $msg } {1 {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"}} -test textTag-10.3 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.3 {TkTextTagCmd - "prevrange" option} haveCourier12 { list [catch {.t tag prevrange foo end} msg] $msg } {0 {}} -test textTag-10.4 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.4 {TkTextTagCmd - "prevrange" option} haveCourier12 { list [catch {.t tag prevrange x foo} msg] $msg } {1 {bad text index "foo"}} -test textTag-10.5 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.5 {TkTextTagCmd - "prevrange" option} haveCourier12 { list [catch {.t tag prevrange x end bar} msg] $msg } {1 {bad text index "bar"}} -test textTag-10.6 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.6 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x end } {7.2 7.3} -test textTag-10.7 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.7 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 2.4 } {2.3 2.5} -test textTag-10.8 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.8 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 2.5 } {2.3 2.5} -test textTag-10.9 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.9 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 2.9 } {2.3 2.5} -test textTag-10.10 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.10 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 2.9 2.6 } {} -test textTag-10.11 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.11 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 2.9 2.5 } {} -test textTag-10.12 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.12 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 2.9 2.3 } {2.3 2.5} -test textTag-10.13 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.13 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 7.0 } {2.9 3.1} -test textTag-10.14 {TkTextTagCmd - "prevrange" option} courier12 { +test textTag-10.14 {TkTextTagCmd - "prevrange" option} haveCourier12 { .t tag prevrange x 2.3 } {} -test textTag-11.1 {TkTextTagCmd - "raise" option} courier12 { +test textTag-11.1 {TkTextTagCmd - "raise" option} haveCourier12 { list [catch {.t tag raise} msg] $msg } {1 {wrong # args: should be ".t tag raise tagName ?aboveThis?"}} -test textTag-11.2 {TkTextTagCmd - "raise" option} courier12 { +test textTag-11.2 {TkTextTagCmd - "raise" option} haveCourier12 { list [catch {.t tag raise foo} msg] $msg } {1 {tag "foo" isn't defined in text widget}} -test textTag-11.3 {TkTextTagCmd - "raise" option} courier12 { +test textTag-11.3 {TkTextTagCmd - "raise" option} haveCourier12 { list [catch {.t tag raise sel bar} msg] $msg } {1 {tag "bar" isn't defined in text widget}} -test textTag-11.4 {TkTextTagCmd - "raise" option} courier12 { +test textTag-11.4 {TkTextTagCmd - "raise" option} haveCourier12 { tagsetup .t tag raise c .t tag names } {sel a b d c} -test textTag-11.5 {TkTextTagCmd - "raise" option} courier12 { +test textTag-11.5 {TkTextTagCmd - "raise" option} haveCourier12 { tagsetup .t tag raise d b .t tag names } {sel a b d c} -test textTag-11.6 {TkTextTagCmd - "raise" option} courier12 { +test textTag-11.6 {TkTextTagCmd - "raise" option} haveCourier12 { tagsetup .t tag raise a c .t tag names } {sel b c a d} -test textTag-12.1 {TkTextTagCmd - "ranges" option} courier12 { +test textTag-12.1 {TkTextTagCmd - "ranges" option} haveCourier12 { list [catch {.t tag ranges} msg] $msg } {1 {wrong # args: should be ".t tag ranges tagName"}} -test textTag-12.2 {TkTextTagCmd - "ranges" option} courier12 { +test textTag-12.2 {TkTextTagCmd - "ranges" option} haveCourier12 { .t tag delete x .t tag ranges x } {} -test textTag-12.3 {TkTextTagCmd - "ranges" option} courier12 { +test textTag-12.3 {TkTextTagCmd - "ranges" option} haveCourier12 { .t tag delete x .t tag add x 2.2 .t tag add x 2.7 4.15 .t tag add x 5.2 5.5 .t tag ranges x } {2.2 2.3 2.7 4.6 5.2 5.5} -test textTag-12.4 {TkTextTagCmd - "ranges" option} courier12 { +test textTag-12.4 {TkTextTagCmd - "ranges" option} haveCourier12 { .t tag delete x .t tag add x 1.0 3.0 .t tag add x 4.0 end .t tag ranges x } {1.0 3.0 4.0 8.0} -test textTag-13.1 {TkTextTagCmd - "remove" option} courier12 { +test textTag-13.1 {TkTextTagCmd - "remove" option} haveCourier12 { list [catch {.t tag remove} msg] $msg } {1 {wrong # args: should be ".t tag remove tagName index1 ?index2 index1 index2 ...?"}} -test textTag-13.2 {TkTextTagCmd - "remove" option} courier12 { +test textTag-13.2 {TkTextTagCmd - "remove" option} haveCourier12 { .t tag delete x .t tag add x 2.2 2.11 .t tag remove x 2.3 2.7 .t tag ranges x } {2.2 2.3 2.7 2.11} -test textTag-13.3 {TkTextTagCmd - "remove" option} courier12 { +test textTag-13.3 {TkTextTagCmd - "remove" option} haveCourier12 { .t configure -exportselection 1 .t tag remove sel 1.0 end .t tag add sel 2.4 3.3 @@ -541,14 +541,14 @@ test textTag-13.3 {TkTextTagCmd - "remove" option} courier12 { } Text .t tag delete x a b c d -test textTag-14.1 {SortTags} courier12 { +test textTag-14.1 {SortTags} haveCourier12 { foreach i {a b c d} { .t tag add $i 2.0 2.2 } .t tag names 2.1 } {a b c d} .t tag delete a b c d -test textTag-14.2 {SortTags} courier12 { +test textTag-14.2 {SortTags} haveCourier12 { foreach i {a b c d} { .t tag configure $i -background black } @@ -558,13 +558,13 @@ test textTag-14.2 {SortTags} courier12 { .t tag names 2.1 } {a b c d} .t tag delete x a b c d -test textTag-14.3 {SortTags} courier12 { +test textTag-14.3 {SortTags} haveCourier12 { for {set i 0} {$i < 30} {incr i} { .t tag add x$i 2.0 2.2 } .t tag names 2.1 } {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29} -test textTag-14.4 {SortTags} courier12 { +test textTag-14.4 {SortTags} haveCourier12 { for {set i 0} {$i < 30} {incr i} { .t tag configure x$i -background black } @@ -587,7 +587,7 @@ set c [.t bbox 4.3] set x3 [expr [lindex $c 0] + [lindex $c 2]/2] set y3 [expr [lindex $c 1] + [lindex $c 3]/2] -test textTag-15.1 {TkTextBindProc} courier12 { +test textTag-15.1 {TkTextBindProc} haveCourier12 { bind .t {lappend x up} .t tag bind x {lappend x x-up} .t tag bind y {lappend x y-up} @@ -606,7 +606,7 @@ test textTag-15.1 {TkTextBindProc} courier12 { bind .t {} set x } {x-up up up y-up up} -test textTag-15.2 {TkTextBindProc} courier12 { +test textTag-15.2 {TkTextBindProc} haveCourier12 { catch {.t tag delete x} catch {.t tag delete y} .t tag bind x {lappend x x-enter} @@ -630,7 +630,7 @@ test textTag-15.2 {TkTextBindProc} courier12 { event gen .t -x $x3 -y $y3 set x } {x-enter | x-down | | x-up x-leave y-enter} -test textTag-15.3 {TkTextBindProc} courier12 { +test textTag-15.3 {TkTextBindProc} haveCourier12 { catch {.t tag delete x} catch {.t tag delete y} .t tag bind x {lappend x x-enter} @@ -663,7 +663,7 @@ foreach tag [.t tag names] { catch {.t tag delete $tag} } .t tag configure big -font $bigFont -test textTag-16.1 {TkTextPickCurrent procedure} courier12 { +test textTag-16.1 {TkTextPickCurrent procedure} haveCourier12 { event gen .t -state 0x100 -x $x1 -y $y1 set x [.t index current] event gen .t -x $x2 -y $y2 @@ -679,7 +679,7 @@ test textTag-16.1 {TkTextPickCurrent procedure} courier12 { event gen .t -state 0x100 -x $x3 -y $y3 lappend x [.t index current] } {2.1 3.2 3.2 3.2 3.2 3.2 4.3} -test textTag-16.2 {TkTextPickCurrent procedure} courier12 { +test textTag-16.2 {TkTextPickCurrent procedure} haveCourier12 { event gen .t -state 0x100 -x $x1 -y $y1 event gen .t -x $x2 -y $y2 set x [.t index current] @@ -692,7 +692,7 @@ foreach i {a b c d} { .t tag bind $i "lappend x enter-$i" .t tag bind $i "lappend x leave-$i" } -test textTag-16.3 {TkTextPickCurrent procedure} courier12 { +test textTag-16.3 {TkTextPickCurrent procedure} haveCourier12 { foreach i {a b c d} { .t tag remove $i 1.0 end } @@ -710,7 +710,7 @@ test textTag-16.3 {TkTextPickCurrent procedure} courier12 { event gen .t -x $x3 -y $y3 set x } {enter-a enter-b | leave-b enter-c | leave-a leave-c} -test textTag-16.4 {TkTextPickCurrent procedure} courier12 { +test textTag-16.4 {TkTextPickCurrent procedure} haveCourier12 { foreach i {a b c d} { .t tag remove $i 1.0 end } @@ -730,7 +730,7 @@ test textTag-16.4 {TkTextPickCurrent procedure} courier12 { foreach i {a b c d} { .t tag delete $i } -test textTag-16.5 {TkTextPickCurrent procedure} courier12 { +test textTag-16.5 {TkTextPickCurrent procedure} haveCourier12 { foreach i {a b c d} { .t tag remove $i 1.0 end } @@ -740,7 +740,7 @@ test textTag-16.5 {TkTextPickCurrent procedure} courier12 { event gen .t -x $x2 -y $y2 .t index current } {3.2} -test textTag-16.6 {TkTextPickCurrent procedure} courier12 { +test textTag-16.6 {TkTextPickCurrent procedure} haveCourier12 { foreach i {a b c d} { .t tag remove $i 1.0 end } @@ -751,7 +751,7 @@ test textTag-16.6 {TkTextPickCurrent procedure} courier12 { update .t index current } {3.1} -test textTag-16.7 {TkTextPickCurrent procedure} courier12 { +test textTag-16.7 {TkTextPickCurrent procedure} haveCourier12 { foreach i {a b c d} { .t tag remove $i 1.0 end } diff --git a/tests/textWind.test b/tests/textWind.test index 77e84dc..71a0354 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textWind.test,v 1.16 2004/05/23 17:34:49 dkf Exp $ +# RCS: @(#) $Id: textWind.test,v 1.17 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -15,16 +15,6 @@ tcltest::loadTestedCommands # Create entries in the option database to be sure that geometry options # like border width have predictable values. -if {[tcltest::testConstraint fonts]} { - tcltest::testConstraint textfonts 1 -} else { - if {$::tcl_platform(platform) eq "windows"} { - tcltest::testConstraint textfonts 1 - } else { - tcltest::testConstraint textfonts 0 - } -} - option add *Text.borderWidth 2 option add *Text.highlightThickness 2 option add *Text.font {Courier -12} diff --git a/tests/unixFont.test b/tests/unixFont.test index c1244c3..2fa36a6 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -12,22 +12,20 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: unixFont.test,v 1.9 2004/05/23 17:34:49 dkf Exp $ +# RCS: @(#) $Id: unixFont.test,v 1.10 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint hasArial 1 -testConstraint hasCourierNew 1 -testConstraint hasTimesNew 1 set xlsf [auto_execok xlsfonts] -if {[llength $xlsf]} { - foreach {constraint font} { - hasArial arial - hasCourierNew "courier new" - hasTimesNew "times new roman" - } { +foreach {constraint font} { + hasArial arial + hasCourierNew "courier new" + hasTimesNew "times new roman" +} { + testConstraint $constraint 1 + if {[llength $xlsf]} { if {![catch {eval exec $xlsf [list *-$font-*]} res] && ![string match *unmatched* $res]} { # Newer Unix systems have more default fonts installed, diff --git a/tests/unixWm.test b/tests/unixWm.test index 9d9e02e..05f0bb5 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: unixWm.test,v 1.37 2004/06/16 20:03:19 jenglish Exp $ +# RCS: @(#) $Id: unixWm.test,v 1.38 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.2 eval tcltest::configure $argv @@ -414,8 +414,6 @@ test unixWm-9.5 {TkWmMapWindow procedure, normal windows} unix { winfo ismapped .t } {1} -testConstraint testmenubar [llength [info commands testmenubar]] - test unixWm-10.1 {TkWmDeadWindow procedure, canceling UpdateGeometry idle handler} unix { catch {destroy .t} toplevel .t -width 100 -height 50 diff --git a/tests/visual.test b/tests/visual.test index 31a2f53..b54a8e6 100644 --- a/tests/visual.test +++ b/tests/visual.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: visual.test,v 1.9 2004/06/04 19:55:31 dgp Exp $ +# RCS: @(#) $Id: visual.test,v 1.10 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -69,12 +69,9 @@ if {[llength $avail] > 1} { } } } -tcltest::testConstraint haveOtherVisual [expr {$other ne ""}] -tcltest::testConstraint havePseudocolorVisual [string match *pseudocolor* $avail] -tcltest::testConstraint haveMultipleVisuals [expr {[llength $avail] > 1}] -tcltest::testConstraint defaultPseudocolor8 [expr { - ([winfo visual .] == "pseudocolor") && ([winfo depth .] == 8) -}] +testConstraint haveOtherVisual [expr {$other ne ""}] +testConstraint havePseudocolorVisual [string match *pseudocolor* $avail] +testConstraint haveMultipleVisuals [expr {[llength $avail] > 1}] test visual-1.1 {Tk_GetVisual, copying from other window} { list [catch {toplevel .t -visual .foo.bar} msg] $msg @@ -211,7 +208,7 @@ test visual-6.1 {Tk_GetVisual, no matching visual} {havePseudocolorVisual haveMu # These tests are non-portable due to variations in how many colors # are already in use on the screen. -if {[tcltest::testConstraint defaultPseudocolor8]} { +if {[testConstraint defaultPseudocolor8]} { eatColors .t1 } test visual-7.1 {Tk_GetColormap, "new"} {defaultPseudocolor8 nonPortable} { @@ -262,7 +259,7 @@ test visual-7.6 {Tk_GetColormap, copy from other window} {defaultPseudocolor8 ha wm geometry .t1 +0+0 list [catch {toplevel .t2 -width 400 -height 50 -colormap .t1} msg] $msg } {1 {can't use colormap for .t1: incompatible visuals}} -if {[tcltest::testConstraint defaultPseudocolor8]} { +if {[testConstraint defaultPseudocolor8]} { catch {destroy .t1} catch {destroy .t2} } diff --git a/tests/winClipboard.test b/tests/winClipboard.test index 59822f6..7efe94e 100644 --- a/tests/winClipboard.test +++ b/tests/winClipboard.test @@ -10,7 +10,7 @@ # Copyright (c) 1998-2000 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: winClipboard.test,v 1.12 2003/04/01 21:07:00 dgp Exp $ +# RCS: @(#) $Id: winClipboard.test,v 1.13 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -19,8 +19,6 @@ tcltest::loadTestedCommands # Note that these tests may fail if another application is grabbing the # clipboard (e.g. an X server) -testConstraint testclipboard [llength [info commands testclipboard]] - test winClipboard-1.1 {TkSelGetSelection} {pcOnly} { clipboard clear catch {selection get -selection CLIPBOARD} msg diff --git a/tests/winDialog.test b/tests/winDialog.test index d3881d2..b2a705a 100644 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -6,15 +6,15 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 1998-1999 ActiveState Corporation. # -# RCS: @(#) $Id: winDialog.test,v 1.10 2003/04/01 21:07:00 dgp Exp $ +# RCS: @(#) $Id: winDialog.test,v 1.11 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint testwinevent [llength [info commands testwinevent]] - -catch {testwinevent debug 1} +if {[testConstraint testwinevent]} { + catch {testwinevent debug 1} +} proc start {arg} { set ::tk_dialog 0 @@ -317,7 +317,9 @@ test winDialog-9.8 {Tk_ChooseDirectoryObjCmd:\ list [catch {tk_chooseDirectory -initialdir ~12x/455} msg] $msg } {1 {user "12x" doesn't exist}} -catch {testwinevent debug 0} +if {[testConstraint testwinevent]} { + catch {testwinevent debug 0} +} # cleanup cleanupTests diff --git a/tests/window.test b/tests/window.test index 1bdcd6f..6b7908f 100644 --- a/tests/window.test +++ b/tests/window.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: window.test,v 1.10 2004/05/23 17:34:50 dkf Exp $ +# RCS: @(#) $Id: window.test,v 1.11 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -245,9 +245,6 @@ test window-2.11 {Tk_DestroyWindow, don't reanimate a half-dead window} \ list $error $msg } {0 YES} -# Some tests require the testmenubar command -testConstraint testmenubar [llength [info commands testmenubar]] - test window-3.1 {Tk_MakeWindowExist procedure, stacking order and menubars} \ {unixOnly testmenubar} { catch {destroy .t} diff --git a/tests/winfo.test b/tests/winfo.test index f2fb1d3..7332018 100644 --- a/tests/winfo.test +++ b/tests/winfo.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: winfo.test,v 1.11 2004/03/17 18:15:50 das Exp $ +# RCS: @(#) $Id: winfo.test,v 1.12 2004/06/17 22:38:57 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -81,20 +81,16 @@ test winfo-2.7 {"winfo atom" command} { winfo atomname -displayof . 2 } SECONDARY -# Some tests require the "pseudocolor" visual class. -testConstraint pseudocolor [expr { ([winfo depth .] == 8) - && ([winfo visual .] == "pseudocolor")}] - -test winfo-3.1 {"winfo colormapfull" command} {pseudocolor} { +test winfo-3.1 {"winfo colormapfull" command} defaultPseudocolor8 { list [catch {winfo colormapfull} msg] $msg } {1 {wrong # args: should be "winfo colormapfull window"}} -test winfo-3.2 {"winfo colormapfull" command} {pseudocolor} { +test winfo-3.2 {"winfo colormapfull" command} defaultPseudocolor8 { list [catch {winfo colormapfull a b} msg] $msg } {1 {wrong # args: should be "winfo colormapfull window"}} -test winfo-3.3 {"winfo colormapfull" command} {pseudocolor} { +test winfo-3.3 {"winfo colormapfull" command} defaultPseudocolor8 { list [catch {winfo colormapfull foo} msg] $msg } {1 {bad window path name "foo"}} -test winfo-3.4 {"winfo colormapfull" command} {unixOnly pseudocolor} { +test winfo-3.4 {"winfo colormapfull" command} {unixOnly defaultPseudocolor8} { eatColors .t {-colormap new} set result [list [winfo colormapfull .] [winfo colormapfull .t]] .t.c delete 34 -- cgit v0.12