diff options
author | pspjuth <peter.spjuth@gmail.com> | 2001-08-21 20:21:36 (GMT) |
---|---|---|
committer | pspjuth <peter.spjuth@gmail.com> | 2001-08-21 20:21:36 (GMT) |
commit | 5de1e48a438ff12af2cdf2fa5542541d07be18b5 (patch) | |
tree | 8470e06c9c10c9cd3f5b83b65a958619ccc66d16 /tests | |
parent | c9fb1f587664806275461fcf4b872e8acdd913b9 (diff) | |
download | tk-5de1e48a438ff12af2cdf2fa5542541d07be18b5.zip tk-5de1e48a438ff12af2cdf2fa5542541d07be18b5.tar.gz tk-5de1e48a438ff12af2cdf2fa5542541d07be18b5.tar.bz2 |
Objectified grid and pack commands.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/grid.test | 64 | ||||
-rw-r--r-- | tests/oldpack.test | 4 | ||||
-rw-r--r-- | tests/pack.test | 8 |
3 files changed, 48 insertions, 28 deletions
diff --git a/tests/grid.test b/tests/grid.test index 7384748..9e351a8 100644 --- a/tests/grid.test +++ b/tests/grid.test @@ -5,7 +5,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: grid.test,v 1.10 2001/08/18 20:03:17 pspjuth Exp $ +# RCS: @(#) $Id: grid.test,v 1.11 2001/08/21 20:21:36 pspjuth Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -46,7 +46,7 @@ test grid-1.1 {basic argument checking} { test grid-1.2 {basic argument checking} { list [catch {grid foo bar} msg] $msg -} {1 {bad option "foo": must be bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves.}} +} {1 {bad option "foo": must be bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}} test grid-1.3 {basic argument checking} { button .b @@ -98,7 +98,7 @@ test grid-2.2 {bbox} { test grid-2.3 {bbox: argument checking} { list [catch {grid bbox . 0 0 5} msg] $msg -} {1 {wrong number of arguments: must be "grid bbox master ?column row ?column row??"}} +} {1 {wrong # args: should be "grid bbox master ?column row ?column row??"}} test grid-2.4 {bbox} { list [catch {grid bbox .bad 0 0} msg] $msg @@ -191,6 +191,19 @@ test grid-3.7 {configure: basic argument checking} { } {1 {can't put .f.b inside .}} grid_reset 3.7 +test grid-3.8 {configure: basic argument checking} { + button .b + grid configure x .b + grid slaves . +} {.b} +grid_reset 3.8 + +test grid-3.9 {configure: basic argument checking} { + button .b + list [catch {grid configure y .b} msg] $msg +} {1 {invalid window shortcut, "y" should be '-', 'x', or '^'}} +grid_reset 3.9 + test grid-4.1 {forget: basic argument checking} { list [catch {grid forget foo} msg] $msg } {1 {bad window path name "foo"}} @@ -501,19 +514,19 @@ test grid-9.3 {slaves} { test grid-9.4 {slaves} { list [catch {grid slaves . a b} msg] $msg -} {1 {invalid args: should be "grid slaves window ?-option value...?"}} +} {1 {bad option "a": must be -column or -row}} test grid-9.5 {slaves} { - list [catch {grid slaves . -foo x} msg] $msg + list [catch {grid slaves . -column x} msg] $msg } {1 {expected integer but got "x"}} test grid-9.6 {slaves} { - list [catch {grid slaves . -foo -3} msg] $msg -} {1 {-foo is an invalid value: should NOT be < 0}} + list [catch {grid slaves . -row -3} msg] $msg +} {1 {-row is an invalid value: should NOT be < 0}} test grid-9.7 {slaves} { list [catch {grid slaves . -foo 3} msg] $msg -} {1 {-foo is an invalid option: should be "-row, -column"}} +} {1 {bad option "-foo": must be -column or -row}} test grid-9.8 {slaves} { list [catch {grid slaves .x -row 3} msg] $msg @@ -584,7 +597,7 @@ grid_reset 10.6 test grid-10.7 {column/row configure} { list [catch {grid columnconfigure . 0 -foo} msg] $msg -} {1 {invalid arg "-foo": expecting -minsize, -pad, or -weight.}} +} {1 {bad option "-foo": must be -minsize, -pad, or -weight}} grid_reset 10.7 test grid-10.8 {column/row configure} { @@ -606,34 +619,34 @@ grid_reset 10.10 test grid-10.11 {column/row configure} { list [catch {grid columnconfigure . 0 -weight bad} msg] $msg } {1 {expected integer but got "bad"}} -grid_reset 10.10a +grid_reset 10.11 test grid-10.12 {column/row configure} { list [catch {grid columnconfigure . 0 -weight -3} msg] $msg } {1 {invalid arg "-weight": should be non-negative}} -grid_reset 10.11 +grid_reset 10.12 test grid-10.13 {column/row configure} { grid columnconfigure . 0 -weight 3 grid columnconfigure . 0 -weight } {3} -grid_reset 10.12 +grid_reset 10.13 test grid-10.14 {column/row configure} { list [catch {grid columnconfigure . 0 -pad foo} msg] $msg } {1 {bad screen distance "foo"}} -grid_reset 10.13 +grid_reset 10.14 test grid-10.15 {column/row configure} { list [catch {grid columnconfigure . 0 -pad -3} msg] $msg } {1 {invalid arg "-pad": should be non-negative}} -grid_reset 10.14 +grid_reset 10.15 test grid-10.16 {column/row configure} { grid columnconfigure . 0 -pad 3 grid columnconfigure . 0 -pad } {3} -grid_reset 10.15 +grid_reset 10.16 test grid-10.17 {column/row configure} { frame .f @@ -649,17 +662,24 @@ test grid-10.17 {column/row configure} { grid columnconfigure .f 0 -weight 0 set a } {0 1 0 1} -grid_reset 10.16 +grid_reset 10.17 test grid-10.18 {column/row configure} { frame .f - grid columnconfigure .f 0 -minsize 10 -weight 1 + grid columnconfigure .f {0 2} -minsize 10 -weight 1 list [grid columnconfigure .f 0 -minsize] \ [grid columnconfigure .f 1 -minsize] \ + [grid columnconfigure .f 2 -minsize] \ [grid columnconfigure .f 0 -weight] \ - [grid columnconfigure .f 1 -weight] -} {10 0 1 0} -grid_reset 10.17 + [grid columnconfigure .f 1 -weight] \ + [grid columnconfigure .f 2 -weight] +} {10 0 10 1 0 1} +grid_reset 10.18 + +test grid-10.19 {column/row configure} { + list [catch {grid columnconfigure . {0 -1 2} -weight 1} msg] $msg +} {1 {grid columnconfigure: "-1" is out of range}} +grid_reset 10.19 # auto-placement tests @@ -804,7 +824,7 @@ grid_reset 11.13 test grid-11.14 {default widget placement} { foreach i {1 2 3} { - frame .f$i -width 50 -height 50 -highlightthickness 0 -bg red + frame .f$i -width 60 -height 60 -highlightthickness 0 -bg red } grid .f1 .f2 grid ^ .f3 @@ -815,7 +835,7 @@ test grid-11.14 {default widget placement} { [winfo width .f$i],[winfo height .f$i]" } set a -} {{0,25 50,50} {50,0 50,50} {50,50 50,50}} +} {{0,30 60,60} {60,0 60,60} {60,60 60,60}} grid_reset 11.14 test grid-11.15 {^ ^ test with multiple windows} { diff --git a/tests/oldpack.test b/tests/oldpack.test index a793304..e809da5 100644 --- a/tests/oldpack.test +++ b/tests/oldpack.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: oldpack.test,v 1.3 1999/04/16 01:51:40 stanton Exp $ +# RCS: @(#) $Id: oldpack.test,v 1.4 2001/08/21 20:21:36 pspjuth Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -449,7 +449,7 @@ test pack-8.16 {syntax errors} { set msg "" set result [catch {pack append .pack .pack.blue {frame south}} msg] concat $result $msg -} {1 bad anchor position "south": must be n, ne, e, se, s, sw, w, nw, or center} +} {1 bad anchor "south": must be n, ne, e, se, s, sw, w, nw, or center} test pack-8.17 {syntax errors} { set msg "" set result [catch {pack append .pack .pack.blue {padx -2}} msg] diff --git a/tests/pack.test b/tests/pack.test index a36cb58..1603762 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: pack.test,v 1.6 2001/02/12 18:06:48 drh Exp $ +# RCS: @(#) $Id: pack.test,v 1.7 2001/08/21 20:21:36 pspjuth Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -704,7 +704,7 @@ test pack-12.8 {command options and errors} { test pack-12.9 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -anchor gorp} msg] $msg -} {1 {bad anchor position "gorp": must be n, ne, e, se, s, sw, w, nw, or center}} +} {1 {bad anchor "gorp": must be n, ne, e, se, s, sw, w, nw, or center}} test pack-12.10 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -before gorp} msg] $msg @@ -781,7 +781,7 @@ test pack-12.23 {command options and errors} { test pack-12.24 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -lousy bac} msg] $msg -} {1 {unknown or ambiguous option "-lousy": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side}} +} {1 {bad option "-lousy": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side}} test pack-12.25 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -padx} msg] $msg @@ -789,7 +789,7 @@ test pack-12.25 {command options and errors} { test pack-12.26 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a {} 22} msg] $msg -} {1 {unknown or ambiguous option "": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side}} +} {1 {bad option "": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side}} test pack-12.27 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -in .} msg] $msg |