summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorculler <culler>2019-04-06 21:51:49 (GMT)
committerculler <culler>2019-04-06 21:51:49 (GMT)
commit5b611a83196ff439230e3d7f59a0d348531bb1ba (patch)
tree24d6091cd1c6cf2c2b3755957e700ddbf14c56be /tests
parent13aa1a63c6190d65ae8c2ed113c48b4f531d1867 (diff)
parent9e473608af41eceb9a78c7338a68d9509243cf38 (diff)
downloadtk-5b611a83196ff439230e3d7f59a0d348531bb1ba.zip
tk-5b611a83196ff439230e3d7f59a0d348531bb1ba.tar.gz
tk-5b611a83196ff439230e3d7f59a0d348531bb1ba.tar.bz2
Fix bug [897ffea89f]: Tk allows management loops. Provide access to a window's
geometry manager.
Diffstat (limited to 'tests')
-rw-r--r--tests/grid.test25
-rw-r--r--tests/pack.test21
-rw-r--r--tests/place.test21
3 files changed, 66 insertions, 1 deletions
diff --git a/tests/grid.test b/tests/grid.test
index 63bfe2a..c22fe24 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -80,6 +80,7 @@ test grid-1.9 {basic argument checking} -body {
grid_reset 1.9
} -returnCodes ok -result {}
+
test grid-2.1 {bbox} -body {
grid bbox .
} -result {0 0 0 0}
@@ -192,6 +193,30 @@ test grid-3.9 {configure: basic argument checking} -body {
} -cleanup {
grid_reset 3.9
} -returnCodes error -result {invalid window shortcut, "y" should be '-', 'x', or '^'}
+test grid-3.10 {configure: basic argument checking} -body {
+ frame .f
+ grid .f -in .f
+} -cleanup {
+ grid_reset 3.10
+} -returnCodes error -result {window can't be managed in itself}
+test grid-3.11 {configure: basic argument checking} -body {
+ frame .f1
+ frame .f2
+ grid .f1 -in .f2
+ grid .f2 -in .f1
+} -cleanup {
+ grid_reset 3.11
+} -returnCodes error -result {can't put .f2 inside .f1, would cause management loop}
+test grid-3.12 {configure: basic argument checking} -body {
+ frame .f1
+ frame .f2
+ frame .f3
+ grid .f1 -in .f2
+ grid .f2 -in .f3
+ grid .f3 -in .f1
+} -cleanup {
+ grid_reset 3.12
+} -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
diff --git a/tests/pack.test b/tests/pack.test
index 9d5964c..4a41516 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -965,6 +965,27 @@ test pack-10.4 {bad -in window does not change master} -setup {
winfo manager .pack.a
pack .pack.a -in .pack.a
} -returnCodes error -result {can't pack .pack.a inside itself}
+test pack-10.5 {prevent management loops} -body {
+ frame .f1
+ frame .f2
+ pack .f1 -in .f2
+ pack .f2 -in .f1
+} -cleanup {
+ destroy .f1
+ destroy .f2
+} -returnCodes error -result {can't put .f2 inside .f1, would cause management loop}
+test pack-10.6 {prevent management loops} -body {
+ frame .f1
+ frame .f2
+ frame .f3
+ pack .f1 -in .f2
+ pack .f2 -in .f3
+ pack .f3 -in .f1
+} -cleanup {
+ destroy .f1
+ destroy .f2
+ destroy .f3
+} -returnCodes error -result {can't put .f3 inside .f1, would cause management loop}
test pack-11.1 {info option} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
diff --git a/tests/place.test b/tests/place.test
index 6a00192..e04ee0a 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -118,7 +118,26 @@ test place-4.4 {ConfigureSlave procedure, bad -in option} -setup {
} -body {
place .t.f2 -in .
} -returnCodes error -result {can't place .t.f2 relative to .}
-
+test place-4.5 {ConfigureSlave procedure, bad -in option} -setup {
+} -body {
+ frame .t.f1
+ place .t.f1 -in .t.f1
+} -returnCodes error -result {can't place .t.f1 relative to itself}
+test place-4.6 {prevent management loops} -setup {
+ place forget .t.f1
+} -body {
+ place .t.f1 -in .t.f2
+ place .t.f2 -in .t.f1
+} -returnCodes error -result {can't put .t.f2 inside .t.f1, would cause management loop}
+test place-4.7 {prevent management loops} -setup {
+ place forget .t.f1
+ place forget .t.f2
+} -body {
+ frame .t.f3
+ place .t.f1 -in .t.f2
+ place .t.f2 -in .t.f3
+ place .t.f3 -in .t.f1
+} -returnCodes error -result {can't put .t.f3 inside .t.f1, would cause management loop}
test place-5.1 {ConfigureSlave procedure, -relwidth option} -body {
place .t.f2 -relwidth abcd