diff options
author | culler <culler> | 2019-04-05 19:55:57 (GMT) |
---|---|---|
committer | culler <culler> | 2019-04-05 19:55:57 (GMT) |
commit | 081ca218bb45dcb50deb08f5674ed98c317f18b6 (patch) | |
tree | dc5c18612f61da4b945117828e40508bf3de2ae4 /tests | |
parent | db0089391e638dba6174fa80b2ab69a03cbce72b (diff) | |
download | tk-081ca218bb45dcb50deb08f5674ed98c317f18b6.zip tk-081ca218bb45dcb50deb08f5674ed98c317f18b6.tar.gz tk-081ca218bb45dcb50deb08f5674ed98c317f18b6.tar.bz2 |
Fix bug [897ffea89f]: Tk allows management loops
Diffstat (limited to 'tests')
-rw-r--r-- | tests/grid.test | 26 | ||||
-rw-r--r-- | tests/pack.test | 23 | ||||
-rw-r--r-- | tests/place.test | 21 |
3 files changed, 69 insertions, 1 deletions
diff --git a/tests/grid.test b/tests/grid.test index cba69db..cc445e3 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,31 @@ 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 + update +} -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 efb262b..cc517ed 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -976,6 +976,29 @@ 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 + puts "packing frames" + pack .f1 -in .f2 + pack .f2 -in .f3 +# update idletasks + 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 { diff --git a/tests/place.test b/tests/place.test index ddfa64c..62e0ed2 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 |