summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authormdejong <mdejong>2003-03-12 00:09:32 (GMT)
committermdejong <mdejong>2003-03-12 00:09:32 (GMT)
commitafa939233fb68487e8c90d38f5831b56104d8724 (patch)
treeecef370c50b2d02b66d81ba8deaa5e9601199442 /tests
parent631057a2dc039d804acf76033e46cef5104089c9 (diff)
downloadtk-afa939233fb68487e8c90d38f5831b56104d8724.zip
tk-afa939233fb68487e8c90d38f5831b56104d8724.tar.gz
tk-afa939233fb68487e8c90d38f5831b56104d8724.tar.bz2
* generic/tkGrid.c (GridStructureProc, ConfigureSlaves):
Check for a NULL masterPtr and slavePtr in the GridStructureProc code to ensure that a Gridder created before some error condition is ignored when it comes to geometry calculations. This approach closely matches the pack implementation. Keep track of a -in argument to a grid command in order to detect the case of an already gridded widget that wants to change some options. The previous implementation could make repeated and unnecessary calls to Tk_ManageGeometry. Replace use of "parent" with "master" in comments throughout the file. * generic/tkPack.c (PackStructureProc): Check for a NULL masterPtr before other checks so that a slave created under certain error conditions is cleaned up properly. Replace use of "parent" with "master" in comments throughout the file. * generic/tkPlace.c (CreateSlave, ConfigureSlave, SlaveStructureProc): Don't call Tk_ManageGeometry in CreateSlave since this was causing incorrect results in some error cases. Rework the ConfigureSlave method so that slave setup is done in one place. The call to Tk_ManageGeometry was added to the one place where a slave is setup. When a slave is configured but the master is not changed, simply goto the scheduleLayout label. Check for a NULL master in SlaveStructureProc for the sake of readability. * tests/grid.test: * tests/pack.test: * tests/place.test: Add test to check that a winfo manager call does not return incorrect results after an error condition is hit. [Patch 693063]
Diffstat (limited to 'tests')
-rw-r--r--tests/grid.test10
-rw-r--r--tests/pack.test8
-rw-r--r--tests/place.test8
3 files changed, 23 insertions, 3 deletions
diff --git a/tests/grid.test b/tests/grid.test
index c47348e..47f99c0 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.17 2002/10/10 21:07:52 pspjuth Exp $
+# RCS: @(#) $Id: grid.test,v 1.18 2003/03/12 00:09:37 mdejong Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -946,6 +946,14 @@ test grid-13.1 {-in} {
} {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]
+} {{} 1 {Window can't be managed in itself} {}}
+grid_reset 13.1.1
+
test grid-13.2 {-in} {
frame .f -bg red
list [catch "grid .f -in .bad" msg] $msg
diff --git a/tests/pack.test b/tests/pack.test
index 488281a..c4af29f 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.10 2002/07/13 20:28:35 dgp Exp $
+# RCS: @(#) $Id: pack.test,v 1.11 2003/03/12 00:09:40 mdejong Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -615,6 +615,12 @@ test pack-10.2 {retaining/clearing configuration state} {
pack .pack.a -pady 14
pack info .pack.a
} {-in .pack -anchor n -expand 1 -fill both -ipadx 3 -ipady 4 -padx 1 -pady 14 -side bottom}
+test pack-10.3 {bad -in window does not change master} {
+ pack forget .pack.a .pack.b .pack.c .pack.d
+ list [winfo manager .pack.a] \
+ [catch {pack .pack.a -in .pack.a} err] $err \
+ [winfo manager .pack.a]
+} {{} 1 {can't pack .pack.a inside itself} {}}
test pack-11.1 {info option} {
pack4 -in .pack
diff --git a/tests/place.test b/tests/place.test
index 4bf47fb..10e45b7 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -5,7 +5,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: place.test,v 1.8 2002/11/07 19:10:30 pspjuth Exp $
+# RCS: @(#) $Id: place.test,v 1.9 2003/03/12 00:09:40 mdejong Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -87,6 +87,12 @@ test place-4.1 {ConfigureSlave procedure, bad -in options} {
} [list 1 "can't place .t.f2 relative to itself"]
test place-4.2 {ConfigureSlave procedure, bad -in option} {
place forget .t.f2
+ list [winfo manager .t.f2] \
+ [catch {place .t.f2 -in .t.f2} err] $err \
+ [winfo manager .t.f2]
+} {{} 1 {can't place .t.f2 relative to itself} {}}
+test place-4.3 {ConfigureSlave procedure, bad -in option} {
+ place forget .t.f2
list [catch {place .t.f2 -in .} msg] $msg
} [list 1 "can't place .t.f2 relative to ."]