diff options
Diffstat (limited to 'tests/place.test')
-rw-r--r-- | tests/place.test | 122 |
1 files changed, 66 insertions, 56 deletions
diff --git a/tests/place.test b/tests/place.test index e04ee0a..e60b706 100644 --- a/tests/place.test +++ b/tests/place.test @@ -1,8 +1,8 @@ # This file is a Tcl script to test out the "place" command. It is # organized in the standard fashion for Tcl tests. # -# Copyright (c) 1995 Sun Microsystems, Inc. -# Copyright (c) 1998-1999 by Scriptics Corporation. +# Copyright © 1995 Sun Microsystems, Inc. +# Copyright © 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 @@ -13,6 +13,9 @@ tcltest::loadTestedCommands # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] + # XXX - This test file is woefully incomplete. At present, only a # few of the features are tested. @@ -53,17 +56,17 @@ test place-1.3 {Tk_PlaceCmd procedure, "info" option} -setup { } -result {-in {.t.a b} -x 1 -relx 0.2 -y 2 -rely 0.2 -width {} -relwidth 0.3 -height 4 -relheight {} -anchor w -bordermode ignore} -test place-2.1 {ConfigureSlave procedure, -height option} -body { +test place-2.1 {ConfigureContent procedure, -height option} -body { place .t.f2 -height abcd } -returnCodes error -result {bad screen distance "abcd"} -test place-2.2 {ConfigureSlave procedure, -height option} -setup { +test place-2.2 {ConfigureContent procedure, -height option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -height 40 update winfo height .t.f2 -} -result {40} -test place-2.3 {ConfigureSlave procedure, -height option} -setup { +} -result 40 +test place-2.3 {ConfigureContent procedure, -height option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -height 120 @@ -71,20 +74,20 @@ test place-2.3 {ConfigureSlave procedure, -height option} -setup { place .t.f2 -height {} update winfo height .t.f2 -} -result {60} +} -result 60 -test place-3.1 {ConfigureSlave procedure, -relheight option} -body { +test place-3.1 {ConfigureContent procedure, -relheight option} -body { place .t.f2 -relheight abcd } -returnCodes error -result {expected floating-point number but got "abcd"} -test place-3.2 {ConfigureSlave procedure, -relheight option} -setup { +test place-3.2 {ConfigureContent procedure, -relheight option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relheight .5 update winfo height .t.f2 -} -result {40} -test place-3.3 {ConfigureSlave procedure, -relheight option} -setup { +} -result 40 +test place-3.3 {ConfigureContent procedure, -relheight option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relheight .8 @@ -92,43 +95,43 @@ test place-3.3 {ConfigureSlave procedure, -relheight option} -setup { place .t.f2 -relheight {} update winfo height .t.f2 -} -result {60} +} -result 60 -test place-4.1 {ConfigureSlave procedure, bad -in options} -setup { +test place-4.1 {ConfigureContent procedure, bad -in options} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f2 -} -returnCodes error -result {can't place .t.f2 relative to itself} -test place-4.2 {ConfigureSlave procedure, bad -in option} -setup { +} -returnCodes error -result {can't place ".t.f2" relative to itself} +test place-4.2 {ConfigureContent procedure, bad -in option} -setup { place forget .t.f2 } -body { set result [list [winfo manager .t.f2]] catch {place .t.f2 -in .t.f2} lappend result [winfo manager .t.f2] } -result {{} {}} -test place-4.3 {ConfigureSlave procedure, bad -in option} -setup { +test place-4.3 {ConfigureContent procedure, bad -in option} -setup { place forget .t.f2 } -body { winfo manager .t.f2 place .t.f2 -in .t.f2 -} -returnCodes error -result {can't place .t.f2 relative to itself} -test place-4.4 {ConfigureSlave procedure, bad -in option} -setup { +} -returnCodes error -result {can't place ".t.f2" relative to itself} +test place-4.4 {ConfigureContent procedure, bad -in option} -setup { place forget .t.f2 } -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 { +} -returnCodes error -result {can't place ".t.f2" relative to "."} +test place-4.5 {ConfigureContent 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} +} -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} +} -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 @@ -137,19 +140,19 @@ test place-4.7 {prevent management loops} -setup { 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} +} -returnCodes error -result {can't put ".t.f3" inside ".t.f1": would cause management loop} -test place-5.1 {ConfigureSlave procedure, -relwidth option} -body { +test place-5.1 {ConfigureContent procedure, -relwidth option} -body { place .t.f2 -relwidth abcd } -returnCodes error -result {expected floating-point number but got "abcd"} -test place-5.2 {ConfigureSlave procedure, -relwidth option} -setup { +test place-5.2 {ConfigureContent procedure, -relwidth option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relwidth .5 update winfo width .t.f2 -} -result {75} -test place-5.3 {ConfigureSlave procedure, -relwidth option} -setup { +} -result 75 +test place-5.3 {ConfigureContent procedure, -relwidth option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -relwidth .8 @@ -157,19 +160,19 @@ test place-5.3 {ConfigureSlave procedure, -relwidth option} -setup { place .t.f2 -relwidth {} update winfo width .t.f2 -} -result {30} +} -result 30 -test place-6.1 {ConfigureSlave procedure, -width option} -body { +test place-6.1 {ConfigureContent procedure, -width option} -body { place .t.f2 -width abcd } -returnCodes error -result {bad screen distance "abcd"} -test place-6.2 {ConfigureSlave procedure, -width option} -setup { +test place-6.2 {ConfigureContent procedure, -width option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -width 100 update winfo width .t.f2 -} -result {100} -test place-6.3 {ConfigureSlave procedure, -width option} -setup { +} -result 100 +test place-6.3 {ConfigureContent procedure, -width option} -setup { place forget .t.f2 } -body { place .t.f2 -in .t.f -width 120 @@ -177,7 +180,7 @@ test place-6.3 {ConfigureSlave procedure, -width option} -setup { place .t.f2 -width {} update winfo width .t.f2 -} -result {30} +} -result 30 test place-7.1 {ReconfigurePlacement procedure, computing position} -setup { @@ -258,40 +261,47 @@ test place-7.10 {ReconfigurePlacement procedure, computing size} -setup { list [winfo width .t.f2] [winfo height .t.f2] } -result {30 60} +if {[tk windowingsystem] == "win32"} { + proc placeUpdate {} { + update + } +} else { + proc placeUpdate {} { + } +} -test place-8.1 {MasterStructureProc, mapping and unmapping slaves} -setup { +test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup { place forget .t.f2 place forget .t.f } -body { place .t.f2 -relx 1.0 -rely 1.0 -anchor sw - update + update idletasks set result [winfo ismapped .t.f2] wm iconify .t - update lappend result [winfo ismapped .t.f2] place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw - update + update idletasks lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2] wm deiconify .t - update + placeUpdate lappend result [winfo ismapped .t.f2] } -result {1 0 40 30 0 1} -test place-8.2 {MasterStructureProc, mapping and unmapping slaves} -setup { +test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup { place forget .t.f2 place forget .t.f + update idletasks } -body { place .t.f -x 0 -y 0 -width 200 -height 100 place .t.f2 -in .t.f -relx 1.0 -rely 1.0 -anchor sw -width 50 -height 20 - update + update idletasks set result [winfo ismapped .t.f2] wm iconify .t - update lappend result [winfo ismapped .t.f2] place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw - update + update idletasks lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2] wm deiconify .t - update + placeUpdate lappend result [winfo ismapped .t.f2] } -result {1 0 42 32 0 1} destroy .t @@ -322,7 +332,7 @@ test place-9.5 {PlaceObjCmd} -setup { place badopt .foo } -cleanup { destroy .foo -} -returnCodes error -result {bad option "badopt": must be configure, forget, info, or slaves} +} -returnCodes error -result {bad option "badopt": must be configure, content, forget, or info} test place-9.6 {PlaceObjCmd, configure errors} -setup { destroy .foo } -body { @@ -373,17 +383,17 @@ test place-9.11 {PlaceObjCmd, info errors} -setup { } -cleanup { destroy .foo } -returnCodes error -result {wrong # args: should be "place info pathName"} -test place-9.12 {PlaceObjCmd, slaves errors} -setup { +test place-9.12 {PlaceObjCmd, content errors} -setup { destroy .foo } -body { frame .foo - place slaves .foo bar + place content .foo bar } -cleanup { destroy .foo -} -returnCodes error -result {wrong # args: should be "place slaves pathName"} +} -returnCodes error -result {wrong # args: should be "place content pathName"} -test place-10.1 {ConfigureSlave} -setup { +test place-10.1 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -391,7 +401,7 @@ test place-10.1 {ConfigureSlave} -setup { } -cleanup { destroy .foo } -returnCodes error -result {unknown option "-badopt"} -test place-10.2 {ConfigureSlave} -setup { +test place-10.2 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -399,7 +409,7 @@ test place-10.2 {ConfigureSlave} -setup { } -cleanup { destroy .foo } -returnCodes error -result {value for "-anchor" missing} -test place-10.3 {ConfigureSlave} -setup { +test place-10.3 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -407,7 +417,7 @@ test place-10.3 {ConfigureSlave} -setup { } -cleanup { destroy .foo } -returnCodes error -result {bad bordermode "j": must be inside, outside, or ignore} -test place-10.4 {ConfigureSlave} -setup { +test place-10.4 {ConfigureContent} -setup { destroy .foo } -body { frame .foo @@ -417,21 +427,21 @@ test place-10.4 {ConfigureSlave} -setup { } -returnCodes error -result {value for "-y" missing} -test place-11.1 {PlaceObjCmd, slaves command} -setup { +test place-11.1 {PlaceObjCmd, content command} -setup { destroy .foo } -body { frame .foo - place slaves .foo + place content .foo } -cleanup { destroy .foo } -result {} -test place-11.2 {PlaceObjCmd, slaves command} -setup { +test place-11.2 {PlaceObjCmd, content command} -setup { destroy .foo .bar } -body { frame .foo frame .bar place .bar -in .foo - place slaves .foo + place content .foo } -cleanup { destroy .foo .bar } -result [list .bar] @@ -493,7 +503,7 @@ test place-14.1 {memory leak testing} -constraints memory -setup { return $res } } -body { - # Test all manners of forgetting a slave + # Test all manners of forgetting content frame .f frame .f.f stress { |