head	1.12;
access;
symbols
	core-8-5-9:1.11
	core-8-5-8:1.11
	macosx-cocoa-merge:1.12
	macosx-cocoa-premerge:1.12
	macosx-carbon-freeze:1.12
	core-8-5-7:1.11
	core-8-5-6:1.11
	core-8-6-b1:1.12
	core-8-6-a3:1.12
	core-8-5-5:1.11
	core-8-6-a2:1.11
	core-8-5-4:1.11
	core-8-5-3:1.11
	core-8-6-a1:1.11
	core-8-4-19:1.8.2.1
	core-8-5-branch:1.11.0.4
	core-8-5-2:1.11
	core-8-4-18:1.8.2.1
	core-8-5-1:1.11
	core-8-4-17:1.8.2.1
	core-8-5-0:1.11
	core-8-5-b3:1.11
	core-8-5-b2:1.11
	core-8-4-16:1.8.2.1
	core-8-5-b1:1.11
	core-stablilizer-merge:1.11
	core-stabilizer-branch:1.11.0.2
	core-stabilizer-merge:1.11
	core-8-4-15:1.8.2.1
	core-8-5-a6:1.11
	core-8-5-a5:1.11
	core-8-4-14:1.8.2.1
	core-8-5-a4:1.11
	core-8-4-13:1.8.2.1
	core-8-4-12:1.8.2.1
	core-8-4-11:1.8.2.1
	core-8-5-a3:1.11
	core-8-4-10:1.8.2.1
	core-8-4-9-branch:1.8.2.1.0.2
	core-8-5-a2:1.11
	core-8-4-9:1.8.2.1
	core-8-4-8:1.8.2.1
	core-8-4-7:1.8
	core-8-5-a1:1.10
	core-8-4-6:1.8
	core-8-4-5:1.8
	mistachkin-dev-branch:1.10.0.2
	core-8-4-4:1.8
	core-8-4-3:1.8
	core-8-4-branch:1.8.0.2
	core-8-4-2:1.8
	core-8-4-1:1.7
	core-8-3-5:1.3
	core-8-4-0:1.7
	macosx-8-4-merge-2002-08-31-trunk:1.7
	macosx-8-4-premerge-2002-08-31-branch:1.6.2.1
	macosx-8-4-premerge-2002-08-31-trunk:1.7
	macosx-8-4-merge-2002-08-30-branch:1.6.2.1
	macosx-8-4-merge-2002-08-30-trunk:1.7
	macosx-8-4-merge-2002-08-20-branch:1.6.2.1
	macosx-8-4-merge-2002-08-20-trunk:1.7
	core-8-4-b2:1.7
	core-8-4-b1:1.6
	macosx-premerge-6-9-02:1.6
	core-8-4-a4:1.6
	core-8-3-4:1.3
	macosx-8-4-branch:1.6.0.2
	macosx-8-4-branchpoint:1.6
	core-8-4-a3:1.5
	core-8-3-3:1.3
	dgp-privates-into-namespace:1.5.0.4
	tclpro-1-5-0:1.3
	core-8-4-win-speedup:1.5.0.2
	core-8-4-a2:1.5
	tclpro-1-4-1:1.3
	tclpro-1-4-0:1.3
	core-8-3-2:1.3
	ajuba-ajuba2-2-1-base:1.3
	ajuba-ajuba2-2-0:1.3
	core-8-4-a1:1.3
	core-8-3-1-branch:1.3.0.12
	core-8-3-1:1.3
	scriptics-sc-2-0-b5:1.3
	scriptics-sc-2-0-fixed:1.3
	scriptics-sc-2-0-b2:1.3
	scriptics-sc-2-0-b1:1.3
	core-8-3-0:1.3
	core-8-3-b2:1.3
	core-8-3-b1:1.3
	scriptics-sc-1-1:1.3
	scriptics-sc-1-1-b1:1.3
	core-8-2-3:1.3
	scriptics-sc-1-1-branch:1.3.0.10
	scriptics-sc-1-1-base:1.3
	scriptics-sc-1-0:1.3
	scriptics-sc-1-0-branch:1.3.0.8
	scriptics-sc-1-0-base:1.3
	core-8-2-2:1.3
	core-8-2-1:1.3
	scriptics-bc-1-0-b1:1.3
	core-8-2-1-branch:1.3.0.6
	scriptics-tclpro-1-3-0:1.3
	core-8-2-0:1.3
	core-8-2-b3-branch:1.3.0.4
	core-8-2-b3-base:1.3
	scriptics-tclpro-1-3-b4:1.3
	core-8-2-b2:1.3
	scriptics-tclpro-1-3-b3:1.3
	core-8-2-b1:1.3
	scriptics-tclpro-1-3-b2:1.3
	merge-to-mainline-5/21/99:1.3
	scriptics-tclpro-1-3-b2-branch:1.3.0.2
	core-8-1-1:1.3
	scriptics-tclpro-1-3-b1:1.3
	core-8-1-1-base:1.3
	core-8-1-0:1.3
	merge-to-mainline-4-29-99:1.3
	merge-to-mainline-4-23-99:1.3
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.4
	core-8-1-b2:1.1.4.2
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@# @;


