summaryrefslogtreecommitdiffstats
path: root/tests/grid.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/grid.test')
-rw-r--r--tests/grid.test1961
1 files changed, 984 insertions, 977 deletions
diff --git a/tests/grid.test b/tests/grid.test
index c1d9d06..fee81b5 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -1,23 +1,22 @@
-# This file is a Tcl script to test out the *NEW* "grid" command of Tk. It is
-# (almost) organized in the standard fashion for Tcl tests.
+# This file is a Tcl script to test out the *NEW* "grid" command
+# of Tk. It is (almost) organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.2
+package require tcltest 2.1
eval tcltest::configure $argv
tcltest::loadTestedCommands
-namespace import -force tcltest::test
-# helper routine to return "." to a sane state after a test.
-# The variable GRID_VERBOSE can be used to "look" at the result of one or all
-# of the tests
+# helper routine to return "." to a sane state after a test
+# The variable GRID_VERBOSE can be used to "look" at the result
+# of one or all of the tests
proc grid_reset {{test ?} {top .}} {
global GRID_VERBOSE
if {[info exists GRID_VERBOSE]} {
- if {$GRID_VERBOSE eq "" || $GRID_VERBOSE eq $test} {
+ if {$GRID_VERBOSE=="" || $GRID_VERBOSE==$test} {
puts -nonewline "grid test $test: "
flush stdout
gets stdin
@@ -27,10 +26,10 @@ proc grid_reset {{test ?} {top .}} {
update
foreach {cols rows} [grid size .] {}
for {set i 0} {$i <= $cols} {incr i} {
- grid columnconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform ""
+ grid columnconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform ""
}
for {set i 0} {$i <= $rows} {incr i} {
- grid rowconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform ""
+ grid rowconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform ""
}
grid propagate . 1
grid anchor . nw
@@ -39,76 +38,88 @@ proc grid_reset {{test ?} {top .}} {
grid_reset 0.0
wm geometry . {}
-
-test grid-1.1 {basic argument checking} -body {
- grid
-} -returnCodes error -result {wrong # args: should be "grid option arg ?arg ...?"}
-test grid-1.2 {basic argument checking} -body {
- grid foo bar
-} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}
-test grid-1.3 {basic argument checking} -body {
- button .b
- grid .b -row 0 -column
-} -cleanup {
- grid_reset 1.3
-} -returnCodes error -result {extra option or option with no value}
-test grid-1.4 {basic argument checking} -body {
- button .b
- grid configure .b - foo
-} -cleanup {
- grid_reset 1.4
-} -returnCodes error -result {unexpected parameter "foo" in configure list: should be window name or option}
-test grid-1.5 {basic argument checking} -body {
- grid .
-} -returnCodes error -result {can't manage ".": it's a top-level window}
-test grid-1.6 {basic argument checking} -body {
- grid x
-} -returnCodes error -result {can't determine master window}
-test grid-1.7 {basic argument checking} -body {
- grid configure x
-} -returnCodes error -result {can't determine master window}
-test grid-1.8 {basic argument checking} -body {
- button .b
- grid x .b
-} -cleanup {
- grid_reset 1.8
-} -returnCodes ok -result {}
-test grid-1.9 {basic argument checking} -body {
- button .b
- grid configure x .b
-} -cleanup {
- grid_reset 1.9
-} -returnCodes ok -result {}
-test grid-2.1 {bbox} -body {
- grid bbox .
-} -result {0 0 0 0}
-test grid-2.2 {bbox} -body {
- button .b
- grid .b
- destroy .b
- update
- grid bbox .
-} -result {0 0 0 0}
-test grid-2.3 {bbox: argument checking} -body {
- grid bbox . 0 0 5
-} -returnCodes error -result {wrong # args: should be "grid bbox master ?column row ?column row??"}
-test grid-2.4 {bbox} -body {
- grid bbox .bad 0 0
-} -returnCodes error -result {bad window path name ".bad"}
-test grid-2.5 {bbox} -body {
- grid bbox . x 0
-} -returnCodes error -result {expected integer but got "x"}
-test grid-2.6 {bbox} -body {
- grid bbox . 0 x
-} -returnCodes error -result {expected integer but got "x"}
-test grid-2.7 {bbox} -body {
- grid bbox . 0 0 x 0
-} -returnCodes error -result {expected integer but got "x"}
-test grid-2.8 {bbox} -body {
- grid bbox . 0 0 0 x
-} -returnCodes error -result {expected integer but got "x"}
-test grid-2.9 {bbox} -body {
+test grid-1.1 {basic argument checking} {
+ list [catch grid msg] $msg
+} {1 {wrong # args: should be "grid option arg ?arg ...?"}}
+
+test grid-1.2 {basic argument checking} {
+ list [catch {grid foo bar} msg] $msg
+} {1 {bad option "foo": must be anchor, bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}}
+
+test grid-1.3 {basic argument checking} {
+ button .b
+ list [catch {grid .b -row 0 -column} msg] $msg
+} {1 {extra option or option with no value}}
+grid_reset 1.3
+
+test grid-1.4 {basic argument checking} {
+ button .b
+ list [catch {grid configure .b - foo} msg] $msg
+} {1 {unexpected parameter, "foo", in configure list. Should be window name or option}}
+grid_reset 1.4
+
+test grid-1.5 {basic argument checking} {
+ list [catch {grid .} msg] $msg
+} {1 {can't manage ".": it's a top-level window}}
+
+test grid-1.6 {basic argument checking} {
+ list [catch {grid x} msg] $msg
+} {1 {can't determine master window}}
+
+test grid-1.7 {basic argument checking} {
+ list [catch {grid configure x} msg] $msg
+} {1 {can't determine master window}}
+
+test grid-1.8 {basic argument checking} {
+ button .b
+ list [catch {grid x .b} msg] $msg
+} {0 {}}
+grid_reset 1.8
+
+test grid-1.9 {basic argument checking} {
+ button .b
+ list [catch {grid configure x .b} msg] $msg
+} {0 {}}
+grid_reset 1.9
+
+test grid-2.1 {bbox} {
+ list [catch {grid bbox .} msg] $msg
+} {0 {0 0 0 0}}
+
+test grid-2.2 {bbox} {
+ button .b
+ grid .b
+ destroy .b
+ update
+ list [catch {grid bbox .} msg] $msg
+} {0 {0 0 0 0}}
+
+test grid-2.3 {bbox: argument checking} {
+ list [catch {grid bbox . 0 0 5} msg] $msg
+} {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
+} {1 {bad window path name ".bad"}}
+
+test grid-2.5 {bbox} {
+ list [catch {grid bbox . x 0} msg] $msg
+} {1 {expected integer but got "x"}}
+
+test grid-2.6 {bbox} {
+ list [catch {grid bbox . 0 x} msg] $msg
+} {1 {expected integer but got "x"}}
+
+test grid-2.7 {bbox} {
+ list [catch {grid bbox . 0 0 x 0} msg] $msg
+} {1 {expected integer but got "x"}}
+
+test grid-2.8 {bbox} {
+ list [catch {grid bbox . 0 0 0 x} msg] $msg
+} {1 {expected integer but got "x"}}
+
+test grid-2.9 {bbox} {
frame .1 -width 75 -height 75 -bg red
frame .2 -width 90 -height 90 -bg red
grid .1 -row 0 -column 0
@@ -119,11 +130,11 @@ test grid-2.9 {bbox} -body {
lappend a [grid bbox . 0 0]
lappend a [grid bbox . 0 0 1 1]
lappend a [grid bbox . 1 1]
- return $a
-} -cleanup {
- grid_reset 2.9
-} -result {{0 0 165 165} {0 0 75 75} {0 0 165 165} {75 75 90 90}}
-test grid-2.10 {bbox} -body {
+ set a
+} {{0 0 165 165} {0 0 75 75} {0 0 165 165} {75 75 90 90}}
+grid_reset 2.9
+
+test grid-2.10 {bbox} {
frame .1 -width 75 -height 75 -bg red
frame .2 -width 90 -height 90 -bg red
grid .1 -row 0 -column 0
@@ -133,98 +144,98 @@ test grid-2.10 {bbox} -body {
lappend a [grid bbox . 10 10 0 0]
lappend a [grid bbox . -2 -2 -1 -1]
lappend a [grid bbox . 10 10 12 12]
- return $a
-} -cleanup {
- grid_reset 2.10
-} -result {{0 0 165 165} {0 0 0 0} {165 165 0 0}}
-
-test grid-3.1 {configure: basic argument checking} -body {
- grid configure foo
-} -returnCodes error -result {bad argument "foo": must be name of window}
-test grid-3.2 {configure: basic argument checking} -body {
+ set a
+} {{0 0 165 165} {0 0 0 0} {165 165 0 0}}
+grid_reset 2.10
+
+test grid-3.1 {configure: basic argument checking} {
+ list [catch {grid configure foo} msg] $msg
+} {1 {bad argument "foo": must be name of window}}
+
+test grid-3.2 {configure: basic argument checking} {
button .b
grid configure .b
grid slaves .
-} -cleanup {
- grid_reset 3.2
-} -result {.b}
-test grid-3.3 {configure: basic argument checking} -body {
+} {.b}
+grid_reset 3.2
+
+test grid-3.3 {configure: basic argument checking} {
button .b
- grid .b -row -1
-} -cleanup {
- grid_reset 3.3
-} -returnCodes error -result {bad row value "-1": must be a non-negative integer}
-test grid-3.4 {configure: basic argument checking} -body {
+ list [catch {grid .b -row -1} msg] $msg
+} {1 {bad row value "-1": must be a non-negative integer}}
+grid_reset 3.3
+
+test grid-3.4 {configure: basic argument checking} {
button .b
- grid .b -column -1
-} -cleanup {
- grid_reset 3.4
-} -returnCodes error -result {bad column value "-1": must be a non-negative integer}
-test grid-3.5 {configure: basic argument checking} -body {
+ list [catch {grid .b -column -1} msg] $msg
+} {1 {bad column value "-1": must be a non-negative integer}}
+grid_reset 3.4
+
+test grid-3.5 {configure: basic argument checking} {
button .b
- grid .b -rowspan 0
-} -cleanup {
- grid_reset 3.5
-} -returnCodes error -result {bad rowspan value "0": must be a positive integer}
-test grid-3.6 {configure: basic argument checking} -body {
+ list [catch {grid .b -rowspan 0} msg] $msg
+} {1 {bad rowspan value "0": must be a positive integer}}
+grid_reset 3.5
+
+test grid-3.6 {configure: basic argument checking} {
button .b
- grid .b -columnspan 0
-} -cleanup {
- grid_reset 3.6
-} -returnCodes error -result {bad columnspan value "0": must be a positive integer}
-test grid-3.7 {configure: basic argument checking} -body {
+ list [catch {grid .b -columnspan 0} msg] $msg
+} {1 {bad columnspan value "0": must be a positive integer}}
+grid_reset 3.6
+
+test grid-3.7 {configure: basic argument checking} {
frame .f
button .f.b
- grid .f .f.b
-} -cleanup {
- grid_reset 3.7
-} -returnCodes error -result {can't put .f.b inside .}
-test grid-3.8 {configure: basic argument checking} -body {
+ list [catch {grid .f .f.b} msg] $msg
+} {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 .
-} -cleanup {
- grid_reset 3.8
-} -result {.b}
-test grid-3.9 {configure: basic argument checking} -body {
+} {.b}
+grid_reset 3.8
+
+test grid-3.9 {configure: basic argument checking} {
button .b
- grid configure y .b
-} -cleanup {
- grid_reset 3.9
-} -returnCodes error -result {invalid window shortcut, "y" should be '-', 'x', or '^'}
-
-test grid-4.1 {forget: basic argument checking} -body {
- grid forget foo
-} -returnCodes error -result {bad window path name "foo"}
-test grid-4.2 {forget} -body {
+ 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"}}
+
+test grid-4.2 {forget} {
button .c
grid [button .b]
set a [grid slaves .]
grid forget .b .c
lappend a [grid slaves .]
- return $a
-} -cleanup {
- grid_reset 4.2
-} -result {.b {}}
-test grid-4.3 {forget} -body {
+ set a
+} {.b {}}
+grid_reset 4.2
+
+test grid-4.3 {forget} {
button .c
grid .c -row 2 -column 2 -rowspan 2 -columnspan 2 -padx 3 -pady 4 -sticky ns
grid forget .c
grid .c -row 0 -column 0
grid info .c
-} -cleanup {
- grid_reset 4.3
-} -result {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}
-test grid-4.4 {forget} -body {
+} {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}
+grid_reset 4.3
+
+test grid-4.3.1 {forget} {
button .c
grid .c -row 2 -column 2 -rowspan 2 -columnspan 2 -padx {3 5} -pady {4 7} -sticky ns
grid forget .c
grid .c -row 0 -column 0
grid info .c
-} -cleanup {
- grid_reset 4.3.1
-} -result {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}
-test grid-4.5 {forget, calling Tk_UnmaintainGeometry} -body {
+} {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}
+grid_reset 4.3.1
+
+test grid-4.4 {forget, calling Tk_UnmaintainGeometry} {
frame .f -bd 2 -relief raised
place .f -x 10 -y 20 -width 200 -height 100
frame .f2 -width 50 -height 30 -bg red
@@ -235,56 +246,59 @@ test grid-4.5 {forget, calling Tk_UnmaintainGeometry} -body {
place .f -x 30
update
lappend x [winfo ismapped .f2]
-} -cleanup {
- grid_reset 4.4
-} -result {1 0}
-
-test grid-5.1 {info: basic argument checking} -body {
- grid info a b
-} -returnCodes error -result {wrong # args: should be "grid info window"}
-test grid-5.2 {info} -body {
+} {1 0}
+grid_reset 4.4
+
+test grid-5.1 {info: basic argument checking} {
+ list [catch {grid info a b} msg] $msg
+} {1 {wrong # args: should be "grid info window"}}
+
+test grid-5.2 {info} {
frame .1 -width 75 -height 75 -bg red
grid .1 -row 0 -column 0
update
- grid info .x
-} -cleanup {
- grid_reset 5.2
-} -returnCodes error -result {bad window path name ".x"}
-test grid-5.3 {info} -body {
+ list [catch {grid info .x} msg] $msg
+} {1 {bad window path name ".x"}}
+grid_reset 5.2
+
+test grid-5.3 {info} {
frame .1 -width 75 -height 75 -bg red
grid .1 -row 0 -column 0
update
- grid info .1
-} -cleanup {
- grid_reset 5.3
-} -result {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}
-test grid-5.4 {info} -body {
+ list [catch {grid info .1} msg] $msg
+} {0 {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}}
+grid_reset 5.3
+
+test grid-5.4 {info} {
frame .1 -width 75 -height 75 -bg red
update
- grid info .1
-} -cleanup {
- grid_reset 5.4
-} -returnCodes ok -result {}
-
-test grid-6.1 {location: basic argument checking} -body {
- grid location .
-} -returnCodes error -result {wrong # args: should be "grid location master x y"}
-test grid-6.2 {location: basic argument checking} -body {
- grid location .bad 0 0
-} -returnCodes error -result {bad window path name ".bad"}
-test grid-6.3 {location: basic argument checking} -body {
- grid location . x y
-} -returnCodes error -result {bad screen distance "x"}
-test grid-6.4 {location: basic argument checking} -body {
- grid location . 1c y
-} -returnCodes error -result {bad screen distance "y"}
-test grid-6.5 {location: basic argument checking} -body {
- frame .f
- grid location .f 10 10
-} -cleanup {
- grid_reset 6.5
-} -result {-1 -1}
-test grid-6.6 {location (x)} -body {
+ list [catch {grid info .1} msg] $msg
+} {0 {}}
+grid_reset 5.4
+
+test grid-6.1 {location: basic argument checking} {
+ list [catch "grid location ." msg] $msg
+} {1 {wrong # args: should be "grid location master x y"}}
+
+test grid-6.2 {location: basic argument checking} {
+ list [catch "grid location .bad 0 0" msg] $msg
+} {1 {bad window path name ".bad"}}
+
+test grid-6.3 {location: basic argument checking} {
+ list [catch "grid location . x y" msg] $msg
+} {1 {bad screen distance "x"}}
+
+test grid-6.4 {location: basic argument checking} {
+ list [catch "grid location . 1c y" msg] $msg
+} {1 {bad screen distance "y"}}
+
+test grid-6.5 {location: basic argument checking} {
+ frame .f
+ grid location .f 10 10
+} {-1 -1}
+grid_reset 6.5
+
+test grid-6.6 {location (x)} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -297,11 +311,11 @@ test grid-6.6 {location (x)} -body {
set got $a
}
}
- return $result
-} -cleanup {
- grid_reset 6.6
-} -result {{-10->-1 0} {0->0 0} {201->1 0}}
-test grid-6.7 {location (y)} -body {
+ set result
+} {{-10->-1 0} {0->0 0} {201->1 0}}
+grid_reset 6.6
+
+test grid-6.7 {location (y)} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -314,11 +328,11 @@ test grid-6.7 {location (y)} -body {
set got $a
}
}
- return $result
-} -cleanup {
- grid_reset 6.7
-} -result {{-10->0 -1} {0->0 0} {101->0 1}}
-test grid-6.8 {location (weights)} -body {
+ set result
+} {{-10->0 -1} {0->0 0} {101->0 1}}
+grid_reset 6.7
+
+test grid-6.8 {location (weights)} {
frame .f -width 300 -height 100 -highlightthickness 0 -bg red
frame .a
grid .a
@@ -337,50 +351,47 @@ test grid-6.8 {location (weights)} -body {
set got $a
}
}
- return $result
-} -cleanup {
- grid_reset 6.8
-} -result {{-10->-1 -1} {0->0 0} {16->0 1} {201->1 1}}
-test grid-6.9 {location: check updates pending} -constraints {
- nonPortable
-} -body {
- set a ""
- foreach i {0 1 2} {
- frame .$i -width 120 -height 75 -bg red
- lappend a [grid location . 150 90]
- grid .$i -row $i -column $i
- }
- return $a
-} -cleanup {
- grid_reset 6.9
-} -result {{0 0} {1 1} {1 1}}
-
-test grid-7.1 {propagate} -body {
- grid propagate . 1 xxx
-} -cleanup {
- grid_reset 7.1
-} -returnCodes error -result {wrong # args: should be "grid propagate window ?boolean?"}
-test grid-7.2 {propagate} -body {
- grid propagate .
-} -cleanup {
- grid_reset 7.2
-} -result {1}
-test grid-7.3 {propagate} -body {
- grid propagate . 0;grid propagate .
-} -cleanup {
- grid_reset 7.3
-} -result {0}
-test grid-7.4 {propagate} -body {
- grid propagate .x
-} -cleanup {
- grid_reset 7.4
-} -returnCodes error -result {bad window path name ".x"}
-test grid-7.5 {propagate} -body {
- grid propagate . x
-} -cleanup {
- grid_reset 7.5
-} -returnCodes error -result {expected boolean value but got "x"}
-test grid-7.6 {propagate} -body {
+ set result
+} {{-10->-1 -1} {0->0 0} {16->0 1} {201->1 1}}
+grid_reset 6.8
+
+test grid-6.9 {location: check updates pending} {nonPortable} {
+ set a ""
+ foreach i {0 1 2} {
+ frame .$i -width 120 -height 75 -bg red
+ lappend a [grid location . 150 90]
+ grid .$i -row $i -column $i
+ }
+ set a
+} {{0 0} {1 1} {1 1}}
+grid_reset 6.9
+
+test grid-7.1 {propagate} {
+ list [catch {grid propagate . 1 xxx} msg] $msg
+} {1 {wrong # args: should be "grid propagate window ?boolean?"}}
+grid_reset 7.1
+
+test grid-7.2 {propagate} {
+ list [catch {grid propagate .} msg] $msg
+} {0 1}
+grid_reset 7.2
+
+test grid-7.3 {propagate} {
+ list [catch {grid propagate . 0;grid propagate .} msg] $msg
+} {0 0}
+grid_reset 7.3
+
+test grid-7.4 {propagate} {
+ list [catch {grid propagate .x} msg] $msg
+} {1 {bad window path name ".x"}}
+grid_reset 7.4
+
+test grid-7.5 {propagate} {
+ list [catch {grid propagate . x} msg] $msg
+} {1 {expected boolean value but got "x"}}
+grid_reset 7.5
+
+test grid-7.6 {propagate} {
frame .f -width 100 -height 100 -bg red
grid .f -row 0 -column 0
update
@@ -393,39 +404,37 @@ test grid-7.6 {propagate} -body {
grid propagate .f 1
update
lappend a [winfo width .f]x[winfo height .f]
- return $a
-} -cleanup {
- grid_reset 7.6
-} -result {100x100 100x100 75x85}
-test grid-7.7 {propagate} -body {
+ set a
+} {100x100 100x100 75x85}
+grid_reset 7.6
+test grid-7.7 {propagate} {
grid propagate . 1
set res [list [grid propagate .]]
grid propagate . 0
lappend res [grid propagate .]
grid propagate . 0
lappend res [grid propagate .]
- return $res
-} -cleanup {
- grid_reset 7.7
-} -result [list 1 0 0]
-
-test grid-8.1 {size} -body {
- grid size . foo
-} -cleanup {
- grid_reset 8.1
-} -returnCodes error -result {wrong # args: should be "grid size window"}
-test grid-8.2 {size} -body {
- grid size .x
-} -cleanup {
- grid_reset 8.2
-} -returnCodes error -result {bad window path name ".x"}
-test grid-8.3 {size} -body {
+ set res
+} [list 1 0 0]
+grid_reset 7.7
+
+test grid-8.1 {size} {
+ list [catch {grid size . foo} msg] $msg
+} {1 {wrong # args: should be "grid size window"}}
+grid_reset 8.1
+
+test grid-8.2 {size} {
+ list [catch {grid size .x} msg] $msg
+} {1 {bad window path name ".x"}}
+grid_reset 8.2
+
+test grid-8.3 {size} {
frame .f
- grid size .f
-} -cleanup {
- grid_reset 8.3
-} -result {0 0}
-test grid-8.4 {size} -body {
+ list [catch {grid size .f} msg] $msg
+} {0 {0 0}}
+grid_reset 8.3
+
+test grid-8.4 {size} {
catch {unset a}
scale .f
grid .f -row 0 -column 0
@@ -440,11 +449,11 @@ test grid-8.4 {size} -body {
grid .f -row 0 -column 0
update
lappend a [grid size .]
- return $a
-} -cleanup {
- grid_reset 8.4
-} -result {{1 1} {6 5} {664 948} {1 1}}
-test grid-8.5 {size} -body {
+ set a
+} {{1 1} {6 5} {664 948} {1 1}}
+grid_reset 8.4
+
+test grid-8.5 {size} {
catch {unset a}
scale .f
grid .f -row 0 -column 0
@@ -460,11 +469,11 @@ test grid-8.5 {size} -body {
grid rowconfigure . 17 -weight 0
update
lappend a [grid size .]
- return $a
-} -cleanup {
- grid_reset 8.5
-} -result {{1 1} {1 18} {64 18} {1 1}}
-test grid-8.6 {size} -body {
+ set a
+} {{1 1} {1 18} {64 18} {1 1}}
+grid_reset 8.5
+
+test grid-8.6 {size} {
catch {unset a}
scale .f
grid .f -row 10 -column 50
@@ -486,48 +495,56 @@ test grid-8.6 {size} -body {
grid columnconfigure . 15 -weight 0
update
lappend a [grid size .]
- return $a
-} -cleanup {
- grid_reset 8.6
-} -result {{51 11} {51 11} {31 11} {21 11} {16 1} {1 1}}
+ set a
+} {{51 11} {51 11} {31 11} {21 11} {16 1} {1 1}}
+grid_reset 8.6
-test grid-9.1 {slaves} -body {
- grid slaves .
-} -returnCodes ok -result {}
-test grid-9.2 {slaves} -body {
- grid slaves .foo
-} -returnCodes error -result {bad window path name ".foo"}
-test grid-9.3 {slaves} -body {
- grid slaves a b
-} -returnCodes error -result {wrong # args: should be "grid slaves window ?-option value ...?"}
-test grid-9.4 {slaves} -body {
- grid slaves . a b
-} -returnCodes error -result {bad option "a": must be -column or -row}
-test grid-9.5 {slaves} -body {
- grid slaves . -column x
-} -returnCodes error -result {expected integer but got "x"}
-test grid-9.6 {slaves} -body {
- grid slaves . -row -3
-} -returnCodes error -result {-3 is an invalid value: should NOT be < 0}
-test grid-9.7 {slaves} -body {
- grid slaves . -foo 3
-} -returnCodes error -result {bad option "-foo": must be -column or -row}
-test grid-9.8 {slaves} -body {
- grid slaves .x -row 3
-} -returnCodes error -result {bad window path name ".x"}
-test grid-9.9 {slaves} -body {
- grid slaves . -row 3
-} -returnCodes ok -result {}
-test grid-9.10 {slaves} -body {
- foreach i {0 1 2} {
- label .$i -text $i
- grid .$i -row $i -column $i
- }
- grid slaves .
-} -cleanup {
- grid_reset 9.10
-} -result {.2 .1 .0}
-test grid-9.11 {slaves} -body {
+test grid-9.1 {slaves} {
+ list [catch {grid slaves .} msg] $msg
+} {0 {}}
+
+test grid-9.2 {slaves} {
+ list [catch {grid slaves .foo} msg] $msg
+} {1 {bad window path name ".foo"}}
+
+test grid-9.3 {slaves} {
+ list [catch {grid slaves a b} msg] $msg
+} {1 {wrong # args: should be "grid slaves window ?-option value...?"}}
+
+test grid-9.4 {slaves} {
+ list [catch {grid slaves . a b} msg] $msg
+} {1 {bad option "a": must be -column or -row}}
+
+test grid-9.5 {slaves} {
+ list [catch {grid slaves . -column x} msg] $msg
+} {1 {expected integer but got "x"}}
+
+test grid-9.6 {slaves} {
+ 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 {bad option "-foo": must be -column or -row}}
+
+test grid-9.8 {slaves} {
+ list [catch {grid slaves .x -row 3} msg] $msg
+} {1 {bad window path name ".x"}}
+
+test grid-9.9 {slaves} {
+ list [catch {grid slaves . -row 3} msg] $msg
+} {0 {}}
+
+test grid-9.10 {slaves} {
+ foreach i {0 1 2} {
+ label .$i -text $i
+ grid .$i -row $i -column $i
+ }
+ list [catch {grid slaves .} msg] $msg
+} {0 {.2 .1 .0}}
+grid_reset 9.10
+
+test grid-9.11 {slaves} {
catch {unset a}
foreach i {0 1 2} {
label .$i -text $i
@@ -541,146 +558,146 @@ test grid-9.11 {slaves} -body {
foreach col {0 1 2 3} {
lappend a $col{[grid slaves . -column $col]}
}
- return $a
-} -cleanup {
- grid_reset 9.11
-} -result {{0{.0-x .0}} {1{.1-x .1}} {2{.2-x .2}} 3{} 0{.0} {1{.1 .0-x}} {2{.2 .1-x}} 3{.2-x}}
+ set a
+} {{0{.0-x .0}} {1{.1-x .1}} {2{.2-x .2}} 3{} 0{.0} {1{.1 .0-x}} {2{.2 .1-x}} 3{.2-x}}
+grid_reset 9.11
# column/row configure
-test grid-10.1 {column/row configure} -body {
- grid columnconfigure .
-} -cleanup {
- grid_reset 10.1
-} -returnCodes error -result {wrong # args: should be "grid columnconfigure master index ?-option value ...?"}
-test grid-10.2 {column/row configure} -body {
- grid columnconfigure . 0 -weight 0 -pad
-} -cleanup {
- grid_reset 10.2
-} -returnCodes error -result {wrong # args: should be "grid columnconfigure master index ?-option value ...?"}
-test grid-10.3 {column/row configure} -body {
- grid columnconfigure .f 0 -weight
-} -cleanup {
- grid_reset 10.3
-} -returnCodes error -result {bad window path name ".f"}
-test grid-10.4 {column/row configure} -body {
- grid columnconfigure . nine -weight
-} -cleanup {
- grid_reset 10.4
-} -returnCodes error -result {expected integer but got "nine" (when retrieving options only integer indices are allowed)}
-test grid-10.5 {column/row configure} -body {
- grid columnconfigure . 265 -weight
-} -cleanup {
- grid_reset 10.5
-} -result {0}
-test grid-10.6 {column/row configure} -body {
- grid columnconfigure . 0
-} -cleanup {
- grid_reset 10.6
-} -result {-minsize 0 -pad 0 -uniform {} -weight 0}
-test grid-10.7 {column/row configure} -body {
- grid columnconfigure . 0 -foo
-} -cleanup {
- grid_reset 10.7
-} -returnCodes error -result {bad option "-foo": must be -minsize, -pad, -uniform, or -weight}
-test grid-10.8 {column/row configure} -body {
- grid columnconfigure . 0 -minsize foo
-} -cleanup {
- grid_reset 10.8
-} -returnCodes error -result {bad screen distance "foo"}
-test grid-10.9 {column/row configure} -body {
- grid columnconfigure . 0 -minsize foo
-} -cleanup {
- grid_reset 10.9
-} -returnCodes error -result {bad screen distance "foo"}
-test grid-10.10 {column/row configure} -body {
- grid columnconfigure . 0 -minsize 10
- grid columnconfigure . 0 -minsize
-} -cleanup {
- grid_reset 10.10
-} -result {10}
-test grid-10.11 {column/row configure} -body {
- grid columnconfigure . 0 -weight bad
-} -cleanup {
- grid_reset 10.11
-} -returnCodes error -result {expected integer but got "bad"}
-test grid-10.12 {column/row configure} -body {
- grid columnconfigure . 0 -weight -3
-} -cleanup {
- grid_reset 10.12
-} -returnCodes error -result {invalid arg "-weight": should be non-negative}
-test grid-10.13 {column/row configure} -body {
- grid columnconfigure . 0 -weight 3
- grid columnconfigure . 0 -weight
-} -cleanup {
- grid_reset 10.13
-} -result {3}
-test grid-10.14 {column/row configure} -body {
- grid columnconfigure . 0 -pad foo
-} -cleanup {
- grid_reset 10.14
-} -returnCodes error -result {bad screen distance "foo"}
-test grid-10.15 {column/row configure} -body {
- grid columnconfigure . 0 -pad -3
-} -cleanup {
- grid_reset 10.15
-} -returnCodes error -result {invalid arg "-pad": should be non-negative}
-test grid-10.16 {column/row configure} -body {
- grid columnconfigure . 0 -pad 3
- grid columnconfigure . 0 -pad
-} -cleanup {
- grid_reset 10.16
-} -result {3}
-test grid-10.17 {column/row configure} -body {
- frame .f
- set a ""
- grid columnconfigure .f 0 -weight 0
- lappend a [grid columnconfigure .f 0 -weight]
- grid columnconfigure .f 0 -weight 1
- lappend a [grid columnconfigure .f 0 -weight]
- grid rowconfigure .f 0 -weight 0
- lappend a [grid rowconfigure .f 0 -weight]
- grid rowconfigure .f 0 -weight 1
- lappend a [grid columnconfigure .f 0 -weight]
- grid columnconfigure .f 0 -weight 0
- return $a
-} -cleanup {
- grid_reset 10.17
-} -result {0 1 0 1}
-test grid-10.18 {column/row configure} -body {
- frame .f
- 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] \
- [grid columnconfigure .f 2 -weight]
-} -cleanup {
- grid_reset 10.18
-} -result {10 0 10 1 0 1}
-test grid-10.19 {column/row configure} -body {
- grid columnconfigure . {0 -1 2} -weight 1
-} -cleanup {
- grid_reset 10.19
-} -returnCodes error -result {"-1" is out of range}
-test grid-10.20 {column/row configure} -body {
- grid columnconfigure . 0 -uniform foo
- grid columnconfigure . 0 -uniform
-} -cleanup {
- grid_reset 10.20
-} -result {foo}
-test grid-10.21 {column/row configure} -body {
- grid columnconfigure . .b -weight 1
-} -cleanup {
- grid_reset 10.21
-} -returnCodes error -result {illegal index ".b"}
-test grid-10.22 {column/row configure} -body {
+
+test grid-10.1 {column/row configure} {
+ list [catch {grid columnconfigure .} msg] $msg
+} {1 {wrong # args: should be "grid columnconfigure master index ?-option value...?"}}
+grid_reset 10.1
+
+test grid-10.2 {column/row configure} {
+ list [catch {grid columnconfigure . 0 -weight 0 -pad} msg] $msg
+} {1 {wrong # args: should be "grid columnconfigure master index ?-option value...?"}}
+grid_reset 10.2
+
+test grid-10.3 {column/row configure} {
+ list [catch {grid columnconfigure .f 0 -weight} msg] $msg
+} {1 {bad window path name ".f"}}
+grid_reset 10.3
+
+test grid-10.4 {column/row configure} {
+ list [catch {grid columnconfigure . nine -weight} msg] $msg
+} {1 {expected integer but got "nine" (when retreiving options only integer indices are allowed)}}
+grid_reset 10.4
+
+test grid-10.5 {column/row configure} {
+ list [catch {grid columnconfigure . 265 -weight} msg] $msg
+} {0 0}
+grid_reset 10.5
+
+test grid-10.6 {column/row configure} {
+ list [catch {grid columnconfigure . 0} msg] $msg
+} {0 {-minsize 0 -pad 0 -uniform {} -weight 0}}
+grid_reset 10.6
+
+test grid-10.7 {column/row configure} {
+ list [catch {grid columnconfigure . 0 -foo} msg] $msg
+} {1 {bad option "-foo": must be -minsize, -pad, -uniform, or -weight}}
+grid_reset 10.7
+
+test grid-10.8 {column/row configure} {
+ list [catch {grid columnconfigure . 0 -minsize foo} msg] $msg
+} {1 {bad screen distance "foo"}}
+grid_reset 10.8
+
+test grid-10.9 {column/row configure} {
+ list [catch {grid columnconfigure . 0 -minsize foo} msg] $msg
+} {1 {bad screen distance "foo"}}
+grid_reset 10.9
+
+test grid-10.10 {column/row configure} {
+ grid columnconfigure . 0 -minsize 10
+ grid columnconfigure . 0 -minsize
+} {10}
+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.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.12
+
+test grid-10.13 {column/row configure} {
+ grid columnconfigure . 0 -weight 3
+ grid columnconfigure . 0 -weight
+} {3}
+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.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.15
+
+test grid-10.16 {column/row configure} {
+ grid columnconfigure . 0 -pad 3
+ grid columnconfigure . 0 -pad
+} {3}
+grid_reset 10.16
+
+test grid-10.17 {column/row configure} {
+ frame .f
+ set a ""
+ grid columnconfigure .f 0 -weight 0
+ lappend a [grid columnconfigure .f 0 -weight]
+ grid columnconfigure .f 0 -weight 1
+ lappend a [grid columnconfigure .f 0 -weight]
+ grid rowconfigure .f 0 -weight 0
+ lappend a [grid rowconfigure .f 0 -weight]
+ grid rowconfigure .f 0 -weight 1
+ lappend a [grid columnconfigure .f 0 -weight]
+ grid columnconfigure .f 0 -weight 0
+ set a
+} {0 1 0 1}
+grid_reset 10.17
+
+test grid-10.18 {column/row configure} {
+ frame .f
+ 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] \
+ [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
+
+test grid-10.20 {column/row configure} {
+ grid columnconfigure . 0 -uniform foo
+ grid columnconfigure . 0 -uniform
+} {foo}
+grid_reset 10.20
+
+test grid-10.21 {column/row configure} {
+ list [catch {grid columnconfigure . .b -weight 1} msg] $msg
+} {1 {grid columnconfigure: illegal index ".b"}}
+grid_reset 10.21
+
+test grid-10.22 {column/row configure} {
button .b
- grid columnconfigure . .b -weight 1
-} -cleanup {
- grid_reset 10.22
-} -returnCodes error -result {the window ".b" is not managed by "."}
-test grid-10.23 {column/row configure} -body {
+ list [catch {grid columnconfigure . .b -weight 1} msg] $msg
+} {1 {grid columnconfigure: the window ".b" is not managed by "."}}
+grid_reset 10.22
+
+test grid-10.23 {column/row configure} {
button .b
grid .b -column 1 -columnspan 2
grid columnconfigure . .b -weight 1
@@ -688,11 +705,11 @@ test grid-10.23 {column/row configure} -body {
foreach i {0 1 2 3} {
lappend res [grid columnconfigure . $i -weight]
}
- return $res
-} -cleanup {
- grid_reset 10.23
-} -result {0 1 1 0}
-test grid-10.24 {column/row configure} -body {
+ set res
+} {0 1 1 0}
+grid_reset 10.23
+
+test grid-10.24 {column/row configure} {
button .b
button .c
button .d
@@ -705,11 +722,11 @@ test grid-10.24 {column/row configure} -body {
foreach i {0 1 2 3 4 5 6} {
lappend res [grid columnconfigure . $i -weight]
}
- return $res
-} -cleanup {
- grid_reset 10.24
-} -result {0 1 2 2 2 1 0}
-test grid-10.25 {column/row configure} -body {
+ set res
+} {0 1 2 2 2 1 0}
+grid_reset 10.24
+
+test grid-10.25 {column/row configure} {
button .b
button .c
button .d
@@ -722,42 +739,47 @@ test grid-10.25 {column/row configure} -body {
foreach i {0 1 2 3 4 5 6 7} {
lappend res [grid rowconfigure . $i -weight]
}
- return $res
-} -cleanup {
- grid_reset 10.25
-} -result {0 2 1 1 2 2 0 1}
-test grid-10.26 {column/row configure} -body {
+ set res
+} {0 2 1 1 2 2 0 1}
+grid_reset 10.25
+
+test grid-10.26 {column/row configure} {
button .b
grid columnconfigure .b 0
-} -cleanup {
- grid_reset 10.26
-} -result {-minsize 0 -pad 0 -uniform {} -weight 0}
-test grid-10.27 {column/row configure - no indices} -body {
+} {-minsize 0 -pad 0 -uniform {} -weight 0}
+grid_reset 10.26
+
+test grid-10.30 {column/row configure - no indices} {
# Bug 1422430
set t [toplevel .test]
- grid columnconfigure $t "" -weight 1
-} -cleanup {
+ set res [list [catch {grid columnconfigure $t "" -weight 1} msg] $msg]
destroy $t
-} -returnCodes error -result {no column indices specified}
-test grid-10.28 {column/row configure - no indices} -body {
+ set res
+} {1 {no column indices specified}}
+
+test grid-10.31 {column/row configure - no indices} {
set t [toplevel .test]
- grid rowconfigure $t "" -weight 1
-} -cleanup {
+ set res [list [catch {grid rowconfigure $t "" -weight 1} msg] $msg]
destroy $t
-} -returnCodes error -result {no row indices specified}
-test grid-10.29 {column/row configure - invalid indices} -body {
- grid columnconfigure . {0 1 2} -weight
-} -returnCodes error -result {must specify a single element on retrieval}
-test grid-10.30 {column/row configure - invalid indices} -body {
- grid rowconfigure . {0 1 2} -weight
-} -returnCodes error -result {must specify a single element on retrieval}
-test grid-10.31 {column/row configure - empty 'all' configure} -body {
+ set res
+} {1 {no row indices specified}}
+
+test grid-10.32 {column/row configure - invalid indices} {
+ list [catch {grid columnconfigure . {0 1 2} -weight} msg] $msg
+} {1 {grid columnconfigure: must specify a single element on retrieval}}
+
+test grid-10.33 {column/row configure - invalid indices} {
+ list [catch {grid rowconfigure . {0 1 2} -weight} msg] $msg
+} {1 {grid rowconfigure: must specify a single element on retrieval}}
+
+test grid-10.34 {column/row configure - empty 'all' configure} {
# Bug 1422430
set t [toplevel .test]
grid rowconfigure $t all -weight 1
destroy $t
-} -result {}
-test grid-10.32 {column/row configure} -body {
+} {}
+
+test grid-10.35 {column/row configure} {
# Test that no lingering message is there
frame .f
set res [grid columnconfigure .f all -weight 1]
@@ -768,21 +790,21 @@ test grid-10.32 {column/row configure} -body {
append res [grid columnconfigure .f {.f.f 1} -weight 1]
append res [grid columnconfigure .f {2 .f.f} -weight 1]
destroy .f
- return $res
-} -cleanup {
- grid_reset 10.35
-} -result {}
-test grid-10.33 {column/row configure} -body {
- grid columnconfigure . all
-} -cleanup {
- grid_reset 10.36
-} -returnCodes error -result {expected integer but got "all" (when retrieving options only integer indices are allowed)}
-test grid-10.34 {column/row configure} -body {
- grid columnconfigure . 100000
-} -cleanup {
- grid_reset 10.37
-} -result {-minsize 0 -pad 0 -uniform {} -weight 0}
-test grid-10.35 {column/row configure} -body {
+ set res
+} {}
+grid_reset 10.35
+
+test grid-10.36 {column/row configure} {
+ list [catch {grid columnconfigure . all} msg] $msg
+} {1 {expected integer but got "all" (when retreiving options only integer indices are allowed)}}
+grid_reset 10.36
+
+test grid-10.37 {column/row configure} {
+ list [catch {grid columnconfigure . 100000} msg] $msg
+} {0 {-minsize 0 -pad 0 -uniform {} -weight 0}}
+grid_reset 10.37
+
+test grid-10.38 {column/row configure} -body {
# This is a test for bug 1423666 where a column >= 10000 caused
# a crash in layout. The update is needed to reach the layout stage.
# Test different combinations of row/column overflow
@@ -794,17 +816,18 @@ test grid-10.35 {column/row configure} -body {
lappend res [catch {grid .f -rowspan 2 -row 9998} msg] $msg ; update
lappend res [catch {grid .f -column 9998 -columnspan 2} msg] $msg ; update
lappend res [catch {grid .f -row 9998 -rowspan 2} msg] $msg ; update
- return $res
+ set res
} -cleanup {destroy .f} -result [lrange {
- 1 {column out of bounds}
- 1 {row out of bounds}
- 1 {column out of bounds}
- 1 {row out of bounds}
- 1 {column out of bounds}
- 1 {row out of bounds}
+ 1 {Column out of bounds}
+ 1 {Row out of bounds}
+ 1 {Column out of bounds}
+ 1 {Row out of bounds}
+ 1 {Column out of bounds}
+ 1 {Row out of bounds}
} 0 end]
grid_reset 10.38
-test grid-10.36 {column/row configure} -body {
+
+test grid-10.39 {column/row configure} -body {
# Additional tests for row/column overflow
frame .f
frame .g
@@ -817,46 +840,47 @@ test grid-10.36 {column/row configure} -body {
grid forget .f .g
lappend res [catch {eval grid [string repeat " x " 9999] .f} msg] $msg
update
- return $res
+ set res
} -cleanup {destroy .f .g} -result [lrange {
- 1 {row out of bounds}
- 1 {row out of bounds}
- 1 {column out of bounds}
- 1 {column out of bounds}
+ 1 {Row out of bounds}
+ 1 {Row out of bounds}
+ 1 {Column out of bounds}
+ 1 {Column out of bounds}
} 0 end]
grid_reset 10.39
# auto-placement tests
-test grid-11.1 {default widget placement} -body {
- grid ^
-} -cleanup {
- grid_reset 11.1
-} -returnCodes error -result {can't use '^', cant find master}
-test grid-11.2 {default widget placement} -body {
- button .b
- grid .b ^
-} -cleanup {
- grid_reset 11.2
-} -returnCodes error -result {can't find slave to extend with "^"}
-test grid-11.3 {default widget placement} -body {
- button .b
- grid .b - - .c
-} -cleanup {
- grid_reset 11.3
-} -returnCodes error -result {bad window path name ".c"}
-test grid-11.4 {default widget placement} -body {
- button .b
- grid .b - - = -
-} -cleanup {
- grid_reset 11.4
-} -returnCodes error -result {invalid window shortcut, "=" should be '-', 'x', or '^'}
-test grid-11.5 {default widget placement} -body {
- button .b
- grid .b - x -
-} -cleanup {
- grid_reset 11.5
-} -returnCodes error -result {must specify window before shortcut '-'}
-test grid-11.6 {default widget placement} -body {
+
+test grid-11.1 {default widget placement} {
+ list [catch {grid ^} msg] $msg
+} {1 {can't use '^', cant find master}}
+grid_reset 11.1
+
+test grid-11.2 {default widget placement} {
+ button .b
+ list [catch {grid .b ^} msg] $msg
+} {1 {can't find slave to extend with "^".}}
+grid_reset 11.2
+
+test grid-11.3 {default widget placement} {
+ button .b
+ list [catch {grid .b - - .c} msg] $msg
+} {1 {bad window path name ".c"}}
+grid_reset 11.3
+
+test grid-11.4 {default widget placement} {
+ button .b
+ list [catch {grid .b - - = -} msg] $msg
+} {1 {invalid window shortcut, "=" should be '-', 'x', or '^'}}
+grid_reset 11.4
+
+test grid-11.5 {default widget placement} {
+ button .b
+ list [catch {grid .b - x -} msg] $msg
+} {1 {Must specify window before shortcut '-'.}}
+grid_reset 11.5
+
+test grid-11.6 {default widget placement} {
foreach i {1 2 3 4 5 6} {
frame .f$i -width 50 -height 50 -highlightthickness 0 -bg red
}
@@ -868,34 +892,34 @@ test grid-11.6 {default widget placement} -body {
lappend a "[winfo x .f$i],[winfo y .f$i] \
[winfo width .f$i],[winfo height .f$i]"
}
- return $a
-} -cleanup {
- grid_reset 11.6
-} -result {{0,50 100,50} {150,50 50,50}}
-test grid-11.7 {default widget placement} -body {
+ set a
+} {{0,50 100,50} {150,50 50,50}}
+grid_reset 11.6
+
+test grid-11.7 {default widget placement} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
grid .f -row 5 -column 5
- grid .f x -
-} -cleanup {
- grid_reset 11.7
-} -returnCodes error -result {must specify window before shortcut '-'}
-test grid-11.8 {default widget placement} -body {
+ list [catch "grid .f x -" msg] $msg
+} {1 {Must specify window before shortcut '-'.}}
+grid_reset 11.7
+
+test grid-11.8 {default widget placement} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
grid .f -row 5 -column 5
- grid .f ^ -
-} -cleanup {
- grid_reset 11.8
-} -returnCodes error -result {must specify window before shortcut '-'}
-test grid-11.9 {default widget placement} -body {
+ list [catch "grid .f ^ -" msg] $msg
+} {1 {Must specify window before shortcut '-'.}}
+grid_reset 11.8
+
+test grid-11.9 {default widget placement} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
grid .f -row 5 -column 5
- grid .f x ^
-} -cleanup {
- grid_reset 11.9
-} -returnCodes error -result {can't find slave to extend with "^"}
-test grid-11.10 {default widget placement} -body {
+ list [catch "grid .f x ^" msg] $msg
+} {1 {can't find slave to extend with "^".}}
+grid_reset 11.9
+
+test grid-11.10 {default widget placement} {
foreach i {1 2 3} {
- frame .f$i -width 100 -height 50 -highlightthickness 0 -bg red
+ frame .f$i -width 100 -height 50 -highlightthickness 0 -bg red
}
grid .f1 .f2 -sticky nsew
grid .f3 ^ -sticky nsew
@@ -905,54 +929,54 @@ test grid-11.10 {default widget placement} -body {
lappend a "[winfo x .f$i],[winfo y .f$i] \
[winfo width .f$i],[winfo height .f$i]"
}
- return $a
-} -cleanup {
- grid_reset 11.10
-} -result {{0,0 100,50} {100,0 100,100} {0,50 100,50}}
-test grid-11.11 {default widget placement} -body {
+ set a
+} {{0,0 100,50} {100,0 100,100} {0,50 100,50}}
+grid_reset 11.10
+
+test grid-11.11 {default widget placement} {
foreach i {1 2 3 4 5 6 7 8 9 10 11 12} {
- frame .f$i -width 50 -height 50 -highlightthickness 1 -highlightbackground black
+ frame .f$i -width 50 -height 50 -highlightthickness 1 -highlightbackground black
}
- grid .f1 .f2 .f3 .f4 -sticky nsew
+ grid .f1 .f2 .f3 .f4 -sticky nsew
grid .f5 .f6 - .f7 -sticky nsew
grid .f8 ^ ^ .f9 -sticky nsew
- grid .f10 ^ ^ .f11 -sticky nsew
- grid .f12 - - - -sticky nsew
+ grid .f10 ^ ^ .f11 -sticky nsew
+ grid .f12 - - - -sticky nsew
update
set a ""
foreach i {5 6 7 8 9 10 11 12 } {
lappend a "[winfo x .f$i],[winfo y .f$i] \
[winfo width .f$i],[winfo height .f$i]"
}
- return $a
-} -cleanup {
- grid_reset 11.11
-} -result {{0,50 50,50} {50,50 100,150} {150,50 50,50} {0,100 50,50} {150,100 50,50} {0,150 50,50} {150,150 50,50} {0,200 200,50}}
-test grid-11.12 {default widget placement} -body {
+ set a
+} {{0,50 50,50} {50,50 100,150} {150,50 50,50} {0,100 50,50} {150,100 50,50} {0,150 50,50} {150,150 50,50} {0,200 200,50}}
+grid_reset 11.11
+
+test grid-11.12 {default widget placement} {
foreach i {1 2 3 4} {
- frame .f$i -width 75 -height 50 -highlightthickness 1 -highlightbackground black
+ frame .f$i -width 75 -height 50 -highlightthickness 1 -highlightbackground black
}
grid .f1 .f2 .f3 -sticky nsew
grid .f4 ^ -sticky nsew
update
set a ""
foreach i {1 2 3 4} {
- lappend a "[winfo x .f$i],[winfo y .f$i] \
- [winfo width .f$i],[winfo height .f$i]"
+ lappend a "[winfo x .f$i],[winfo y .f$i] \
+ [winfo width .f$i],[winfo height .f$i]"
}
grid .f4 ^ -column 1
update
foreach i {1 2 3 4} {
- lappend a "[winfo x .f$i],[winfo y .f$i] \
- [winfo width .f$i],[winfo height .f$i]"
- }
- return $a
-} -cleanup {
- grid_reset 11.12
-} -result {{0,0 75,50} {75,0 75,100} {150,0 75,50} {0,50 75,50} {0,0 75,50} {75,0 75,100} {150,0 75,100} {75,50 75,50}}
-test grid-11.13 {default widget placement} -body {
+ lappend a "[winfo x .f$i],[winfo y .f$i] \
+ [winfo width .f$i],[winfo height .f$i]"
+ }
+ set a
+} {{0,0 75,50} {75,0 75,100} {150,0 75,50} {0,50 75,50} {0,0 75,50} {75,0 75,100} {150,0 75,100} {75,50 75,50}}
+grid_reset 11.12
+
+test grid-11.13 {default widget placement} {
foreach i {1 2 3 4 5 6 7} {
- frame .f$i -width 40 -height 50 -highlightthickness 1 -highlightbackground black
+ frame .f$i -width 40 -height 50 -highlightthickness 1 -highlightbackground black
}
grid .f1 .f2 .f3 .f4 .f5 -sticky nsew
grid .f6 - .f7 -sticky nsew -columnspan 2
@@ -962,11 +986,11 @@ test grid-11.13 {default widget placement} -body {
lappend a "[winfo x .f$i],[winfo y .f$i] \
[winfo width .f$i],[winfo height .f$i]"
}
- return $a
-} -cleanup {
- grid_reset 11.13
-} -result {{0,50 120,50} {120,50 80,50}}
-test grid-11.14 {default widget placement} -body {
+ set a
+} {{0,50 120,50} {120,50 80,50}}
+grid_reset 11.13
+
+test grid-11.14 {default widget placement} {
foreach i {1 2 3} {
frame .f$i -width 60 -height 60 -highlightthickness 0 -bg red
}
@@ -978,11 +1002,11 @@ test grid-11.14 {default widget placement} -body {
lappend a "[winfo x .f$i],[winfo y .f$i] \
[winfo width .f$i],[winfo height .f$i]"
}
- return $a
-} -cleanup {
- grid_reset 11.14
-} -result {{0,30 60,60} {60,0 60,60} {60,60 60,60}}
-test grid-11.15 {^ ^ test with multiple windows} -body {
+ set a
+} {{0,30 60,60} {60,0 60,60} {60,60 60,60}}
+grid_reset 11.14
+
+test grid-11.15 {^ ^ test with multiple windows} {
foreach i {1 2 3 4} {
frame .f$i -width 50 -height 50 -bd 1 -relief solid
}
@@ -994,25 +1018,25 @@ test grid-11.15 {^ ^ test with multiple windows} -body {
lappend a "[winfo x .f$i],[winfo y .f$i]\
[winfo width .f$i],[winfo height .f$i]"
}
- return $a
-} -cleanup {
- grid_reset 11.15
-} -result {{0,0 50,50} {50,0 50,100} {100,0 50,100} {0,50 50,50}}
-test grid-11.16 {default widget placement} -body {
+ set a
+} {{0,0 50,50} {50,0 50,100} {100,0 50,100} {0,50 50,50}}
+grid_reset 11.15
+
+test grid-11.16 {default widget placement} {
foreach l {a b c d e} {
frame .$l -width 50 -height 50
}
- grid .a .b .c .d -sticky news
+ grid .a .b .c .d -sticky news
grid x ^ x .e -sticky news
update
set res ""
lappend res [winfo height .a]
lappend res [winfo height .b]
lappend res [winfo height .c]
-} -cleanup {
- grid_reset 11.16
-} -result {50 100 50}
-test grid-11.17 {default widget placement} -body {
+} {50 100 50}
+grid_reset 11.16
+
+test grid-11.17 {default widget placement} {
foreach l {a b c d e} {
frame .$l -width 50 -height 50
}
@@ -1023,10 +1047,10 @@ test grid-11.17 {default widget placement} -body {
lappend res [winfo height .a]
lappend res [winfo height .b]
lappend res [winfo height .c]
-} -cleanup {
- grid_reset 11.17
-} -result {100 50 100}
-test grid-11.18 {default widget placement} -body {
+} {100 50 100}
+grid_reset 11.17
+
+test grid-11.18 {default widget placement} {
foreach l {a b c d e} {
frame .$l -width 50 -height 50
}
@@ -1039,10 +1063,10 @@ test grid-11.18 {default widget placement} -body {
lappend res [winfo height .b]
lappend res [winfo height .c]
lappend res [winfo height .d]
-} -cleanup {
- grid_reset 11.18
-} -result {100 100 100 50}
-test grid-11.19 {default widget placement} -body {
+} {100 100 100 50}
+grid_reset 11.18
+
+test grid-11.19 {default widget placement} {
foreach l {a b c d e} {
frame .$l -width 50 -height 50
}
@@ -1050,6 +1074,7 @@ test grid-11.19 {default widget placement} -body {
grid .c .d -sticky news
grid ^ -in . -row 2
grid x ^ -in . -row 1
+
grid rowconfigure . {0 1 2} -uniform a
update
set res ""
@@ -1057,11 +1082,10 @@ test grid-11.19 {default widget placement} -body {
lappend res [winfo height .b]
lappend res [winfo height .c]
lappend res [winfo height .d]
-} -cleanup {
- grid_reset 11.19
-} -result {50 100 100 50}
+} {50 100 100 50}
+grid_reset 11.19
-test grid-12.1 {-sticky} -body {
+test grid-12.1 {-sticky} {
catch {unset data}
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
set a ""
@@ -1076,10 +1100,8 @@ test grid-12.1 {-sticky} -body {
array set data [grid info .f]
append a "($data(-sticky)) [winfo x .f] [winfo y .f] [winfo width .f] [winfo height .f]\n"
}
- return $a
-} -cleanup {
- grid_reset 12.1
-} -result {() 25 25 200 100
+ set a
+} {() 25 25 200 100
(n) 25 0 200 100
(s) 25 50 200 100
(e) 50 25 200 100
@@ -1096,62 +1118,63 @@ test grid-12.1 {-sticky} -body {
(new) 0 0 250 100
(nesw) 0 0 250 150
}
-test grid-12.2 {-sticky} -body {
+grid_reset 12.1
+
+test grid-12.2 {-sticky} {
frame .f -bg red
- grid .f -sticky glue
-} -cleanup {
- grid_reset 12.2
-} -returnCodes error -result {bad stickyness value "glue": must be a string containing n, e, s, and/or w}
-test grid-12.3 {-sticky} -body {
+ list [catch "grid .f -sticky glue" msg] $msg
+} {1 {bad stickyness value "glue": must be a string containing n, e, s, and/or w}}
+grid_reset 12.2
+
+test grid-12.3 {-sticky} {
frame .f -bg red
grid .f -sticky {n,s,e,w}
array set A [grid info .f]
set A(-sticky)
-} -cleanup {
- grid_reset 12.3
-} -result {nesw}
+} {nesw}
+grid_reset 12.3
-test grid-13.1 {-in} -body {
+test grid-13.1 {-in} {
frame .f -bg red
- grid .f -in .f
-} -cleanup {
- grid_reset 13.1
-} -returnCodes error -result {window can't be managed in itself}
-test grid-13.2 {-in} -body {
+ list [catch "grid .f -in .f" msg] $msg
+} {1 {Window can't be managed in itself}}
+grid_reset 13.1
+
+test grid-13.1.1 {-in} {
frame .f -bg red
list [winfo manager .f] \
[catch {grid .f -in .f} err] $err \
[winfo manager .f]
-} -cleanup {
- grid_reset 13.1.1
-} -result {{} 1 {window can't be managed in itself} {}}
-test grid-13.3 {-in} -body {
+} {{} 1 {Window can't be managed in itself} {}}
+grid_reset 13.1.1
+
+test grid-13.2 {-in} {
frame .f -bg red
- grid .f -in .bad
-} -cleanup {
- grid_reset 13.2
-} -returnCodes error -result {bad window path name ".bad"}
-test grid-13.4 {-in} -body {
+ list [catch "grid .f -in .bad" msg] $msg
+} {1 {bad window path name ".bad"}}
+grid_reset 13.2
+
+test grid-13.3 {-in} {
frame .f -bg red
toplevel .top
- grid .f -in .top
-} -cleanup {
- grid_reset 13.3
-} -returnCodes error -result {can't put .f inside .top}
+ list [catch "grid .f -in .top" msg] $msg
+} {1 {can't put .f inside .top}}
destroy .top
-test grid-13.5 {-ipadx} -body {
+grid_reset 13.3
+
+test grid-13.4 {-ipadx} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -ipadx x
-} -cleanup {
- grid_reset 13.4
-} -returnCodes error -result {bad ipadx value "x": must be positive screen distance}
-test grid-13.6 {-ipadx} -body {
+ list [catch "grid .f -ipadx x" msg] $msg
+} {1 {bad ipadx value "x": must be positive screen distance}}
+grid_reset 13.4
+
+test grid-13.4.1 {-ipadx} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -ipadx {5 5}
-} -cleanup {
- grid_reset 13.4.1
-} -returnCodes error -result {bad ipadx value "5 5": must be positive screen distance}
-test grid-13.7 {-ipadx} -body {
+ list [catch "grid .f -ipadx {5 5}" msg] $msg
+} {1 {bad ipadx value "5 5": must be positive screen distance}}
+grid_reset 13.4.1
+
+test grid-13.5 {-ipadx} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -1159,22 +1182,22 @@ test grid-13.7 {-ipadx} -body {
grid .f -ipadx 1
update
list $a [winfo width .f]
-} -cleanup {
- grid_reset 13.5
-} -result {200 202}
-test grid-13.8 {-ipady} -body {
+} {200 202}
+grid_reset 13.5
+
+test grid-13.6 {-ipady} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -ipady x
-} -cleanup {
- grid_reset 13.6
-} -returnCodes error -result {bad ipady value "x": must be positive screen distance}
-test grid-13.9 {-ipady} -body {
+ list [catch "grid .f -ipady x" msg] $msg
+} {1 {bad ipady value "x": must be positive screen distance}}
+grid_reset 13.6
+
+test grid-13.6.1 {-ipady} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -ipady {5 5}
-} -cleanup {
- grid_reset 13.6.1
-} -returnCodes error -result {bad ipady value "5 5": must be positive screen distance}
-test grid-13.10 {-ipady} -body {
+ list [catch "grid .f -ipady {5 5}" msg] $msg
+} {1 {bad ipady value "5 5": must be positive screen distance}}
+grid_reset 13.6.1
+
+test grid-13.7 {-ipady} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -1182,22 +1205,22 @@ test grid-13.10 {-ipady} -body {
grid .f -ipady 1
update
list $a [winfo height .f]
-} -cleanup {
- grid_reset 13.7
-} -result {100 102}
-test grid-13.11 {-padx} -body {
+} {100 102}
+grid_reset 13.7
+
+test grid-13.8 {-padx} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -padx x
-} -cleanup {
- grid_reset 13.8
-} -returnCodes error -result {bad pad value "x": must be positive screen distance}
-test grid-13.12 {-padx} -body {
+ list [catch "grid .f -padx x" msg] $msg
+} {1 {bad pad value "x": must be positive screen distance}}
+grid_reset 13.8
+
+test grid-13.8.1 {-padx} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -padx {10 x}
-} -cleanup {
- grid_reset 13.8.1
-} -returnCodes error -result {bad 2nd pad value "x": must be positive screen distance}
-test grid-13.13 {-padx} -body {
+ list [catch "grid .f -padx {10 x}" msg] $msg
+} {1 {bad 2nd pad value "x": must be positive screen distance}}
+grid_reset 13.8.1
+
+test grid-13.9 {-padx} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -1205,10 +1228,10 @@ test grid-13.13 {-padx} -body {
grid .f -padx 1
update
list $a "[winfo width .f] [winfo width .] [winfo x .f]"
-} -cleanup {
- grid_reset 13.9
-} -result {{200 200} {200 202 1}}
-test grid-13.14 {-padx} -body {
+} {{200 200} {200 202 1}}
+grid_reset 13.9
+
+test grid-13.9.1 {-padx} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -1216,22 +1239,22 @@ test grid-13.14 {-padx} -body {
grid .f -padx {10 5}
update
list $a "[winfo width .f] [winfo width .] [winfo x .f]"
-} -cleanup {
- grid_reset 13.9.1
-} -result {{200 200} {200 215 10}}
-test grid-13.15 {-pady} -body {
+} {{200 200} {200 215 10}}
+grid_reset 13.9.1
+
+test grid-13.10 {-pady} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -pady x
-} -cleanup {
- grid_reset 13.10
-} -returnCodes error -result {bad pad value "x": must be positive screen distance}
-test grid-13.16 {-pady} -body {
+ list [catch "grid .f -pady x" msg] $msg
+} {1 {bad pad value "x": must be positive screen distance}}
+grid_reset 13.10
+
+test grid-13.10.1 {-pady} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
- grid .f -pady {10 x}
-} -cleanup {
- grid_reset 13.10.1
-} -returnCodes error -result {bad 2nd pad value "x": must be positive screen distance}
-test grid-13.17 {-pady} -body {
+ list [catch "grid .f -pady {10 x}" msg] $msg
+} {1 {bad 2nd pad value "x": must be positive screen distance}}
+grid_reset 13.10.1
+
+test grid-13.11 {-pady} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -1239,10 +1262,10 @@ test grid-13.17 {-pady} -body {
grid .f -pady 1
update
list $a "[winfo height .f] [winfo height .] [winfo y .f]"
-} -cleanup {
- grid_reset 13.11
-} -result {{100 100} {100 102 1}}
-test grid-13.18 {-pady} -body {
+} {{100 100} {100 102 1}}
+grid_reset 13.11
+
+test grid-13.11.1 {-pady} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
update
@@ -1250,29 +1273,29 @@ test grid-13.18 {-pady} -body {
grid .f -pady {4 16}
update
list $a "[winfo height .f] [winfo height .] [winfo y .f]"
-} -cleanup {
- grid_reset 13.11.1
-} -result {{100 100} {100 120 4}}
-test grid-13.19 {-ipad x and y} -body {
+} {{100 100} {100 120 4}}
+grid_reset 13.11.1
+
+test grid-13.12 {-ipad x and y} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
grid columnconfigure . 0 -minsize 150
grid rowconfigure . 0 -minsize 100
set a ""
foreach x {0 5} {
- foreach y {0 5} {
+ foreach y {0 5} {
grid .f -ipadx $x -ipady $y
update
append a " $x,$y:"
foreach prop {x y width height} {
- append a ,[winfo $prop .f]
+ append a ,[winfo $prop .f]
}
}
}
- return $a
-} -cleanup {
- grid_reset 13.12
-} -result { 0,0:,65,40,20,20 0,5:,65,35,20,30 5,0:,60,40,30,20 5,5:,60,35,30,30}
-test grid-13.20 {reparenting} -body {
+ set a
+} { 0,0:,65,40,20,20 0,5:,65,35,20,30 5,0:,60,40,30,20 5,5:,60,35,30,30}
+grid_reset 13.12
+
+test grid-13.13 {reparenting} {
frame .1
frame .2
button .b
@@ -1285,16 +1308,15 @@ test grid-13.20 {reparenting} -body {
catch {unset info}; array set info [grid info .b]
lappend a [grid slaves .1],[grid slaves .2],$info(-in)
unset info
- return $a
-} -cleanup {
- grid_reset 13.13
-} -result {.b,,.1 ,.b,.2}
+ set a
+} {.b,,.1 ,.b,.2}
+grid_reset 13.13
-test grid-14.1 {structure notify} -body {
+test grid-14.1 {structure notify} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
frame .g -width 200 -height 100 -highlightthickness 0 -bg red
- grid .f
- grid .g -in .f
+ grid .f
+ grid .g -in .f
update
set a ""
lappend a "[winfo x .g],[winfo y .g] \
@@ -1303,14 +1325,14 @@ test grid-14.1 {structure notify} -body {
update
lappend a "[winfo x .g],[winfo y .g] \
[winfo width .g],[winfo height .g]"
- return $a
-} -cleanup {
- grid_reset 14.1
-} -result {{0,0 200,100} {5,5 200,100}}
-test grid-14.2 {structure notify} -body {
- frame .f -width 200 -height 100
- frame .f.g -width 200 -height 100
- grid .f
+ set a
+} {{0,0 200,100} {5,5 200,100}}
+grid_reset 14.1
+
+test grid-14.2 {structure notify} {
+ frame .f -width 200 -height 100
+ frame .f.g -width 200 -height 100
+ grid .f
grid .f.g
update
set a ""
@@ -1318,10 +1340,10 @@ test grid-14.2 {structure notify} -body {
.f config -bd 20
update
lappend a [grid bbox .],[grid bbox .f]
-} -cleanup {
- grid_reset 14.2
-} -result {{0 0 200 100,0 0 200 100} {0 0 240 140,20 20 200 100}}
-test grid-14.3 {map notify: bug 1648} -constraints {nonPortable} -body {
+} {{0 0 200 100,0 0 200 100} {0 0 240 140,20 20 200 100}}
+grid_reset 14.2
+
+test grid-14.3 {map notify: bug 1648} {nonPortable} {
# This test is nonPortable because the number of times
# A(.) will be incremented is unspecified--the behavior
# is different accross window managers.
@@ -1340,11 +1362,10 @@ test grid-14.3 {map notify: bug 1648} -constraints {nonPortable} -body {
update
bind . <Configure> {}
array get A
-} -cleanup {
- grid_reset 14.3
-} -result {.2 2 .0 1 . 2 .1 1}
+} {.2 2 .0 1 . 2 .1 1}
+grid_reset 14.3
-test grid-15.1 {lost slave} -body {
+test grid-15.1 {lost slave} {
button .b
grid .b
set a [grid slaves .]
@@ -1352,42 +1373,41 @@ test grid-15.1 {lost slave} -body {
lappend a [grid slaves .]
grid .b
lappend a [grid slaves .]
-} -cleanup {
- grid_reset 15.1
-} -result {.b {} .b}
-test grid-15.2 {lost slave} -body {
+} {.b {} .b}
+grid_reset 15.1
+
+test grid-15.2 {lost slave} {
frame .f
grid .f
button .b
grid .b -in .f
set a [grid slaves .f]
- pack .b -in .f
+ pack .b
lappend a [grid slaves .f]
grid .b -in .f
lappend a [grid slaves .f]
-} -cleanup {
- grid_reset 15.2
-} -result {.b {} .b}
+} {.b {} .b}
+grid_reset 15.2
-test grid-16.1 {layout centering} -body {
+test grid-16.1 {layout centering} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
+ frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
}
grid propagate . 0
grid anchor . center
. configure -width 300 -height 250
update
grid bbox .
-} -cleanup {
- grid_reset 16.1
-} -result {37 50 225 150}
-test grid-16.2 {layout weights (expanding)} -body {
+} {37 50 225 150}
+grid_reset 16.1
+
+test grid-16.2 {layout weights (expanding)} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
- grid rowconfigure . $i -weight [expr $i + 1]
- grid columnconfigure . $i -weight [expr $i + 1]
+ frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
+ grid rowconfigure . $i -weight [expr $i + 1]
+ grid columnconfigure . $i -weight [expr $i + 1]
}
grid propagate . 0
. configure -width 500 -height 300
@@ -1396,16 +1416,16 @@ test grid-16.2 {layout weights (expanding)} -body {
foreach i {0 1 2} {
lappend a [winfo width .$i]-[winfo height .$i]
}
- return $a
-} -cleanup {
- grid_reset 16.2
-} -result {120-75 167-100 213-125}
-test grid-16.3 {layout weights (shrinking)} -body {
+ set a
+} {120-75 167-100 213-125}
+grid_reset 16.2
+
+test grid-16.3 {layout weights (shrinking)} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
- grid rowconfigure . $i -weight [expr $i + 1]
- grid columnconfigure . $i -weight [expr $i + 1]
+ frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
+ grid rowconfigure . $i -weight [expr $i + 1]
+ grid columnconfigure . $i -weight [expr $i + 1]
}
grid propagate . 0
. configure -width 200 -height 150
@@ -1414,16 +1434,16 @@ test grid-16.3 {layout weights (shrinking)} -body {
foreach i {0 1 2} {
lappend a [winfo width .$i]-[winfo height .$i]
}
- return $a
-} -cleanup {
- grid_reset 16.3
-} -result {84-63 66-50 50-37}
-test grid-16.4 {layout weights (shrinking with minsize)} -body {
+ set a
+} {84-63 66-50 50-37}
+grid_reset 16.3
+
+test grid-16.4 {layout weights (shrinking with minsize)} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
- grid rowconfigure . $i -weight [expr $i + 1] -minsize 45
- grid columnconfigure . $i -weight [expr $i + 1] -minsize 65
+ frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
+ grid rowconfigure . $i -weight [expr $i + 1] -minsize 45
+ grid columnconfigure . $i -weight [expr $i + 1] -minsize 65
}
grid propagate . 0
. configure -width 200 -height 150
@@ -1432,16 +1452,16 @@ test grid-16.4 {layout weights (shrinking with minsize)} -body {
foreach i {0 1 2} {
lappend a [winfo width .$i]-[winfo height .$i]
}
- return $a
-} -cleanup {
- grid_reset 16.4
-} -result {70-60 65-45 65-45}
-test grid-16.5 {layout weights (shrinking at minsize)} -body {
+ set a
+} {70-60 65-45 65-45}
+grid_reset 16.4
+
+test grid-16.5 {layout weights (shrinking at minsize)} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
- grid rowconfigure . $i -weight 0 -minsize 70
- grid columnconfigure . $i -weight 0 -minsize 90
+ frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
+ grid rowconfigure . $i -weight 0 -minsize 70
+ grid columnconfigure . $i -weight 0 -minsize 90
}
grid propagate . 0
. configure -width 100 -height 75
@@ -1450,16 +1470,17 @@ test grid-16.5 {layout weights (shrinking at minsize)} -body {
foreach i {0 1 2} {
lappend a [winfo width .$i]-[winfo height .$i]
}
- return $a
-} -cleanup {
- grid_reset 16.5
-} -result {100-75 100-75 100-75}
-test grid-16.6 {layout weights (shrinking at minsize)} -body {
+ set a
+} {100-75 100-75 100-75}
+grid_reset 16.5
+
+
+test grid-16.6 {layout weights (shrinking at minsize)} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
- grid rowconfigure . $i -weight [expr $i + 1] -minsize 52
- grid columnconfigure . $i -weight [expr $i + 1] -minsize 69
+ frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
+ grid rowconfigure . $i -weight [expr $i + 1] -minsize 52
+ grid columnconfigure . $i -weight [expr $i + 1] -minsize 69
}
grid propagate . 0
. configure -width 200 -height 150
@@ -1468,38 +1489,32 @@ test grid-16.6 {layout weights (shrinking at minsize)} -body {
foreach i {0 1 2} {
lappend a [winfo width .$i]-[winfo height .$i]
}
- return $a
-} -cleanup {
- grid_reset 16.6
-} -result {69-52 69-52 69-52}
-# test fails when run alone
-# reason (I think): -minsize 0 causes both:
-# [winfo ismapped .$i] => 0 and
-# not responding for width ang height settings, so that
-# [winfo width .$i] [winfo height .$i] take different values
-# That doesn't happen if previous tests run
-test grid-16.7 {layout weights (shrinking at minsize)} -body {
+ set a
+} {69-52 69-52 69-52}
+grid_reset 16.6
+
+test grid-16.7 {layout weights (shrinking at minsize)} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
+ frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
}
grid propagate . 0
grid columnconfigure . 1 -weight 1 -minsize 0
grid rowconfigure . 1 -weight 1 -minsize 0
- . configure -width 100 -height 1
+ . configure -width 100 -height 75
set a ""
update
foreach i {0 1 2} {
lappend a [winfo width .$i]-[winfo height .$i]-[winfo ismapped .$i]
}
- return $a
-} -cleanup {
- grid_reset 16.7
-} -result {100-75-1 1-1-0 100-75-1}
-test grid-16.8 {layout internal constraints} -body {
+ set a
+} {100-75-1 1-1-0 100-75-1}
+grid_reset 16.7
+
+test grid-16.8 {layout internal constraints} {
foreach i {0 1 2 3 4} {
- frame .$i -bg gray -width 30 -height 25 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
+ frame .$i -bg gray -width 30 -height 25 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
}
frame .f -bg red -width 250 -height 200
frame .g -bg green -width 200 -height 180
@@ -1510,32 +1525,32 @@ test grid-16.8 {layout internal constraints} -body {
update
set a ""
foreach i {0 1 2 3 4} {
- append a "[winfo x .$i] "
+ append a "[winfo x .$i] "
}
append a ", "
grid remove .f
update
foreach i {0 1 2 3 4} {
- append a "[winfo x .$i] "
+ append a "[winfo x .$i] "
}
append a ", "
grid remove .g
grid .f
update
foreach i {0 1 2 3 4} {
- append a "[winfo x .$i] "
+ append a "[winfo x .$i] "
}
append a ", "
grid remove .f
update
foreach i {0 1 2 3 4} {
- append a "[winfo x .$i] "
+ append a "[winfo x .$i] "
}
- return $a
-} -cleanup {
- grid_reset 16.8
-} -result {0 30 130 230 280 , 0 30 130 230 260 , 0 30 113 196 280 , 0 30 60 90 120 }
-test grid-16.9 {layout uniform} -body {
+ set a
+} {0 30 130 230 280 , 0 30 130 230 260 , 0 30 113 196 280 , 0 30 60 90 120 }
+grid_reset 16.8
+
+test grid-16.9 {layout uniform} {
frame .f1 -width 75 -height 50
frame .f2 -width 60 -height 25
frame .f3 -width 95 -height 75
@@ -1549,15 +1564,16 @@ test grid-16.9 {layout uniform} -body {
update
list [grid bbox . 0 0] [grid bbox . 0 1] [grid bbox . 0 2] \
[grid bbox . 0 3] [grid bbox . 0 4]
-} -cleanup {
- grid_reset 16.9
-} -result {{0 0 135 75} {0 75 135 100} {0 175 135 75} {0 250 135 100} {0 350 135 40}}
-test grid-16.10 {layout uniform} -body {
+} {{0 0 135 75} {0 75 135 100} {0 175 135 75} {0 250 135 100} {0 350 135 40}}
+grid_reset 16.9
+
+test grid-16.10 {layout uniform} {
grid [frame .f1 -width 75 -height 50] -row 0 -column 0
grid [frame .f2 -width 60 -height 30] -row 1 -column 2
grid [frame .f3 -width 95 -height 90] -row 2 -column 1
grid [frame .f4 -width 60 -height 100] -row 3 -column 4
grid [frame .f5 -width 60 -height 40] -row 4 -column 3
+
grid rowconfigure . {0 1} -uniform a
grid rowconfigure . {2 4} -uniform b
grid rowconfigure . {0 2} -weight 2
@@ -1569,10 +1585,10 @@ test grid-16.10 {layout uniform} -body {
update
list [grid bbox . 0 0] [grid bbox . 2 1] [grid bbox . 1 2] \
[grid bbox . 4 3] [grid bbox . 3 4]
-} -cleanup {
- grid_reset 16.10
-} -result {{0 0 75 60} {170 60 150 30} {75 90 95 90} {390 180 140 100} {320 280 70 45}}
-test grid-16.11 {layout uniform (shrink)} -body {
+} {{0 0 75 60} {170 60 150 30} {75 90 95 90} {390 180 140 100} {320 280 70 45}}
+grid_reset 16.10
+
+test grid-16.11 {layout uniform (shrink)} {
frame .f1 -width 75 -height 50
frame .f2 -width 100 -height 95
grid .f1 .f2 -sticky news
@@ -1585,10 +1601,10 @@ test grid-16.11 {layout uniform (shrink)} -body {
. configure -width 150 -height 95
update
lappend res [grid bbox . 0 0] [grid bbox . 1 0]
-} -cleanup {
- grid_reset 16.11
-} -result {{0 0 100 95} {100 0 100 95} {0 0 50 95} {50 0 100 95}}
-test grid-16.12 {layout uniform (grow)} -body {
+} {{0 0 100 95} {100 0 100 95} {0 0 50 95} {50 0 100 95}}
+grid_reset 16.11
+
+test grid-16.12 {layout uniform (grow)} {
frame .f1 -width 40 -height 50
frame .f2 -width 50 -height 95
frame .f3 -width 60 -height 50
@@ -1603,21 +1619,24 @@ test grid-16.12 {layout uniform (grow)} -body {
set res {}
lappend res [grid bbox . 0 0] [grid bbox . 1 0]
lappend res [grid bbox . 2 0] [grid bbox . 3 0]
+
grid propagate . 0
. configure -width 350 -height 95
update
lappend res [grid bbox . 0 0] [grid bbox . 1 0]
lappend res [grid bbox . 2 0] [grid bbox . 3 0]
-} -cleanup {
- grid_reset 16.12
-} -result [list {0 0 50 95} {50 0 50 95} {100 0 100 95} {200 0 70 95} \
+} [list {0 0 50 95} {50 0 50 95} {100 0 100 95} {200 0 70 95} \
{0 0 70 95} {70 0 50 95} {120 0 140 95} {260 0 90 95}]
-test grid-16.13 {layout span} -body {
+grid_reset 16.12
+
+test grid-16.13 {layout span} {
frame .f1 -width 24 -height 20
frame .f2 -width 38 -height 20
frame .f3 -width 150 -height 20
+
grid .f1 - - .f2
grid .f3 - - -
+
set res {}
foreach w {{0 1 0 0} {0 0 1 0} {1 3 4 0} {1 2 1 2} {1 1 1 12}} {
for {set c 0} {$c < 4} {incr c} {
@@ -1630,19 +1649,21 @@ test grid-16.13 {layout span} -body {
}
lappend res $res2
}
- return $res
+ set res
# The last result below should ideally be 8 8 8 126 but the current
# implementation is not exact enough.
-} -cleanup {
- grid_reset 16.13
-} -result [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 14 42 56 38 0] \
+} [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 14 42 56 38 0] \
[list 18 38 18 76 0] [list 7 8 9 126 0]]
-test grid-16.14 {layout span} -body {
+grid_reset 16.13
+
+test grid-16.14 {layout span} {
frame .f1 -width 110 -height 20
frame .f2 -width 38 -height 20
frame .f3 -width 150 -height 20
+
grid .f1 - - .f2
grid .f3 - - -
+
set res {}
foreach w {{0 1 0 0} {0 0 1 0} {1 3 4 0} {1 2 1 3} {1 1 1 12}} {
for {set c 0} {$c < 4} {incr c} {
@@ -1655,17 +1676,19 @@ test grid-16.14 {layout span} -body {
}
lappend res $res2
}
- return $res
-} -cleanup {
- grid_reset 16.14
-} -result [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 14 42 56 38 0] \
+ set res
+} [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 14 42 56 38 0] \
[list 27 55 28 40 0] [list 36 37 37 40 0]]
-test grid-16.15 {layout span} -body {
+grid_reset 16.14
+
+test grid-16.15 {layout span} {
frame .f1 -width 24 -height 20
frame .f2 -width 38 -height 20
frame .f3 -width 150 -height 20
+
grid .f1 - - .f2
grid x .f3 - -
+
set res {}
foreach w {{0 1 0 0} {0 0 1 0} {1 0 1 0} {0 0 0 0} {1 0 0 6}} {
for {set c 0} {$c < 4} {incr c} {
@@ -1678,21 +1701,23 @@ test grid-16.15 {layout span} -body {
}
lappend res $res2
}
- return $res
-} -cleanup {
- grid_reset 16.15
-} -result [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 0 0 112 38 0] \
+ set res
+} [list [list 0 112 0 38 0] [list 0 0 112 38 0] [list 0 0 112 38 0] \
[list 0 37 37 76 0] [list 0 12 12 126 0]]
-test grid-16.16 {layout span} -body {
+grid_reset 16.15
+
+test grid-16.16 {layout span} {
frame .f1 -width 64 -height 20
frame .f2 -width 38 -height 20
frame .f3 -width 150 -height 20
frame .f4 -width 15 -height 20
frame .f5 -width 18 -height 20
frame .f6 -width 20 -height 20
+
grid .f1 - x .f2
grid .f3 - - -
grid .f4 .f5 .f6
+
set res {}
foreach w {{1 1 5 1} {0 0 1 0} {1 3 4 0} {1 2 1 2} {1 1 1 12}} {
for {set c 0} {$c < 4} {incr c} {
@@ -1705,15 +1730,15 @@ test grid-16.16 {layout span} -body {
}
lappend res $res2
}
- return $res
-} -cleanup {
- grid_reset 16.16
-} -result [list [list 30 34 43 43 0] [list 30 34 48 38 0] [list 22 42 48 38 0] \
+ set res
+} [list [list 30 34 43 43 0] [list 30 34 48 38 0] [list 22 42 48 38 0] \
[list 25 39 29 57 0] [list 30 34 22 64 0]]
-test grid-16.17 {layout weights (shrinking at minsize)} -body {
+grid_reset 16.16
+
+test grid-16.17 {layout weights (shrinking at minsize)} {
foreach i {0 1 2 3} {
- frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
+ frame .$i -bg gray -width 100 -height 75 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
}
grid propagate . 0
grid columnconfigure . {0 1} -weight 1 -minsize 0
@@ -1729,18 +1754,20 @@ test grid-16.17 {layout weights (shrinking at minsize)} -body {
foreach i {0 1 2 3} {
lappend a [winfo width .$i]-[winfo height .$i]-[winfo ismapped .$i]
}
- return $a
-} -cleanup {
- grid_reset 16.17
-} -result {25-25-1 25-25-1 100-75-1 100-75-1 25-25-0 25-25-0 100-75-1 100-75-1}
-test grid-16.18 {layout span} -body {
+ set a
+} {25-25-1 25-25-1 100-75-1 100-75-1 25-25-0 25-25-0 100-75-1 100-75-1}
+grid_reset 16.17
+
+test grid-16.18 {layout span} {
frame .f1 -width 30 -height 20
frame .f2 -width 166 -height 20
frame .f3 -width 39 -height 20
frame .f4 -width 10 -height 20
+
grid .f1 .f3 -
grid .f2 - .f4
grid columnconfigure . 0 -weight 1
+
set res {}
foreach w {{1 0 0} {0 1 0} {0 0 1}} {
for {set c 0} {$c < 3} {incr c} {
@@ -1753,35 +1780,14 @@ test grid-16.18 {layout span} -body {
}
lappend res $res2
}
- return $res
-} -cleanup {
- grid_reset 16.18
-} -result [list [list 137 29 10] [list 30 136 10] [list 98 68 10]]
-test grid-16.19 {layout span} -constraints { knownBug } -body {
- # This test shows the problem in Bug 2075285
- # Several overlapping multi-span widgets is a weak spot
- # in the current implementation.
- # Test present as a reminder in case a future algorithm update is made.
- frame .f1 -width 100 -height 20
- frame .f2 -width 20 -height 20
- frame .f3 -width 10 -height 20
- frame .f4 -width 20 -height 20
- grid .f1 - - - - - -sticky we
- grid .f2 - .f3 - .f4 - -sticky we
- grid columnconfigure . {1 5} -weight 1
- set res {}
- update
- for {set c 0} {$c <= 5} {incr c} {
- lappend res [lindex [grid bbox . $c 0] 2]
- }
- return $res
-} -cleanup {
- grid_reset 16.19
-} -result [list 0 45 5 5 0 45]
+ set res
+} [list [list 137 29 10] [list 30 136 10] [list 98 68 10]]
+grid_reset 16.18
-test grid-17.1 {forget and pending idle handlers} -body {
+test grid-17.1 {forget and pending idle handlers} {
# This test is intended to detect a crash caused by a failure to remove
# pending idle handlers when grid forget is invoked.
+
toplevel .t
wm geometry .t +0+0
frame .t.f
@@ -1792,16 +1798,16 @@ test grid-17.1 {forget and pending idle handlers} -body {
grid forget .t.f.l
grid forget .t.f
destroy .t
+
toplevel .t
frame .t.f
label .t.f.l -text foobar
grid .t.f.l
destroy .t
set result ok
-} -result ok
+} ok
-
-test grid-18.1 {test respect for internalborder} -body {
+test grid-18.1 {test respect for internalborder} {
toplevel .pack
wm geometry .pack 200x200
frame .pack.l -width 15 -height 10
@@ -1817,9 +1823,9 @@ test grid-18.1 {test respect for internalborder} -body {
update
lappend res [winfo geometry .pack.lf.f]
destroy .pack
- return $res
-} -result {196x188+2+10 177x186+5+7}
-test grid-18.2 {test support for minreqsize} -body {
+ set res
+} {196x188+2+10 177x186+5+7}
+test grid-18.2 {test support for minreqsize} {
toplevel .pack
wm geometry .pack {}
frame .pack.l -width 150 -height 100
@@ -1833,10 +1839,10 @@ test grid-18.2 {test support for minreqsize} -body {
update
lappend res [winfo geometry .pack.lf]
destroy .pack
- return $res
-} -result {162x127+0+0 172x112+0+0}
+ set res
+} {162x127+0+0 172x112+0+0}
-test grid-19.1 {uniform realloc} -body {
+test grid-19.1 {uniform realloc} {
# Use a lot of uniform groups to test the reallocation mechanism
for {set t 0} {$t < 100} {incr t 2} {
frame .fa$t -width 5 -height 20
@@ -1846,76 +1852,75 @@ test grid-19.1 {uniform realloc} -body {
}
update
grid bbox .
-} -cleanup {
- grid_reset 19.1
-} -result {0 0 600 20}
+} {0 0 600 20}
+grid_reset 19.1
-test grid-20.1 {recalculate size after removal (destroy)} -body {
+test grid-20.1 {recalculate size after removal (destroy)} {
label .l1 -text l1
grid .l1 -row 2 -column 2
destroy .l1
label .l2 -text l2
grid .l2
grid size .
-} -cleanup {
- grid_reset 20.1
-} -result {1 1}
-test grid-20.2 {recalculate size after removal (forget)} -body {
+} {1 1}
+grid_reset 20.1
+
+test grid-20.2 {recalculate size after removal (forget)} {
label .l1 -text l1
grid .l1 -row 2 -column 2
grid forget .l1
label .l2 -text l2
grid .l2
grid size .
-} -cleanup {
- grid_reset 20.2
-} -result {1 1}
-
-test grid-21.1 {anchor} -body {
- grid anchor . 1 xxx
-} -cleanup {
- grid_reset 21.1
-} -returnCodes error -result {wrong # args: should be "grid anchor window ?anchor?"}
-test grid-21.2 {anchor} -body {
- grid anchor .
-} -cleanup {
- grid_reset 21.2
-} -result {nw}
-test grid-21.3 {anchor} -body {
- grid anchor . se;grid anchor .
-} -cleanup {
- grid_reset 21.3
-} -result {se}
-test grid-21.4 {anchor} -body {
- grid anchor .x
-} -cleanup {
- grid_reset 21.4
-} -returnCodes error -result {bad window path name ".x"}
-test grid-21.5 {anchor} -body {
- grid anchor . x
-} -cleanup {
- grid_reset 21.5
-} -returnCodes error -result {bad anchor "x": must be n, ne, e, se, s, sw, w, nw, or center}
-test grid-21.6 {anchor} -body {
+} {1 1}
+grid_reset 20.2
+
+test grid-21.1 {anchor} {
+ list [catch {grid anchor . 1 xxx} msg] $msg
+} {1 {wrong # args: should be "grid anchor window ?anchor?"}}
+grid_reset 21.1
+
+test grid-21.2 {anchor} {
+ list [catch {grid anchor .} msg] $msg
+} {0 nw}
+grid_reset 21.2
+
+test grid-21.3 {anchor} {
+ list [catch {grid anchor . se;grid anchor .} msg] $msg
+} {0 se}
+grid_reset 21.3
+
+test grid-21.4 {anchor} {
+ list [catch {grid anchor .x} msg] $msg
+} {1 {bad window path name ".x"}}
+grid_reset 21.4
+
+test grid-21.5 {anchor} {
+ list [catch {grid anchor . x} msg] $msg
+} {1 {bad anchor "x": must be n, ne, e, se, s, sw, w, nw, or center}}
+grid_reset 21.5
+
+test grid-21.6 {anchor} {
foreach i {0 1 2} {
- frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
- grid .$i -row $i -column $i -sticky nswe
+ frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
+ grid .$i -row $i -column $i -sticky nswe
}
grid propagate . 0
. configure -width 300 -height 250
+
set res {}
foreach a {n ne e se s sw w nw center} {
grid anchor . $a
update
lappend res [grid bbox .]
}
- return $res
-} -cleanup {
- grid_reset 21.6
-} -result [list {37 0 225 150} {75 0 225 150} {75 50 225 150} {75 100 225 150} \
+ set res
+} [list {37 0 225 150} {75 0 225 150} {75 50 225 150} {75 100 225 150} \
{37 100 225 150} {0 100 225 150} {0 50 225 150} {0 0 225 150} \
{37 50 225 150}]
-test grid-21.7 {anchor} -body {
+grid_reset 21.6
+
+test grid-21.7 {anchor} {
# Test with a non-symmetric internal border.
# This only tests vertically, there is currently no way to get
# it assymetric horizontally.
@@ -1923,13 +1928,15 @@ test grid-21.7 {anchor} -body {
frame .f.x -width 20 -height 20
.f configure -labelwidget .f.x
pack .f -fill both -expand 1
+
foreach i {0 1 2} {
- frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
- grid .$i -in .f -row $i -column $i -sticky nswe
+ frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge
+ grid .$i -in .f -row $i -column $i -sticky nswe
}
pack propagate . 0
grid propagate .f 0
. configure -width 300 -height 250
+
set res {}
foreach a {n ne e se s sw w nw center} {
grid anchor .f $a
@@ -1937,25 +1944,26 @@ test grid-21.7 {anchor} -body {
lappend res [grid bbox .f]
}
pack propagate . 1 ; wm geometry . {}
- return $res
-} -cleanup {
- grid_reset 21.7
-} -result [list {37 20 225 150} {75 20 225 150} {75 60 225 150} {75 100 225 150} \
+ set res
+} [list {37 20 225 150} {75 20 225 150} {75 60 225 150} {75 100 225 150} \
{37 100 225 150} {0 100 225 150} {0 60 225 150} {0 20 225 150} \
{37 60 225 150}]
+grid_reset 21.7
test grid-22.1 {remove: basic argument checking} {
list [catch {grid remove foo} msg] $msg
} {1 {bad window path name "foo"}}
+
test grid-22.2 {remove} {
button .c
grid [button .b]
set a [grid slaves .]
grid remove .b .c
lappend a [grid slaves .]
- return $a
+ set a
} {.b {}}
grid_reset 22.2
+
test grid-22.3 {remove} {
button .c
grid .c -row 2 -column 2 -rowspan 2 -columnspan 2 -padx 3 -pady 4 -sticky ns
@@ -1964,6 +1972,7 @@ test grid-22.3 {remove} {
grid info .c
} {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx 3 -pady 4 -sticky ns}
grid_reset 22.3
+
test grid-22.3.1 {remove} {
frame .a
button .c
@@ -1973,6 +1982,7 @@ test grid-22.3.1 {remove} {
grid info .c
} {-in .a -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns}
grid_reset 22.3.1
+
test grid-22.4 {remove, calling Tk_UnmaintainGeometry} {
frame .f -bd 2 -relief raised
place .f -x 10 -y 20 -width 200 -height 100
@@ -1986,6 +1996,7 @@ test grid-22.4 {remove, calling Tk_UnmaintainGeometry} {
lappend x [winfo ismapped .f2]
} {1 0}
grid_reset 22.4
+
test grid-22.5 {remove} {
frame .a
button .c
@@ -1998,11 +2009,7 @@ test grid-22.5 {remove} {
grid info .c
} {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns}
grid_reset 22.5
-
+
# cleanup
cleanupTests
return
-
-# Local Variables:
-# mode: tcl
-# End: