diff options
Diffstat (limited to 'tests/grid.test')
-rw-r--r-- | tests/grid.test | 157 |
1 files changed, 136 insertions, 21 deletions
diff --git a/tests/grid.test b/tests/grid.test index 89897ca..9aa2f84 100644 --- a/tests/grid.test +++ b/tests/grid.test @@ -1,8 +1,8 @@ # 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. +# Copyright © 1996 Sun Microsystems, Inc. +# Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 @@ -45,7 +45,7 @@ test grid-1.1 {basic argument checking} -body { } -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, content, forget, info, location, propagate, remove, rowconfigure, size, or slaves} +} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, or size} test grid-1.3 {basic argument checking} -body { button .b grid .b -row 0 -column @@ -63,10 +63,10 @@ test grid-1.5 {basic argument checking} -body { } -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} +} -returnCodes error -result {can't determine container window} test grid-1.7 {basic argument checking} -body { grid configure x -} -returnCodes error -result {can't determine master window} +} -returnCodes error -result {can't determine container window} test grid-1.8 {basic argument checking} -body { button .b grid x .b @@ -93,7 +93,7 @@ test grid-2.2 {bbox} -body { } -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??"} +} -returnCodes error -result {wrong # args: should be "grid bbox window ?column row ?column row??"} test grid-2.4 {bbox} -body { grid bbox .bad 0 0 } -returnCodes error -result {bad window path name ".bad"} @@ -179,7 +179,7 @@ test grid-3.7 {configure: basic argument checking} -body { grid .f .f.b } -cleanup { grid_reset 3.7 -} -returnCodes error -result {can't put .f.b inside .} +} -returnCodes error -result {can't put ".f.b" inside "."} test grid-3.8 {configure: basic argument checking} -body { button .b grid configure x .b @@ -206,7 +206,7 @@ test grid-3.11 {prevent management loops} -body { grid .f2 -in .f1 } -cleanup { grid_reset 3.11 -} -returnCodes error -result {can't put .f2 inside .f1, would cause management loop} +} -returnCodes error -result {can't put ".f2" inside ".f1": would cause management loop} test grid-3.12 {prevent management loops} -body { frame .f1 frame .f2 @@ -216,7 +216,7 @@ test grid-3.12 {prevent management loops} -body { grid .f3 -in .f1 } -cleanup { grid_reset 3.12 -} -returnCodes error -result {can't put .f3 inside .f1, would cause management loop} +} -returnCodes error -result {can't put ".f3" inside ".f1": would cause management loop} test grid-4.1 {forget: basic argument checking} -body { grid forget foo @@ -293,16 +293,16 @@ test grid-5.4 {info} -body { test grid-6.1 {location: basic argument checking} -body { grid location . -} -returnCodes error -result {wrong # args: should be "grid location master x y"} +} -returnCodes error -result {wrong # args: should be "grid location window 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"} +} -returnCodes error -result {expected screen distance but got "x"} test grid-6.4 {location: basic argument checking} -body { grid location . 1c y -} -returnCodes error -result {bad screen distance "y"} +} -returnCodes error -result {expected screen distance but got "y"} test grid-6.5 {location: basic argument checking} -body { frame .f grid location .f 10 10 @@ -574,12 +574,12 @@ 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 ...?"} +} -returnCodes error -result {wrong # args: should be "grid columnconfigure window 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 ...?"} +} -returnCodes error -result {wrong # args: should be "grid columnconfigure window index ?-option value ...?"} test grid-10.3 {column/row configure} -body { grid columnconfigure .f 0 -weight } -cleanup { @@ -609,12 +609,12 @@ 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"} +} -returnCodes error -result {expected screen distance but got "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"} +} -returnCodes error -result {expected screen distance but got "foo"} test grid-10.10 {column/row configure} -body { grid columnconfigure . 0 -minsize 10 grid columnconfigure . 0 -minsize @@ -641,7 +641,7 @@ 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"} +} -returnCodes error -result {expected screen distance but got "foo"} test grid-10.15 {column/row configure} -body { grid columnconfigure . 0 -pad -3 } -cleanup { @@ -854,13 +854,13 @@ test grid-11.1 {default widget placement} -body { grid ^ } -cleanup { grid_reset 11.1 -} -returnCodes error -result {can't use '^', cant find master} +} -returnCodes error -result {can't use '^', can't find container window} 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 "^"} +} -returnCodes error -result {can't find content to extend with "^"} test grid-11.3 {default widget placement} -body { button .b grid .b - - .c @@ -915,7 +915,7 @@ test grid-11.9 {default widget placement} -body { grid .f x ^ } -cleanup { grid_reset 11.9 -} -returnCodes error -result {can't find slave to extend with "^"} +} -returnCodes error -result {can't find content to extend with "^"} test grid-11.10 {default widget placement} -body { foreach i {1 2 3} { frame .f$i -width 100 -height 50 -highlightthickness 0 -bg red @@ -1160,7 +1160,7 @@ test grid-13.4 {-in} -body { grid .f -in .top } -cleanup { grid_reset 13.3 -} -returnCodes error -result {can't put .f inside .top} +} -returnCodes error -result {can't put ".f" inside ".top"} destroy .top test grid-13.5 {-ipadx} -body { frame .f -width 20 -height 20 -highlightthickness 0 -bg red @@ -2039,6 +2039,121 @@ test grid-23 {grid configure -in leaked from previous container window - bug winfo ismapped .t ; # must return 1 } 1 grid_reset 23 + +test grid-24.1 {<<NoManagedChild>> fires on last grid forget} -setup { + global A + unset -nocomplain A +} -body { + grid [frame .1] + update + bind . <<NoManagedChild>> {set A 1} + grid forget .1 + update + info exists A +} -cleanup { + bind . <<NoManagedChild>> {} + grid_reset 24.1 +} -result 1 +test grid-24.2 {<<NoManagedChild>> fires on last grid remove} -setup { + global A + unset -nocomplain A +} -body { + grid [frame .1] + update + bind . <<NoManagedChild>> {set A 1} + grid remove .1 + update + info exists A +} -cleanup { + bind . <<NoManagedChild>> {} + grid_reset 24.2 +} -result 1 +test grid-24.3 {<<NoManagedChild>> fires on last gridded child destruction} -setup { + global A + unset -nocomplain A +} -body { + grid [frame .1] + update + bind . <<NoManagedChild>> {incr A} + destroy .1 + update + set A +} -cleanup { + bind . <<NoManagedChild>> {} + grid_reset 24.3 +} -result 1 +test grid-24.4 {<Configure> does not fire on last grid forget} -setup { + global A + unset -nocomplain A +} -body { + grid [frame .1] + update + bind . <Configure> {set A 1} + grid forget .1 + update + info exists A +} -cleanup { + bind . <Configure> {} + grid_reset 24.4 +} -result 0 +test grid-24.5 {<Configure> fires on forelast grid forget} -setup { + global A + unset -nocomplain A +} -body { + grid [frame .1] + grid [frame .2] + update + bind . <Configure> {set A 1} + grid forget .1 + update + info exists A +} -cleanup { + bind . <Configure> {} + grid_reset 24.5 +} -result 1 +test grid-24.6 {<<NoManagedChild>> does not fire on forelast grid forget} -setup { + global A + unset -nocomplain A +} -body { + grid [frame .1] + grid [frame .2] + update + bind . <<NoManagedChild>> {set A 1} + grid forget .1 + update + info exists A +} -cleanup { + bind . <<NoManagedChild>> {} + grid_reset 24.6 +} -result 0 +test grid-24.7 {<<NoManagedChild>> does not fire on grid anchor} -setup { + global A + unset -nocomplain A +} -body { + bind . <<NoManagedChild>> {set A 1} + grid anchor . w + update + info exists A +} -cleanup { + grid anchor . nw + bind . <<NoManagedChild>> {} + grid_reset 24.7 +} -result 0 +test grid-24.8 {<<NoManagedChild>> does not fire on last grid forget if propagation is off} -setup { + global A + unset -nocomplain A +} -body { + grid [frame .1] + grid propagate . 0 + update + bind . <<NoManagedChild>> {set A 1} + grid forget .1 + update + info exists A +} -cleanup { + bind . <<NoManagedChild>> {} + grid_reset 24.8 +} -result 0 # cleanup cleanupTests |