1.12
date	2008.08.28.08.52.05;	author aniap;	state Exp;
branches;
next	1.11;

1.11
date	2004.09.16.18.01.20;	author pspjuth;	state Exp;
branches;
next	1.10;

1.10
date	2003.04.01.21.06.49;	author dgp;	state Exp;
branches;
next	1.9;

1.9
date	2003.03.12.00.09.40;	author mdejong;	state Exp;
branches;
next	1.8;

1.8
date	2002.11.07.19.10.30;	author pspjuth;	state Exp;
branches
	1.8.2.1;
next	1.7;

1.7
date	2002.07.13.20.28.35;	author dgp;	state Exp;
branches;
next	1.6;

1.6
date	2001.09.26.21.36.19;	author pspjuth;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2000.08.10.00.21.08;	author ericm;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2000.08.08.19.21.20;	author ericm;	state Exp;
branches;
next	1.3;

1.3
date	99.04.16.01.51.40;	author stanton;	state Exp;
branches;
next	1.2;

1.2
date	98.09.14.18.23.49;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.58.15;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.18.51;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	99.03.11.18.51.04;	author hershey;	state Exp;
branches;
next	1.1.4.3;

1.1.4.3
date	99.03.24.01.17.02;	author hershey;	state Exp;
branches;
next	1.1.4.4;

1.1.4.4
date	99.03.24.02.54.56;	author hershey;	state Exp;
branches;
next	;

1.5.2.1
date	2002.04.02.20.57.58;	author hobbs;	state Exp;
branches;
next	;

1.6.2.1
date	2002.08.20.20.27.15;	author das;	state Exp;
branches;
next	;

1.8.2.1
date	2004.09.16.18.22.21;	author pspjuth;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Update to tcltest2
@
text
@# 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.
# All rights reserved.
#
# RCS: @@(#) $Id: place.test,v 1.11 2004/09/16 18:01:20 pspjuth Exp $

package require tcltest 2.2
namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands

# Used for constraining memory leak tests
testConstraint memory [llength [info commands memory]]

# XXX - This test file is woefully incomplete.  At present, only a
# few of the features are tested.

# Widgets used in tests 1.* - 8.*
toplevel .t -width 300 -height 200 -bd 0
wm geom .t +0+0
frame .t.f -width 154 -height 84 -bd 2 -relief raised
place .t.f -x 48 -y 38
frame .t.f2 -width 30 -height 60 -bd 2 -relief raised
update

test place-1.1 {Tk_PlaceCmd procedure, "info" option} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -x 0
    place info .t.f2
} -result {-in .t -x 0 -relx 0 -y 0 -rely 0 -width {} -relwidth {} -height {} -relheight {} -anchor nw -bordermode inside}
test place-1.2 {Tk_PlaceCmd procedure, "info" option} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -x 1 -y 2 -width 3 -height 4 -relx 0.1 -rely 0.2 \
        -relwidth 0.3 -relheight 0.4 -anchor se -in .t.f  \
        -bordermode outside
    place info .t.f2
} -result {-in .t.f -x 1 -relx 0.1 -y 2 -rely 0.2 -width 3 -relwidth 0.3 -height 4 -relheight 0.4 -anchor se -bordermode outside}
test place-1.3 {Tk_PlaceCmd procedure, "info" option} -setup {
    place forget .t.f2
    destroy .t.a.b
} -body {
    # Make sure the result is built as a proper list by using a space in parent
    frame ".t.a b"
    place .t.f2 -x 1 -y 2 -width {} -height 4 -relx 0.2 -rely 0.2 \
        -relwidth 0.3 -relheight {} -anchor w -in ".t.a b"  \
        -bordermode ignore
    place info .t.f2
} -cleanup {
    destroy ".t.a.b"
} -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 {
    place .t.f2 -height abcd
} -returnCodes error -result {bad screen distance "abcd"}
test place-2.2 {ConfigureSlave 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 {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -height 120
    update
    place .t.f2 -height {}
    update
    winfo height .t.f2
} -result {60}


test place-3.1 {ConfigureSlave 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 {
    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 {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -relheight .8
    update
    place .t.f2 -relheight {}
    update
    winfo height .t.f2
} -result {60}


test place-4.1 {ConfigureSlave 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 {
    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 {
    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 {
    place forget .t.f2
} -body {
    place .t.f2 -in .
} -returnCodes error -result {can't place .t.f2 relative to .}


test place-5.1 {ConfigureSlave 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 {
    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 {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -relwidth .8
    update
    place .t.f2 -relwidth {}
    update
    winfo width .t.f2
} -result {30}

test place-6.1 {ConfigureSlave 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 {
    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 {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -width 120
    update
    place .t.f2 -width {}
    update
    winfo width .t.f2
} -result {30}


test place-7.1 {ReconfigurePlacement procedure, computing position} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -x -2 -relx .5 -y 3 -rely .4
    update
    winfo geometry .t.f2
} -result {30x60+123+75}
test place-7.2 {ReconfigurePlacement procedure, position rounding} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -x -1.4 -y -2.3
    update
    winfo geometry .t.f2
} -result {30x60+49+38}
test place-7.3 {ReconfigurePlacement procedure, position rounding} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -x 1.4 -y 2.3
    update
    winfo geometry .t.f2
} -result {30x60+51+42}
test place-7.4 {ReconfigurePlacement procedure, position rounding} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -x -1.6 -y -2.7
    update
    winfo geometry .t.f2
} -result {30x60+48+37}
test place-7.5 {ReconfigurePlacement procedure, position rounding} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -x 1.6 -y 2.7
    update
    winfo geometry .t.f2
} -result {30x60+52+43}
test place-7.6 {ReconfigurePlacement procedure, position rounding} -setup {
    destroy .t.f3
} -body {
    frame .t.f3 -width 100 -height 100 -bg #f00000 -bd 0
    place .t.f3 -x 0 -y 0
    raise .t.f2
    place forget .t.f2
    place .t.f2 -in .t.f3 -relx .303 -rely .406 -relwidth .304 -relheight .206
    update
    winfo geometry .t.f2
} -cleanup {
    destroy .t.f3
} -result {31x20+30+41}
test place-7.7 {ReconfigurePlacement procedure, computing size} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -width 120 -height 89
    update
    list [winfo width .t.f2] [winfo height .t.f2]
} -result {120 89}
test place-7.8 {ReconfigurePlacement procedure, computing size} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -relwidth .4 -relheight .5
    update
    list [winfo width .t.f2] [winfo height .t.f2]
} -result {60 40}
test place-7.9 {ReconfigurePlacement procedure, computing size} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -width 10 -relwidth .4 -height -4 -relheight .5
    update
    list [winfo width .t.f2] [winfo height .t.f2]
} -result {70 36}
test place-7.10 {ReconfigurePlacement procedure, computing size} -setup {
    place forget .t.f2
} -body {
    place .t.f2 -in .t.f -width 10 -relwidth .4 -height -4 -relheight .5
    place .t.f2 -width {} -relwidth {} -height {} -relheight {}
    update
    list [winfo width .t.f2] [winfo height .t.f2]
} -result {30 60}


test place-8.1 {MasterStructureProc, mapping and unmapping slaves} -setup {
    place forget .t.f2
    place forget .t.f
} -body {
    place .t.f2 -relx 1.0 -rely 1.0 -anchor sw
    update
    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
    lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2]
    wm deiconify .t
    update
    lappend result [winfo ismapped .t.f2]
} -result {1 0 40 30 0 1}
test place-8.2 {MasterStructureProc, mapping and unmapping slaves} -setup {
    place forget .t.f2
    place forget .t.f
} -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
    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
    lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2]
    wm deiconify .t
    update
    lappend result [winfo ismapped .t.f2]
} -result {1 0 42 32 0 1}
destroy .t


test place-9.1 {PlaceObjCmd} -body {
    place
} -returnCodes error -result {wrong # args: should be "place option|pathName args"}
test place-9.2 {PlaceObjCmd} -body {
    place foo
} -returnCodes error -result {wrong # args: should be "place option|pathName args"}
test place-9.3 {PlaceObjCmd} -setup {
    destroy .foo
} -body {
    place .foo bar
} -returnCodes error -result {bad window path name ".foo"}
test place-9.4 {PlaceObjCmd} -setup {
    destroy .foo
} -body {
    place bar .foo
} -cleanup {
    destroy .foo
} -returnCodes error -result {bad window path name ".foo"}
test place-9.5 {PlaceObjCmd} -setup {
    destroy .foo
} -body {
    frame .foo
    place badopt .foo
} -cleanup {
    destroy .foo
} -returnCodes error -result {bad option "badopt": must be configure, forget, info, or slaves}
test place-9.6 {PlaceObjCmd, configure errors} -setup {
    destroy .foo
} -body {
    frame .foo
    place configure .foo
} -cleanup {
    destroy .foo
} -returnCodes ok -result {}
test place-9.7 {PlaceObjCmd, configure errors} -setup {
    destroy .foo
} -body {
    frame .foo
    place configure .foo bar
} -cleanup {
    destroy .foo
} -returnCodes ok -result {}
test place-9.8 {PlaceObjCmd, configure} -setup {
    destroy .foo
} -body {
    frame .foo
    place .foo -x 0 -y 0
    place configure .foo
} -cleanup {
    destroy .foo
} -result [list {-anchor {} {} nw nw} {-bordermode {} {} inside inside} {-height {} {} {} {}} {-in {} {} {} .} {-relheight {} {} {} {}} {-relwidth {} {} {} {}} {-relx {} {} 0 0.0} {-rely {} {} 0 0.0} {-width {} {} {} {}} {-x {} {} 0 0} {-y {} {} 0 0}]
test place-9.9 {PlaceObjCmd, configure} -setup {
    destroy .foo
} -body {
    frame .foo
    place .foo -x 0 -y 0
    place configure .foo -x
} -cleanup {
    destroy .foo
} -result {-x {} {} 0 0}
test place-9.10 {PlaceObjCmd, forget errors} -setup {
    destroy .foo
} -body {
    frame .foo
    place forget .foo bar
} -cleanup {
    destroy .foo
} -returnCodes error -result {wrong # args: should be "place forget pathName"}
test place-9.11 {PlaceObjCmd, info errors} -setup {
    destroy .foo
} -body {
    frame .foo
    place info .foo bar
} -cleanup {
    destroy .foo
} -returnCodes error -result {wrong # args: should be "place info pathName"}
test place-9.12 {PlaceObjCmd, slaves errors} -setup {
    destroy .foo
} -body {
    frame .foo
    place slaves .foo bar
} -cleanup {
    destroy .foo
} -returnCodes error -result {wrong # args: should be "place slaves pathName"}


test place-10.1 {ConfigureSlave} -setup {
    destroy .foo
} -body {
    frame .foo
    place .foo -badopt
} -cleanup {
    destroy .foo
} -returnCodes error -result {unknown option "-badopt"}
test place-10.2 {ConfigureSlave} -setup {
    destroy .foo
} -body {
    frame .foo
    place .foo -anchor
} -cleanup {
    destroy .foo
} -returnCodes error -result {value for "-anchor" missing}
test place-10.3 {ConfigureSlave} -setup {
    destroy .foo
} -body {
    frame .foo
    place .foo -bordermode j
} -cleanup {
    destroy .foo
} -returnCodes error -result {bad bordermode "j": must be inside, outside, or ignore}
test place-10.4 {ConfigureSlave} -setup {
    destroy .foo
} -body {
    frame .foo
    place configure .foo -x 0 -y
} -cleanup {
    destroy .foo
} -returnCodes error -result {value for "-y" missing}
    

test place-11.1 {PlaceObjCmd, slaves command} -setup {
    destroy .foo
} -body {
    frame .foo
    place slaves .foo
} -cleanup {
    destroy .foo
} -result {}
test place-11.2 {PlaceObjCmd, slaves command} -setup {
    destroy .foo .bar
} -body {
    frame .foo
    frame .bar
    place .bar -in .foo
    place slaves .foo
} -cleanup {
    destroy .foo .bar
} -result [list .bar]


test place-12.1 {PlaceObjCmd, forget command} -setup {
    destroy .foo
} -body {
    frame .foo
    place .foo -width 50 -height 50
    update
    set res [winfo ismapped .foo]
    place forget .foo
    update
    lappend res [winfo ismapped .foo]
} -cleanup {
    destroy .foo
} -result {1 0}


test place-13.1 {test respect for internalborder} -setup {
    destroy .pack
} -body {
    toplevel .pack
    wm geometry .pack 200x200
    frame .pack.l -width 15 -height 10
    labelframe .pack.lf -labelwidget .pack.l
    pack .pack.lf -fill both -expand 1
    frame .pack.lf.f
    place .pack.lf.f -x 0 -y 0 -relwidth 1.0 -relheight 1.0
    update
    set res [list [winfo geometry .pack.lf.f]]
    .pack.lf configure -labelanchor e -padx 3 -pady 5
    update
    lappend res [winfo geometry .pack.lf.f]
} -cleanup {
    destroy .pack
} -result {196x188+2+10 177x186+5+7}


test place-14.1 {memory leak testing} -constraints memory -setup {
    destroy .f
    proc getbytes {} {
        set lines [split [memory info] "\n"]
        lindex [lindex $lines 3] 3
    }
    # Repeat each body checking that memory does not increase
    proc stress {args} {
        set res {}
        foreach body $args {
            set end 0
            for {set i 0} {$i < 5} {incr i} {
                uplevel 1 $body
                set tmp $end
                set end [getbytes]
            }
            lappend res [expr {$end - $tmp}]
        }
        return $res
    }
} -body {
    # Test all manners of forgetting a slave
    frame .f
    frame .f.f
    stress {
        place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
        place forget .f.f
    } {
        place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
        pack .f.f
    } {
        place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
        destroy .f
        frame .f
        frame .f.f
    }
} -cleanup {
    destroy .f
    rename getbytes {}
    rename stress {}
} -result {0 0 0}


# cleanup
cleanupTests
return



@


1.11
log
@Fixed a memory leak when a placed widget was forgotten. [Bug 1028888]
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.10 2003/04/01 21:06:49 dgp Exp $
d10 2
a11 1
package require tcltest 2.1
d21 1
d29 3
a31 1
test place-1.1 {Tk_PlaceCmd procedure, "info" option} {
d34 4
a37 2
} {-in .t -x 0 -relx 0 -y 0 -rely 0 -width {} -relwidth {} -height {} -relheight {} -anchor nw -bordermode inside}
test place-1.2 {Tk_PlaceCmd procedure, "info" option} {
d39 2
a40 2
	    -relwidth 0.3 -relheight 0.4 -anchor se -in .t.f  \
	    -bordermode outside
d42 5
a46 2
} {-in .t.f -x 1 -relx 0.1 -y 2 -rely 0.2 -width 3 -relwidth 0.3 -height 4 -relheight 0.4 -anchor se -bordermode outside}
test place-1.3 {Tk_PlaceCmd procedure, "info" option} {
d50 12
a61 11
	    -relwidth 0.3 -relheight {} -anchor w -in ".t.a b"  \
	    -bordermode ignore
    set res [place info .t.f2]
    destroy ".t.a b"
    set res
} {-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} {
    list [catch {place .t.f2 -height abcd} msg] $msg
} {1 {bad screen distance "abcd"}}
test place-2.2 {ConfigureSlave procedure, -height option} {
d63 1
d67 2
a68 2
} {40}
test place-2.3 {ConfigureSlave procedure, -height option} {
d70 1
d76 2
a77 1
} {60}
d79 4
a82 4
test place-3.1 {ConfigureSlave procedure, -relheight option} {
    list [catch {place .t.f2 -relheight abcd} msg] $msg
} {1 {expected floating-point number but got "abcd"}}
test place-3.2 {ConfigureSlave procedure, -relheight option} {
d84 1
d88 2
a89 2
} {40}
test place-3.3 {ConfigureSlave procedure, -relheight option} {
d91 1
d97 1
a97 1
} {60}
d99 14
a112 1
test place-4.1 {ConfigureSlave procedure, bad -in options} {
d114 15
a128 17
    list [catch {place .t.f2 -in .t.f2} msg] $msg
} [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 ."]

test place-5.1 {ConfigureSlave procedure, -relwidth option} {
    list [catch {place .t.f2 -relwidth abcd} msg] $msg
} {1 {expected floating-point number but got "abcd"}}
test place-5.2 {ConfigureSlave procedure, -relwidth option} {
d130 1
d134 2
a135 2
} {75}
test place-5.3 {ConfigureSlave procedure, -relwidth option} {
d137 1
d143 1
a143 1
} {30}
d145 4
a148 4
test place-6.1 {ConfigureSlave procedure, -width option} {
    list [catch {place .t.f2 -width abcd} msg] $msg
} {1 {bad screen distance "abcd"}}
test place-6.2 {ConfigureSlave procedure, -width option} {
d150 1
d154 2
a155 2
} {100}
test place-6.3 {ConfigureSlave procedure, -width option} {
d157 1
d163 1
a163 1
} {30}
d165 2
a166 1
test place-7.1 {ReconfigurePlacement procedure, computing position} {
d168 1
d172 2
a173 2
} {30x60+123+75}
test place-7.2 {ReconfigurePlacement procedure, position rounding} {
d175 1
d179 2
a180 2
} {30x60+49+38}
test place-7.3 {ReconfigurePlacement procedure, position rounding} {
d182 1
d186 2
a187 2
} {30x60+51+42}
test place-7.4 {ReconfigurePlacement procedure, position rounding} {
d189 1
d193 2
a194 2
} {30x60+48+37}
test place-7.5 {ReconfigurePlacement procedure, position rounding} {
d196 1
d200 4
a203 2
} {30x60+52+43}
test place-7.6 {ReconfigurePlacement procedure, position rounding} {
d211 4
a214 3
} {31x20+30+41}
catch {destroy .t.f3}
test place-7.7 {ReconfigurePlacement procedure, computing size} {
d216 1
d220 2
a221 2
} {120 89}
test place-7.8 {ReconfigurePlacement procedure, computing size} {
d223 1
d227 2
a228 2
} {60 40}
test place-7.9 {ReconfigurePlacement procedure, computing size} {
d230 1
d234 2
a235 2
} {70 36}
test place-7.10 {ReconfigurePlacement procedure, computing size} {
d237 1
d242 1
a242 1
} {30 60}
d245 1
a245 1
test place-8.1 {MasterStructureProc, mapping and unmapping slaves} {
d248 1
d261 2
a262 2
} {1 0 40 30 0 1}
test place-8.2 {MasterStructureProc, mapping and unmapping slaves} {
d265 1
d279 3
a281 1
} {1 0 42 32 0 1}
d283 45
a327 37
test place-9.1 {PlaceObjCmd} {
    list [catch {place} msg] $msg
} [list 1 "wrong # args: should be \"place option|pathName args\""]
test place-9.2 {PlaceObjCmd} {
    list [catch {place foo} msg] $msg
} [list 1 "wrong # args: should be \"place option|pathName args\""]
test place-9.3 {PlaceObjCmd} {
    catch {destroy .foo}
    list [catch {place .foo bar} msg] $msg
} [list 1 "bad window path name \".foo\""]
test place-9.4 {PlaceObjCmd} {
    catch {destroy .foo}
    list [catch {place bar .foo} msg] $msg
} [list 1 "bad window path name \".foo\""]
test place-9.5 {PlaceObjCmd} {
    catch {destroy .foo}
    frame .foo
    set res [list [catch {place badopt .foo} msg] $msg]
    destroy .foo
    set res
} [list 1 "bad option \"badopt\": must be configure, forget, info, or slaves"]
test place-9.6 {PlaceObjCmd, configure errors} {
    catch {destroy .foo}
    frame .foo
    set res [list [catch {place configure .foo} msg] $msg]
    destroy .foo
    set res
} [list 0 ""]
test place-9.7 {PlaceObjCmd, configure errors} {
    catch {destroy .foo}
    frame .foo
    set res [list [catch {place configure .foo bar} msg] $msg]
    destroy .foo
    set res
} [list 0 ""]
test place-9.8 {PlaceObjCmd, configure} {
    catch {destroy .foo}
d330 2
a331 1
    set res [place configure .foo]
d333 4
a336 4
    set res
} [list {-anchor {} {} nw nw} {-bordermode {} {} inside inside} {-height {} {} {} {}} {-in {} {} {} .} {-relheight {} {} {} {}} {-relwidth {} {} {} {}} {-relx {} {} 0 0.0} {-rely {} {} 0 0.0} {-width {} {} {} {}} {-x {} {} 0 0} {-y {} {} 0 0}]
test place-9.9 {PlaceObjCmd, configure} {
    catch {destroy .foo}
d339 5
a343 1
    set res [place configure .foo -x]
d345 1
a345 4
    set res
} [list -x {} {} 0 0]
test place-9.10 {PlaceObjCmd, forget errors} {
    catch {destroy .foo}
d347 2
a348 1
    set res [list [catch {place forget .foo bar} msg] $msg]
d350 4
a353 4
    set res
} [list 1 "wrong # args: should be \"place forget pathName\""]
test place-9.11 {PlaceObjCmd, info errors} {
    catch {destroy .foo}
d355 5
a359 1
    set res [list [catch {place info .foo bar} msg] $msg]
d361 1
a361 4
    set res
} [list 1 "wrong # args: should be \"place info pathName\""]
test place-9.12 {PlaceObjCmd, slaves errors} {
    catch {destroy .foo}
d363 2
a364 1
    set res [list [catch {place slaves .foo bar} msg] $msg]
d366 6
a371 5
    set res
} [list 1 "wrong # args: should be \"place slaves pathName\""]
    
test place-10.1 {ConfigureSlave} {
    catch {destroy .foo}
d373 2
a374 1
    set res [list [catch {place .foo -badopt} msg] $msg]
d376 4
a379 4
    set res
} [list 1 "unknown option \"-badopt\""]
test place-10.2 {ConfigureSlave} {
    catch {destroy .foo}
d381 5
a385 1
    set res [list [catch {place .foo -anchor} msg] $msg]
d387 1
a387 4
    set res
} [list 1 "value for \"-anchor\" missing"]
test place-10.3 {ConfigureSlave} {
    catch {destroy .foo}
d389 5
a393 1
    set res [list [catch {place .foo -bordermode j} msg] $msg]
d395 1
a395 4
    set res
} [list 1 "bad bordermode \"j\": must be inside, outside, or ignore"]
test place-10.4 {ConfigureSlave} {
    catch {destroy .foo}
d397 2
a398 1
    set res [list [catch {place configure .foo -x 0 -y} msg] $msg]
d400 6
a405 5
    set res
} [list 1 "value for \"-y\" missing"]
	
test place-11.1 {PlaceObjCmd, slaves command} {
    catch {destroy .foo}
d407 2
a408 1
    set res [place slaves .foo]
d410 4
a413 4
    set res
} {}
test place-11.2 {PlaceObjCmd, slaves command} {
    catch {destroy .foo .bar}
d417 7
a423 1
    set res [place slaves .foo]
d425 1
a425 6
    destroy .bar
    set res
} [list .bar]

test place-12.1 {PlaceObjCmd, forget command} {
    catch {destroy .foo}
d433 1
d435 2
a436 2
    set res
} [list 1 0]
d438 3
a440 1
test place-13.1 {test respect for internalborder} {
d453 1
d455 2
a456 2
    set res
} {196x188+2+10 177x186+5+7}
d458 2
a459 1
test place-14.1 {memory leak testing} -setup {
d478 1
a478 1
} -constraints memory -body {
d494 1
a494 1
} -result {0 0 0} -cleanup {
d498 1
a498 1
}
a499 1
catch {destroy .t}
d504 3
@


1.10
log
@        * tests/all.tcl:                Made better use of a common
        * tests/constraints.tcl:        -loadfile to hold definitions
        * tests/*.test:                 common to all test files.
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.9 2003/03/12 00:09:40 mdejong Exp $
d14 3
d386 41
@


1.9
log
@	* 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]
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.8 2002/11/07 19:10:30 pspjuth Exp $
d11 1
a11 4
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
d386 1
a386 1
::tcltest::cleanupTests
@


1.8
log
@place info did not return all settings,
and didn't make sure the result was a proper list.
Put '-in' first in result to be more consistent with how
grid/pack info behaves. [Bug #635025][Bug #532022]
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.7 2002/07/13 20:28:35 dgp Exp $
d89 6
@


1.8.2.1
log
@Fixed a memory leak when a placed widget was forgotten. [Bug 1028888]
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.8 2002/11/07 19:10:30 pspjuth Exp $
a16 3
# Used for constraining memory leak tests
testConstraint memory [llength [info commands memory]]

a379 41
test place-14.1 {memory leak testing} -setup {
    proc getbytes {} {
        set lines [split [memory info] "\n"]
        lindex [lindex $lines 3] 3
    }
    # Repeat each body checking that memory does not increase
    proc stress {args} {
        set res {}
        foreach body $args {
            set end 0
            for {set i 0} {$i < 5} {incr i} {
                uplevel 1 $body
                set tmp $end
                set end [getbytes]
            }
            lappend res [expr {$end - $tmp}]
        }
        return $res
    }
} -constraints memory -body {
    # Test all manners of forgetting a slave
    frame .f
    frame .f.f
    stress {
        place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
        place forget .f.f
    } {
        place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
        pack .f.f
    } {
        place .f.f -x [expr {1 + 1}] -y [expr {2 + 2}]
        destroy .f
        frame .f
        frame .f.f
    }
} -result {0 0 0} -cleanup {
    destroy .f
    rename getbytes {}
    rename stress {}
}

@


1.7
log
@	* Converted more files to tcltest and factored out common code.
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.6 2001/09/26 21:36:19 pspjuth Exp $
d30 1
a30 1
} {-x 0 -relx 0 -y 0 -rely 0 -width {} -relwidth {} -height {} -relheight {} -anchor nw}
d36 11
a46 1
} {-x 1 -relx 0.1 -y 2 -rely 0.2 -width 3 -relwidth 0.3 -height 4 -relheight 0.4 -anchor se -bordermode outside -in .t.f}
@


1.6
log
@Added labelframe widget. TIP#18.
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.5 2000/08/10 00:21:08 ericm Exp $
d10 6
a15 9
if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

foreach i [winfo children .] {
    destroy $i
}
wm geometry . {}
raise .
@


1.6.2.1
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@d8 1
a8 1
# RCS: @@(#) $Id$
d10 9
a18 6
package require tcltest 2.1
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
tcltest::loadTestedCommands
@


1.5
log
@* doc/SetOptions.3: Updated documentation to reflect support for
TK_OPTION_NULL_OK for TK_OPTION_DOUBLE and TK_OPTION_PIXELS.

* generic/tkConfig.c: Added for TK_OPTION_NULL_OK support for
TK_OPTION_DOUBLE and TK_OPTION_PIXELS.

* doc/place.n: Updated, reformatted manual entry.

* tests/place.test: Added many tests.

* generic/tkPlace.c (Tk_PlaceObjCmd): Updated to use Tk
widget-option management facilities to manage place options (-x,
-y, etc.), which simplifies the placer code.  Added support for
[place configure pathName] and [place configure pathName -option],
similar to the behavior of the configure subcommand supported by
widgets.
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.4 2000/08/08 19:21:20 ericm Exp $
d355 17
@


1.5.2.1
log
@sync with head
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.6 2001/09/26 21:36:19 pspjuth Exp $
a354 17

test place-13.1 {test respect for internalborder} {
    toplevel .pack
    wm geometry .pack 200x200
    frame .pack.l -width 15 -height 10
    labelframe .pack.lf -labelwidget .pack.l
    pack .pack.lf -fill both -expand 1
    frame .pack.lf.f
    place .pack.lf.f -x 0 -y 0 -relwidth 1.0 -relheight 1.0
    update
    set res [list [winfo geometry .pack.lf.f]]
    .pack.lf configure -labelanchor e -padx 3 -pady 5
    update
    lappend res [winfo geometry .pack.lf.f]
    destroy .pack
    set res
} {196x188+2+10 177x186+5+7}
@


1.4
log
@* tests/place.test: Extended test suite to test error returns from
[place].

* generic/tkInt.h: Replaced Tk_PlaceCmd prototype with
Tk_PlaceObjCmd prototype.

* generic/tkWindow.c: Updated [place] command entry to use new
Tcl_Obj interface.

* generic/tkPlace.c (Tk_PlaceObjCmd): Tcl_Obj'ified [place] command.
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.3 1999/04/16 01:51:40 stanton Exp $
d80 5
a84 1
} {1 {can't place .t.f2 relative to itself}}
d250 1
a250 1
} [list 1 "wrong # args: should be \"place configure pathName option value ?option value ...?\""]
d257 18
a274 2
} [list 1 "wrong # args: should be \"place configure pathName option value ?option value ...?\""]
test place-9.8 {PlaceObjCmd, forget errors} {
d281 1
a281 1
test place-9.9 {PlaceObjCmd, info errors} {
d288 1
a288 1
test place-9.10 {PlaceObjCmd, slaves errors} {
d295 1
a295 1

d302 1
a302 1
} [list 1 "bad option \"-badopt\": must be -anchor, -bordermode, -height, -in, -relheight, -relwidth, -relx, -rely, -width, -x, or -y"]
d309 1
a309 1
} [list 1 "value missing for option \"-anchor\""]
d316 8
a323 1
} [list 1 "bad border mode \"j\": must be ignore, inside, or outside"]
d325 30
@


1.3
log
@* Merged 8.1 branch into the main trunk
@
text
@d8 1
a8 1
# RCS: @@(#) $Id$
d219 80
a303 13













@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d5 2
a6 3
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d10 2
a11 2
if {[info procs test] != "test"} {
    source defs
d220 17
a236 1
concat
@


1.1
log
@Initial revision
@
text
@d9 1
a9 1
# SCCS: @@(#) place.test 1.6 96/02/16 10:56:01
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: place.test,v 1.2 1998/09/14 18:23:49 stanton Exp $
@


1.1.4.2
log
@Updated the testsuite to use "test" namespace and commandline args
to control verbose  level and which tests get run.  Tests now work from
any working dir.
@
text
@a4 2
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
d6 4
a9 1
# RCS: @@(#) $Id: place.test,v 1.1.4.1 1998/09/30 02:18:51 stanton Exp $
d11 2
a12 2
if {[lsearch [namespace children] ::test] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
d221 1
a221 4

# cleanup
::test::cleanupTests
return
@


1.1.4.3
log
@- changed ::test to ::tcltest
- made many tests more atomic (still more work to do here)
- defs.tcl is now identicle for tcl and tk
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.1.4.2 1999/03/11 18:51:04 hershey Exp $
d10 1
a10 1
if {[lsearch [namespace children] ::tcltest] == -1} {
d222 1
a222 1
::tcltest::cleanupTests
a223 12












@


1.1.4.4
log
@lint:  changed a tcltest namespace variable name from tmpDir to
       workingDir.
changes:  made more tests atomic.
README is now updated to match new test suite features.
@
text
@d8 1
a8 1
# RCS: @@(#) $Id: place.test,v 1.1.4.3 1999/03/24 01:17:02 hershey Exp $
a223 1

@


