head	1.13;
access;
symbols
	core-8-5-9:1.10
	core-8-5-8:1.10
	macosx-cocoa-merge:1.13
	macosx-cocoa-premerge:1.13
	macosx-carbon-freeze:1.13
	core-8-5-7:1.10
	core-8-5-6:1.10
	core-8-6-b1:1.12
	core-8-6-a3:1.12
	core-8-5-5:1.10
	core-8-6-a2:1.12
	core-8-5-4:1.10
	core-8-5-3:1.10
	core-8-6-a1:1.10
	core-8-4-19:1.7
	core-8-5-branch:1.10.0.4
	core-8-5-2:1.10
	core-8-4-18:1.7
	core-8-5-1:1.10
	core-8-4-17:1.7
	core-8-5-0:1.10
	core-8-5-b3:1.10
	core-8-5-b2:1.10
	core-8-4-16:1.7
	core-8-5-b1:1.10
	core-stablilizer-merge:1.10
	core-stabilizer-branch:1.10.0.2
	core-stabilizer-merge:1.10
	core-8-4-15:1.7
	core-8-5-a6:1.10
	core-8-5-a5:1.10
	core-8-4-14:1.7
	core-8-5-a4:1.10
	core-8-4-13:1.7
	core-8-4-12:1.7
	core-8-4-11:1.7
	core-8-5-a3:1.10
	core-8-4-10:1.7
	core-8-4-9-branch:1.7.0.4
	core-8-5-a2:1.10
	core-8-4-9:1.7
	core-8-4-8:1.7
	core-8-4-7:1.7
	core-8-5-a1:1.8
	core-8-4-6:1.7
	core-8-4-5:1.7
	mistachkin-dev-branch:1.8.0.2
	core-8-4-4:1.7
	core-8-4-3:1.7
	core-8-4-branch:1.7.0.2
	core-8-4-2:1.7
	core-8-4-1:1.7
	core-8-3-5:1.5
	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.5
	macosx-8-4-branch:1.6.0.2
	macosx-8-4-branchpoint:1.6
	core-8-4-a3:1.6
	core-8-3-3:1.5
	dgp-privates-into-namespace:1.5.0.16
	tclpro-1-5-0:1.5
	core-8-4-win-speedup:1.5.0.14
	core-8-4-a2:1.5
	tclpro-1-4-1:1.5
	tclpro-1-4-0:1.5
	core-8-3-2:1.5
	ajuba-ajuba2-2-1-base:1.5
	ajuba-ajuba2-2-0:1.5
	core-8-4-a1:1.5
	core-8-3-1-branch:1.5.0.12
	core-8-3-1:1.5
	scriptics-sc-2-0-b5:1.5
	scriptics-sc-2-0-fixed:1.5
	scriptics-sc-2-0-b2:1.5
	scriptics-sc-2-0-b1:1.5
	core-8-3-0:1.5
	core-8-3-b2:1.5
	core-8-3-b1:1.5
	scriptics-sc-1-1:1.5
	scriptics-sc-1-1-b1:1.5
	core-8-2-3:1.5
	scriptics-sc-1-1-branch:1.5.0.10
	scriptics-sc-1-1-base:1.5
	scriptics-sc-1-0:1.5
	scriptics-sc-1-0-branch:1.5.0.8
	scriptics-sc-1-0-base:1.5
	core-8-2-2:1.5
	core-8-2-1:1.5
	scriptics-bc-1-0-b1:1.5
	core-8-2-1-branch:1.5.0.6
	scriptics-tclpro-1-3-0:1.5
	core-8-2-0:1.5
	core-8-2-b3-branch:1.5.0.2
	core-8-2-b3-base:1.5
	scriptics-tclpro-1-3-b4:1.5
	core-8-2-b2:1.5
	scriptics-tclpro-1-3-b3:1.5
	core-8-2-b1:1.5
	scriptics-tclpro-1-3-b2:1.5
	merge-to-mainline-5/21/99:1.5
	scriptics-tclpro-1-3-b2-branch:1.5.0.4
	core-8-1-1:1.5
	scriptics-tclpro-1-3-b1:1.5
	core-8-1-1-base:1.5
	core-8-1-0:1.5
	merge-to-mainline-4-29-99:1.5
	merge-to-mainline-4-23-99:1.5
	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.6
	core-8-1-b2:1.1.4.3
	dev-8-1-stubs-branch:1.1.4.2.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.13
date	2009.01.13.01.46.06;	author patthoyts;	state Exp;
branches;
next	1.12;

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

1.11
date	2008.07.23.23.24.25;	author nijtmans;	state Exp;
branches;
next	1.10;

1.10
date	2004.06.24.12.45.43;	author dkf;	state Exp;
branches;
next	1.9;

1.9
date	2004.05.23.17.34.48;	author dkf;	state Exp;
branches;
next	1.8;

1.8
date	2003.04.01.21.06.45;	author dgp;	state Exp;
branches;
next	1.7;

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

1.6
date	2001.05.21.14.07.33;	author tmh;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	99.04.21.21.53.29;	author rjohnson;	state Exp;
branches
	1.5.14.1
	1.5.16.1;
next	1.4;

1.4
date	99.04.19.23.54.56;	author hershey;	state Exp;
branches;
next	1.3;

1.3
date	99.04.16.01.51.39;	author stanton;	state Exp;
branches
	1.3.2.1;
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.14;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

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

1.1.4.2
date	99.02.16.06.00.42;	author lfb;	state Exp;
branches;
next	1.1.4.3;

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

1.1.4.4
date	99.03.24.01.16.58;	author hershey;	state Exp;
branches;
next	1.1.4.5;

1.1.4.5
date	99.03.24.02.54.53;	author hershey;	state Exp;
branches;
next	1.1.4.6;

1.1.4.6
date	99.03.26.00.08.02;	author hershey;	state Exp;
branches;
next	;

1.3.2.1
date	99.04.21.02.31.08;	author rjohnson;	state Exp;
branches;
next	;

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

1.5.16.1
date	2001.07.03.20.01.09;	author dgp;	state Exp;
branches;
next	;

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


desc
@@


1.13
log
@Tk tests that create images need to be independent of the interpreter environment.
@
text
@# This file is a Tcl script to test menubuttons in Tk.  It is
# organized in the standard fashion for Tcl tests.
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @@(#) $Id: menubut.test,v 1.12 2008/08/18 16:09:10 aniap Exp $

# XXX This test file is woefully incomplete right now.  If any part
# XXX of a procedure has tests then the whole procedure has tests,
# XXX but many procedures have no tests.

package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
imageInit

# Create entries in the option database to be sure that geometry options
# like border width have predictable values.

option add *Menubutton.borderWidth 2
option add *Menubutton.highlightThickness 2
option add *Menubutton.font {Helvetica -12 bold}
option add *Button.borderWidth 2
option add *Button.highlightThickness 2
option add *Button.font {Helvetica -12 bold}


menubutton .mb -text "Test"
pack .mb
update
test menubutton-1.1 {configuration options} -body {
    .mb configure -activebackground #012345
    .mb cget -activebackground
} -cleanup {
    .mb configure -activebackground [lindex [.mb configure -activebackground] 3]
} -result {#012345}
test menubutton-1.2 {configuration options} -body {
    .mb configure -activebackground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menubutton-1.3 {configuration options} -body {
    .mb configure -activeforeground #ff0000
    .mb cget -activeforeground
} -cleanup {
    .mb configure -activeforeground [lindex [.mb configure -activeforeground] 3]
} -result {#ff0000}
test menubutton-1.4 {configuration options} -body {
    .mb configure -activeforeground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menubutton-1.5 {configuration options} -body {
    .mb configure -anchor nw
    .mb cget -anchor
} -cleanup {
    .mb configure -anchor [lindex [.mb configure -anchor] 3]
} -result {nw}
test menubutton-1.6 {configuration options} -body {
    .mb configure -anchor bogus
} -returnCodes error -result {bad anchor "bogus": must be n, ne, e, se, s, sw, w, nw, or center}
test menubutton-1.7 {configuration options} -body {
    .mb configure -background #ff0000
    .mb cget -background
} -cleanup {
    .mb configure -background [lindex [.mb configure -background] 3]
} -result {#ff0000}
test menubutton-1.8 {configuration options} -body {
    .mb configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menubutton-1.9 {configuration options} -body {
    .mb configure -bd 4
    .mb cget -bd
} -cleanup {
    .mb configure -bd [lindex [.mb configure -bd] 3]
} -result {4}
test menubutton-1.10 {configuration options} -body {
    .mb configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test menubutton-1.11 {configuration options} -body {
    .mb configure -bg #ff0000
    .mb cget -bg
} -cleanup {
    .mb configure -bg [lindex [.mb configure -bg] 3]
} -result {#ff0000}
test menubutton-1.12 {configuration options} -body {
    .mb configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test menubutton-1.13 {configuration options} -body {
    .mb configure -bitmap questhead
    .mb cget -bitmap
} -cleanup {
    .mb configure -bitmap [lindex [.mb configure -bitmap] 3]
} -result {questhead}
test menubutton-1.14 {configuration options} -body {
    .mb configure -bitmap badValue
} -returnCodes error -result {bitmap "badValue" not defined}
test menubutton-1.15 {configuration options} -body {
    .mb configure -borderwidth 1.3
    .mb cget -borderwidth
} -cleanup {
    .mb configure -borderwidth [lindex [.mb configure -borderwidth] 3]
} -result {1}
test menubutton-1.16 {configuration options} -body {
    .mb configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
test menubutton-1.17 {configuration options} -body {
    .mb configure -cursor arrow
    .mb cget -cursor
} -cleanup {
    .mb configure -cursor [lindex [.mb configure -cursor] 3]
} -result {arrow}
test menubutton-1.18 {configuration options} -body {
    .mb configure -cursor badValue
} -returnCodes error -result {bad cursor spec "badValue"}
test menubutton-1.19 {configuration options} -body {
    .mb configure -direction below
    .mb cget -direction
} -cleanup {
    .mb configure -direction [lindex [.mb configure -direction] 3]
} -result {below}
test menubutton-1.20 {configuration options} -body {
    .mb configure -direction badValue
} -returnCodes error -result {bad direction "badValue": must be above, below, flush, left, or right}
test menubutton-1.21 {configuration options} -body {
    .mb configure -disabledforeground #00ff00
    .mb cget -disabledforeground
} -cleanup {
    .mb configure -disabledforeground [lindex [.mb configure -disabledforeground] 3]
} -result {#00ff00}
test menubutton-1.22 {configuration options} -body {
    .mb configure -disabledforeground xyzzy
} -returnCodes error -result {unknown color name "xyzzy"}
test menubutton-1.23 {configuration options} -body {
    .mb configure -fg #110022
    .mb cget -fg
} -cleanup {
    .mb configure -fg [lindex [.mb configure -fg] 3]
} -result {#110022}
test menubutton-1.24 {configuration options} -body {
    .mb configure -fg bogus
} -returnCodes error -result {unknown color name "bogus"}
test menubutton-1.25 {configuration options} -body {
    .mb configure -font {Helvetica 12}
    .mb cget -font
} -cleanup {
    .mb configure -font [lindex [.mb configure -font] 3]
} -result {Helvetica 12}
test menubutton-1.26 {configuration options} -body {
    .mb configure -foreground #110022
    .mb cget -foreground
} -cleanup {
    .mb configure -foreground [lindex [.mb configure -foreground] 3]
} -result {#110022}
test menubutton-1.27 {configuration options} -body {
    .mb configure -foreground bogus
} -returnCodes error -result {unknown color name "bogus"}
test menubutton-1.28 {configuration options} -body {
    .mb configure -height 18
    .mb cget -height
} -cleanup {
    .mb configure -height [lindex [.mb configure -height] 3]
} -result {18}
test menubutton-1.29 {configuration options} -body {
    .mb configure -height 20.0
} -returnCodes error -result {expected integer but got "20.0"}
test menubutton-1.30 {configuration options} -body {
    .mb configure -highlightbackground #112233
    .mb cget -highlightbackground
} -cleanup {
    .mb configure -highlightbackground [lindex [.mb configure -highlightbackground] 3]
} -result {#112233}
test menubutton-1.31 {configuration options} -body {
    .mb configure -highlightbackground ugly
} -returnCodes error -result {unknown color name "ugly"}
test menubutton-1.32 {configuration options} -body {
    .mb configure -highlightcolor #110022
    .mb cget -highlightcolor
} -cleanup {
    .mb configure -highlightcolor [lindex [.mb configure -highlightcolor] 3]
} -result {#110022}
test menubutton-1.33 {configuration options} -body {
    .mb configure -highlightcolor bogus
} -returnCodes error -result {unknown color name "bogus"}
test menubutton-1.34 {configuration options} -body {
    .mb configure -highlightthickness 18
    .mb cget -highlightthickness
} -cleanup {
    .mb configure -highlightthickness [lindex [.mb configure -highlightthickness] 3]
} -result {18}
test menubutton-1.35 {configuration options} -body {
    .mb configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
test menubutton-1.36 {configuration options} -constraints {
    testImageType
} -setup {
    catch {image delete image1}
    image create test image1
} -body {
    .mb configure -image image1
    .mb cget -image
} -cleanup {
    .mb configure -image [lindex [.mb configure -image] 3]
    image create test image1
} -result {image1}
test menubutton-1.37 {configuration options} -setup {
    catch {image delete bogus}
} -body {
    .mb configure -image bogus
} -cleanup {
    .mb configure -image [lindex [.mb configure -image] 3]
} -returnCodes error -result {image "bogus" doesn't exist}
test menubutton-1.38 {configuration options} -body {
    .mb configure -indicatoron yes
    .mb cget -indicatoron
} -cleanup {
    .mb configure -indicatoron [lindex [.mb configure -indicatoron] 3]
} -result {1}
test menubutton-1.39 {configuration options} -body {
    .mb configure -indicatoron no_way
} -returnCodes error -result {expected boolean value but got "no_way"}
test menubutton-1.40 {configuration options} -body {
    .mb configure -justify right
    .mb cget -justify
} -cleanup {
    .mb configure -justify [lindex [.mb configure -justify] 3]
} -result {right}
test menubutton-1.41 {configuration options} -body {
    .mb configure -justify bogus
} -returnCodes error -result {bad justification "bogus": must be left, right, or center}
test menubutton-1.42 {configuration options} -body {
    .mb configure -menu {any old string}
    .mb cget -menu
} -cleanup {
    .mb configure -menu [lindex [.mb configure -menu] 3]
} -result {any old string}
test menubutton-1.43 {configuration options} -body {
    .mb configure -padx 12
    .mb cget -padx
} -cleanup {
    .mb configure -padx [lindex [.mb configure -padx] 3]
} -result {12}
test menubutton-1.44 {configuration options} -body {
    .mb configure -padx 420x
} -returnCodes error -result {bad screen distance "420x"}
test menubutton-1.45 {configuration options} -body {
    .mb configure -pady 12
    .mb cget -pady
} -cleanup {
    .mb configure -pady [lindex [.mb configure -pady] 3]
} -result {12}
test menubutton-1.46 {configuration options} -body {
    .mb configure -pady 420x
} -returnCodes error -result {bad screen distance "420x"}
test menubutton-1.47 {configuration options} -body {
    .mb configure -relief groove
    .mb cget -relief
} -cleanup {
    .mb configure -relief [lindex [.mb configure -relief] 3]
} -result {groove}
test menubutton-1.48 {configuration options} -body {
    .mb configure -relief 1.5
} -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}
test menubutton-1.49 {configuration options} -body {
    .mb configure -state normal
    .mb cget -state
} -cleanup {
    .mb configure -state [lindex [.mb configure -state] 3]
} -result {normal}
test menubutton-1.50 {configuration options} -body {
    .mb configure -state bogus
} -returnCodes error -result {bad state "bogus": must be active, disabled, or normal}
test menubutton-1.51 {configuration options} -body {
    .mb configure -takefocus {any string}
    .mb cget -takefocus
} -cleanup {
    .mb configure -takefocus [lindex [.mb configure -takefocus] 3]
} -result {any string}
test menubutton-1.52 {configuration options} -body {
    .mb configure -text {Sample text}
    .mb cget -text
} -cleanup {
    .mb configure -text [lindex [.mb configure -text] 3]
} -result {Sample text}
test menubutton-1.53 {configuration options} -body {
    .mb configure -textvariable i
    .mb cget -textvariable
} -cleanup {
    .mb configure -textvariable [lindex [.mb configure -textvariable] 3]
} -result {i}
test menubutton-1.54 {configuration options} -body {
    .mb configure -underline 5
    .mb cget -underline
} -cleanup {
    .mb configure -underline [lindex [.mb configure -underline] 3]
} -result {5}
test menubutton-1.55 {configuration options} -body {
    .mb configure -underline 3p
} -returnCodes error -result {expected integer but got "3p"}
test menubutton-1.56 {configuration options} -body {
    .mb configure -width 402
    .mb cget -width
} -cleanup {
    .mb configure -width [lindex [.mb configure -width] 3]
} -result {402}
test menubutton-1.57 {configuration options} -body {
    .mb configure -width 3p
} -returnCodes error -result {expected integer but got "3p"}
test menubutton-1.58 {configuration options} -body {
    .mb configure -wraplength 100
    .mb cget -wraplength
} -cleanup {
    .mb configure -wraplength [lindex [.mb configure -wraplength] 3]
} -result {100}
test menubutton-1.59 {configuration options} -body {
    .mb configure -wraplength 6x
} -returnCodes error -result {bad screen distance "6x"}


deleteWindows
menubutton .mb -text "Test"
pack .mb
update
test menubutton-2.1 {Tk_MenubuttonCmd procedure} -body {
    menubutton
} -returnCodes error -result {wrong # args: should be "menubutton pathName ?-option value ...?"}
test menubutton-2.2 {Tk_MenubuttonCmd procedure} -body {
    menubutton foo
} -returnCodes error -result {bad window path name "foo"}
test menubutton-2.3 {Tk_MenubuttonCmd procedure} -body {
    catch {destroy .mb}
    menubutton .mb
    winfo class .mb
} -result {Menubutton}
test menubutton-2.4 {Tk_ButtonCmd procedure} -setup {
    destroy .mb
} -body {
    menubutton .mb -gorp foo
} -returnCodes error -result {unknown option "-gorp"}
test menubutton-2.5 {Tk_ButtonCmd procedure} -setup {
    destroy .mb
} -body {
    catch {menubutton .mb -gorp foo}
    winfo exists .mb
} -result 0


deleteWindows
menubutton .mb -text "Test Menu"
pack .mb
test menubutton-3.1 {MenuButtonWidgetCmd procedure} -body {
    .mb
} -returnCodes error -result {wrong # args: should be ".mb option ?arg ...?"}
test menubutton-3.2 {ButtonWidgetCmd procedure, "cget" option} -body {
    .mb c
} -returnCodes error -result {ambiguous option "c": must be cget or configure}
test menubutton-3.3 {ButtonWidgetCmd procedure, "cget" option} -body {
    .mb cget
} -returnCodes error -result {wrong # args: should be ".mb cget option"}
test menubutton-3.4 {ButtonWidgetCmd procedure, "cget" option} -body {
    .mb cget a b
} -returnCodes error -result {wrong # args: should be ".mb cget option"}
test menubutton-3.5 {ButtonWidgetCmd procedure, "cget" option} -body {
    .mb cget -gorp
} -returnCodes error -result {unknown option "-gorp"}
test menubutton-3.6 {ButtonWidgetCmd procedure, "cget" option} -body {
    .mb configure -highlightthickness 3
    .mb cget -highlightthickness
} -result {3}
test menubutton-3.7 {ButtonWidgetCmd procedure, "configure" option} -body {
    llength [.mb configure]
} -result {33}
test menubutton-3.8 {ButtonWidgetCmd procedure, "configure" option} -body {
    .mb configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
test menubutton-3.9 {ButtonWidgetCmd procedure, "configure" option} -body {
    .mb co -bg #ffffff -fg
} -returnCodes error -result {value for "-fg" missing}
test menubutton-3.10 {ButtonWidgetCmd procedure, "configure" option} -body {
    .mb configure -fg #123456
    .mb configure -bg #654321
    lindex [.mb configure -fg] 4
} -result {#123456}
test menubutton-3.11 {ButtonWidgetCmd procedure, "configure" option} -body {
    .mb foobar
} -returnCodes error -result {bad option "foobar": must be cget or configure}
deleteWindows

# XXX Need to add tests for several procedures here.   The tests for   XXX
# XXX ConfigureMenuButton aren't complete either.                      XXX

test menubutton-4.1 {ConfigureMenuButton procedure} -setup {
    deleteWindows
} -body {
    button .mb1 -text "Menubutton 1"
    .mb1 configure -width 1i
} -cleanup {
    deleteWindows
} -returnCodes error -result {expected integer but got "1i"} 
test menubutton-4.2 {ConfigureMenuButton procedure} -setup {
    deleteWindows
} -body {
    button .mb1 -text "Menubutton 1"
    catch {.mb1 configure -width 1i}
    return $errorInfo
} -cleanup {
    deleteWindows
} -result {expected integer but got "1i"
    (processing -width option)
    invoked from within
".mb1 configure -width 1i"}

test menubutton-4.3 {ConfigureMenuButton procedure} -setup {
    deleteWindows
} -body {
    button .mb1 -text "Menubutton 1"
    .mb1 configure -height 0.5c
} -cleanup {
    deleteWindows
} -returnCodes error -result {expected integer but got "0.5c"}
test menubutton-4.4 {ConfigureMenuButton procedure} -setup {
    deleteWindows
} -body {
    button .mb1 -text "Menubutton 1"
    catch {.mb1 configure -height 0.5c}
    return $errorInfo
} -cleanup {
    deleteWindows
} -result {expected integer but got "0.5c"
    (processing -height option)
    invoked from within
".mb1 configure -height 0.5c"}

test menubutton-4.5 {ConfigureMenuButton procedure} -setup {
    deleteWindows
} -body {
    button .mb1 -bitmap questhead
    .mb1 configure -width abc
} -cleanup {
    deleteWindows
} -returnCodes error -result {bad screen distance "abc"}
test menubutton-4.6 {ConfigureMenuButton procedure} -setup {
    deleteWindows
} -body {
    button .mb1 -bitmap questhead
    catch {.mb1 configure -width abc}
    return $errorInfo
} -cleanup {
    deleteWindows
} -result {bad screen distance "abc"
    (processing -width option)
    invoked from within
".mb1 configure -width abc"}

test menubutton-4.7 {ConfigureMenuButton procedure} -constraints {
    testImageType 
} -setup {
    deleteWindows
    imageCleanup
} -body {
    image create test image1
    button .mb1 -image image1
    .mb1 configure -height 0.5x
} -cleanup {
    deleteWindows
    imageCleanup
} -returnCodes error -result {bad screen distance "0.5x"}
test menubutton-4.8 {ConfigureMenuButton procedure} -constraints {
    testImageType 
} -setup {
    deleteWindows
    imageCleanup
} -body {
    image create test image1
    button .mb1 -image image1
    catch {.mb1 configure -height 0.5x}
    return $errorInfo
} -cleanup {
    deleteWindows
    imageCleanup
} -result {bad screen distance "0.5x"
    (processing -height option)
    invoked from within
".mb1 configure -height 0.5x"}

test menubutton-4.9 {ConfigureMenuButton procedure} -constraints {
    nonPortable fonts
} -setup {
    deleteWindows
} -body {
    button .mb1 -text "Sample text" -width 10 -height 2
    pack .mb1
    set result "[winfo reqwidth .mb1] [winfo reqheight .mb1]"
    .mb1 configure -bitmap questhead
    lappend result [winfo reqwidth .mb1] [winfo reqheight .mb1]
} -cleanup {
    deleteWindows
} -result {102 46 20 12}

test menubutton-4.10 {ConfigureMenuButton procedure - bad direction} -setup {
    deleteWindows
} -body {
    menubutton .mb -text "Test"
    .mb configure -direction badValue 
} -cleanup {
    deleteWindows
} -returnCodes error -result {bad direction "badValue": must be above, below, flush, left, or right}
test menubutton-4.11 {ConfigureMenuButton procedure - bad direction} -setup {
    deleteWindows
} -body {
    menubutton .mb -text "Test"
    catch {.mb configure -direction badValue}
    list [.mb cget -direction] [destroy .mb]
} -cleanup {
    deleteWindows
} -result {below {}}



# XXX Need to add tests for several procedures here. XXX

test menubutton-5.1 {MenuButtonEventProc procedure} -setup {
    deleteWindows
    set x {}
} -body {
    menubutton .mb1 -bg #543210
    rename .mb1 .mb2
    lappend x [winfo children .]
    lappend x [.mb2 cget -bg]
    destroy .mb1
    lappend x [info command .mb*] [winfo children .]
} -cleanup {
    deleteWindows
} -result {.mb1 #543210 {} {}}


test menubutton-6.1 {MenuButtonCmdDeletedProc procedure} -setup {
    deleteWindows
} -body {
    menubutton .mb1
    rename .mb1 {}
    list [info command .mb*] [winfo children .]
} -cleanup {
    deleteWindows
} -result {{} {}}


test menubutton-7.1 {ComputeMenuButtonGeometry procedure} -constraints {
    testImageType 
} -setup {
    deleteWindows
    image create test image1
} -body {
    menubutton .mb -image image1 -bd 4 -highlightthickness 0
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
    imageCleanup
} -result {38 23}
test menubutton-7.2 {ComputeMenuButtonGeometry procedure} -constraints {
    testImageType 
} -setup {
    deleteWindows
    image create test image1
} -body {
    menubutton .mb -image image1 -bd 1 -highlightthickness 2
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
    imageCleanup
} -result {36 21}
test menubutton-7.3 {ComputeMenuButtonGeometry procedure} -constraints {
    testImageType 
} -setup {
    deleteWindows
    image create test image1
} -body {
    menubutton .mb -image image1 -bd 0 -highlightthickness 2 -padx 5 -pady 5
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
    imageCleanup
} -result {34 19}
test menubutton-7.4 {ComputeMenuButtonGeometry procedure} -constraints {
    testImageType 
} -setup {
    deleteWindows
    image create test image1
} -body {
    menubutton .mb -image image1 -bd 2 -relief raised -width 40 \
        -highlightthickness 2
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
    imageCleanup
} -result {48 23}
test menubutton-7.5 {ComputeMenuButtonGeometry procedure} -constraints {
    testImageType 
} -setup {
    deleteWindows
    image create test image1
} -body {
    menubutton .mb -image image1 -bd 2 -relief raised -height 30 \
        -highlightthickness 2
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
    imageCleanup
} -result {38 38}
test menubutton-7.6 {ComputeMenuButtonGeometry procedure} -setup {
    deleteWindows
} -body {
    menubutton .mb -bitmap question -bd 2 -relief raised \
        -highlightthickness 2
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {25 35}
test menubutton-7.7 {ComputeMenuButtonGeometry procedure} -setup {
    deleteWindows
} -body {
    menubutton .mb -bitmap question -bd 2 -relief raised -width 40 \
        -highlightthickness 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {46 33}
test menubutton-7.8 {ComputeMenuButtonGeometry procedure} -setup {
    deleteWindows
} -body {
    menubutton .mb -bitmap question -bd 2 -relief raised -height 50 \
        -highlightthickness 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {23 56}
test menubutton-7.9 {ComputeMenuButtonGeometry procedure} -constraints {
    fonts
} -setup {
    deleteWindows
} -body {
    menubutton .mb -text String -bd 2 -relief raised -padx 0 -pady 0 \
        -highlightthickness 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {42 20}
test menubutton-7.10 {ComputeMenuButtonGeometry procedure} -constraints {
    fonts
} -setup {
    deleteWindows
} -body {
    menubutton .mb -text String -bd 2 -relief raised -width 20 \
        -padx 0 -pady 0 -highlightthickness 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {146 20}
test menubutton-7.11 {ComputeMenuButtonGeometry procedure} -constraints {
    fonts
} -setup {
    deleteWindows
} -body {
    menubutton .mb -text String -bd 2 -relief raised -height 2 \
        -padx 0 -pady 0 -highlightthickness 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {42 34}
test menubutton-7.12 {ComputeMenuButtonGeometry procedure} -constraints {
    fonts
} -setup {
    deleteWindows
} -body {
    menubutton .mb -text String -bd 2 -relief raised -padx 10 -pady 5 \
        -highlightthickness 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {62 30}
test menubutton-7.13 {ComputeMenuButtonGeometry procedure} -constraints {
    nonPortable fonts
} -setup {
    deleteWindows
} -body {
    menubutton .mb -text String -bd 2 -relief raised \
        -highlightthickness 1 -indicatoron 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
} -result {78 28}
test menubutton-7.14 {ComputeMenuButtonGeometry procedure} -constraints {
    testImageType unix nonPortable
} -setup {
    deleteWindows
    image create test image1
} -body {
    # The following test is non-portable because the indicator's pixel
    # size varies to maintain constant absolute size.

    menubutton .mb -image image1 -bd 2 -relief raised \
        -highlightthickness 2 -indicatoron 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
    imageCleanup
} -result {64 23}
test menubutton-7.15 {ComputeMenuButtonGeometry procedure} -constraints {
    testImageType win nonPortable
} -setup {
    deleteWindows
    image create test image1
} -body {
    # The following test is non-portable because the indicator's pixel
    # size varies to maintain constant absolute size.

    menubutton .mb -image image1 -bd 2 -relief raised \
        -highlightthickness 2 -indicatoron 1
    pack .mb
    list [winfo reqwidth .mb] [winfo reqheight .mb]
} -cleanup {
    deleteWindows
    imageCleanup
} -result {65 23}


test menubutton-8.1 {menubutton vs hidden commands} -body {
    set l [interp hidden]
    deleteWindows
    menubutton .mb
    interp hide {} .mb
    destroy .mb
    set res1 [list [winfo children .] [interp hidden]]
    set res2 [list {} $l]
    expr {$res1 eq $res2}
} -result 1



deleteWindows
option clear
imageFinish

# cleanup
cleanupTests
return

# Local variables:
# mode: tcl
# End:@


1.12
log
@Update to tcltest2
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.11 2008/07/23 23:24:25 nijtmans Exp $
d19 1
d459 1
a459 1
    eval image delete [image names]
d466 1
a466 1
    eval image delete [image names]
d472 1
a472 1
    eval image delete [image names]
d480 1
a480 1
    eval image delete [image names]
d559 1
a559 1
    eval image delete [image names]
d572 1
a572 1
    eval image delete [image names]
d585 1
a585 1
    eval image delete [image names]
d599 1
a599 1
    eval image delete [image names]
d613 1
a613 1
    eval image delete [image names]
d720 1
a720 1
    eval image delete [image names]
d737 1
a737 1
    eval image delete [image names]
d756 1
d762 3
a764 2


@


1.11
log
@fix [2021443] inconsistant "wrong # args" messages (for Tk)
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.10 2004/06/24 12:45:43 dkf Exp $
d15 1
a15 1
package require tcltest 2.1
d18 1
d30 173
a202 2
eval image delete [image names]
if {[testConstraint testImageType]} {
d204 116
a319 1
}
d323 7
a329 60
set i 1
foreach test {
    {-activebackground #012345 #012345 non-existent
	    {unknown color name "non-existent"}}
    {-activeforeground #ff0000 #ff0000 non-existent
	    {unknown color name "non-existent"}}
    {-anchor nw nw bogus {bad anchor "bogus": must be n, ne, e, se, s, sw, w, nw, or center}}
    {-background #ff0000 #ff0000 non-existent
	    {unknown color name "non-existent"}}
    {-bd 4 4 badValue {bad screen distance "badValue"}}
    {-bg #ff0000 #ff0000 non-existent {unknown color name "non-existent"}}
    {-bitmap questhead questhead badValue {bitmap "badValue" not defined}}
    {-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
    {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
    {-direction below below badValue {bad direction "badValue": must be above, below, flush, left, or right}}
    {-disabledforeground #00ff00 #00ff00 xyzzy {unknown color name "xyzzy"}}
    {-fg #110022 #110022 bogus {unknown color name "bogus"}}
    {-font {Helvetica 12} {Helvetica 12} {} {font "" doesn't exist}}
    {-foreground #110022 #110022 bogus {unknown color name "bogus"}}
    {-height 18 18 20.0 {expected integer but got "20.0"}}
    {-highlightbackground #112233 #112233 ugly {unknown color name "ugly"}}
    {-highlightcolor #110022 #110022 bogus {unknown color name "bogus"}}
    {-highlightthickness 18 18 badValue {bad screen distance "badValue"}}
    {-image image1 image1 bogus {image "bogus" doesn't exist}}
    {-indicatoron yes 1 no_way {expected boolean value but got "no_way"}}
    {-justify right right bogus {bad justification "bogus": must be left, right, or center}}
    {-menu "any old string" "any old string" {} {}}
    {-padx 12 12 420x {bad screen distance "420x"}}
    {-pady 12 12 420x {bad screen distance "420x"}}
    {-relief groove groove 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
    {-state normal normal bogus {bad state "bogus": must be active, disabled, or normal}}
    {-takefocus "any string" "any string" {} {}}
    {-text "Sample text" {Sample text} {} {}}
    {-textvariable i i {} {}}
    {-underline 5 5 3p {expected integer but got "3p"}}
    {-width 402 402 3p {expected integer but got "3p"}}
    {-wraplength 100 100 6x {bad screen distance "6x"}}
} {
    set name [lindex $test 0]
    test menubutton-1.$i {configuration options} testImageType {
	.mb configure $name [lindex $test 1]
	lindex [.mb configure $name] 4
    } [lindex $test 2]
    incr i
    if {[lindex $test 3] != ""} {
	test menubutton-1.$i {configuration options} {
	    list [catch {.mb configure $name [lindex $test 3]} msg] $msg
	} [list 1 [lindex $test 4]]
    }
    .mb configure $name [lindex [.mb configure $name] 3]
    incr i
}

test menubutton-2.1 {Tk_MenubuttonCmd procedure} {
    list [catch {menubutton} msg] $msg
} {1 {wrong # args: should be "menubutton pathName ?-option value ...?"}}
test menubutton-2.2 {Tk_MenubuttonCmd procedure} {
    list [catch {menubutton foo} msg] $msg
} {1 {bad window path name "foo"}}
test menubutton-2.3 {Tk_MenubuttonCmd procedure} {
d333 13
a345 5
} {Menubutton}
test menubutton-2.4 {Tk_ButtonCmd procedure} {
    catch {destroy .mb}
    list [catch {menubutton .mb -gorp foo} msg] $msg [winfo exists .mb]
} {1 {unknown option "-gorp"} 0}
d347 1
a347 1
catch {destroy .mb}
d350 16
a365 16
test menubutton-3.1 {MenuButtonWidgetCmd procedure} {
    list [catch {.mb} msg] $msg
} {1 {wrong # args: should be ".mb option ?arg ...?"}}
test menubutton-3.2 {ButtonWidgetCmd procedure, "cget" option} {
    list [catch {.mb c} msg] $msg
} {1 {ambiguous option "c": must be cget or configure}}
test menubutton-3.3 {ButtonWidgetCmd procedure, "cget" option} {
    list [catch {.mb cget} msg] $msg
} {1 {wrong # args: should be ".mb cget option"}}
test menubutton-3.4 {ButtonWidgetCmd procedure, "cget" option} {
    list [catch {.mb cget a b} msg] $msg
} {1 {wrong # args: should be ".mb cget option"}}
test menubutton-3.5 {ButtonWidgetCmd procedure, "cget" option} {
    list [catch {.mb cget -gorp} msg] $msg
} {1 {unknown option "-gorp"}}
test menubutton-3.6 {ButtonWidgetCmd procedure, "cget" option} {
d368 2
a369 2
} {3}
test menubutton-3.7 {ButtonWidgetCmd procedure, "configure" option} {
d371 8
a378 8
} {33}
test menubutton-3.8 {ButtonWidgetCmd procedure, "configure" option} {
    list [catch {.mb configure -gorp} msg] $msg
} {1 {unknown option "-gorp"}}
test menubutton-3.9 {ButtonWidgetCmd procedure, "configure" option} {
    list [catch {.mb co -bg #ffffff -fg} msg] $msg
} {1 {value for "-fg" missing}}
test menubutton-3.10 {ButtonWidgetCmd procedure, "configure" option} {
d382 5
a386 4
} {#123456}
test menubutton-3.11 {ButtonWidgetCmd procedure, "configure" option} {
    list [catch {.mb foobar} msg] $msg
} {1 {bad option "foobar": must be cget or configure}}
d391 3
a393 2
test menubutton-4.1 {ConfigureMenuButton procedure} {
    catch {destroy .mb1}
d395 13
a407 2
    list [catch {.mb1 configure -width 1i} msg] $msg $errorInfo
} {1 {expected integer but got "1i"} {expected integer but got "1i"
d410 13
a422 3
".mb1 configure -width 1i"}}
test menubutton-4.2 {ConfigureMenuButton procedure} {
    catch {destroy .mb1}
d424 5
a428 2
    list [catch {.mb1 configure -height 0.5c} msg] $msg $errorInfo
} {1 {expected integer but got "0.5c"} {expected integer but got "0.5c"
d431 5
a435 3
".mb1 configure -height 0.5c"}}
test menubutton-4.3 {ConfigureMenuButton procedure} {
    catch {destroy .mb1}
d437 13
a449 2
    list [catch {.mb1 configure -width abc} msg] $msg $errorInfo
} {1 {bad screen distance "abc"} {bad screen distance "abc"
d452 19
a470 3
".mb1 configure -width abc"}}
test menubutton-4.4 {ConfigureMenuButton procedure} testImageType {
    catch {destroy .mb1}
d472 1
d475 6
a480 2
    list [catch {.mb1 configure -height 0.5x} msg] $msg $errorInfo
} {1 {bad screen distance "0.5x"} {bad screen distance "0.5x"
d483 7
a489 3
".mb1 configure -height 0.5x"}}
test menubutton-4.5 {ConfigureMenuButton procedure} {nonPortable fonts} {
    catch {destroy .mb1}
d495 15
a509 3
} {102 46 20 12}
test menubutton-4.6 {ConfigureMenuButton procedure - bad direction} {
    catch {destroy .mb}
d511 7
a517 3
    list [catch {.mb configure -direction badValue} msg] $msg \
	[.mb cget -direction] [destroy .mb]
} {1 {bad direction "badValue": must be above, below, flush, left, or right} below {}}
d521 1
a521 1
test menubutton-5.1 {MenuButtonEventProc procedure} {
d523 2
a526 1
    set x {}
d531 4
a534 1
} {.mb1 #543210 {} {}}
d536 1
a536 1
test menubutton-6.1 {MenuButtonCmdDeletedProc procedure} {
d538 1
d542 4
a545 1
} {{} {}}
d547 6
a552 2
test menubutton-7.1 {ComputeMenuButtonGeometry procedure} testImageType {
    catch {destroy .mb}
d556 10
a565 3
} {38 23}
test menubutton-7.2 {ComputeMenuButtonGeometry procedure} testImageType {
    catch {destroy .mb}
d569 10
a578 3
} {36 21}
test menubutton-7.3 {ComputeMenuButtonGeometry procedure} testImageType {
    catch {destroy .mb}
d582 10
a591 3
} {34 19}
test menubutton-7.4 {ComputeMenuButtonGeometry procedure} testImageType {
    catch {destroy .mb}
d593 1
a593 1
	    -highlightthickness 2
d596 10
a605 3
} {48 23}
test menubutton-7.5 {ComputeMenuButtonGeometry procedure} testImageType {
    catch {destroy .mb}
d607 1
a607 1
	    -highlightthickness 2
d610 7
a616 3
} {38 38}
test menubutton-7.6 {ComputeMenuButtonGeometry procedure} {
    catch {destroy .mb}
d618 1
a618 1
	    -highlightthickness 2
d621 6
a626 3
} {25 35}
test menubutton-7.7 {ComputeMenuButtonGeometry procedure} {
    catch {destroy .mb}
d628 1
a628 1
	    -highlightthickness 1
d631 6
a636 3
} {46 33}
test menubutton-7.8 {ComputeMenuButtonGeometry procedure} {
    catch {destroy .mb}
d638 1
a638 1
	    -highlightthickness 1
d641 8
a648 3
} {23 56}
test menubutton-7.9 {ComputeMenuButtonGeometry procedure} {fonts} {
    catch {destroy .mb}
d650 1
a650 1
	    -highlightthickness 1
d653 8
a660 3
} {42 20}
test menubutton-7.10 {ComputeMenuButtonGeometry procedure} {fonts} {
    catch {destroy .mb}
d662 1
a662 1
	    -padx 0 -pady 0 -highlightthickness 1
d665 8
a672 3
} {146 20}
test menubutton-7.11 {ComputeMenuButtonGeometry procedure} {fonts} {
    catch {destroy .mb}
d674 1
a674 1
	    -padx 0 -pady 0 -highlightthickness 1
d677 8
a684 3
} {42 34}
test menubutton-7.12 {ComputeMenuButtonGeometry procedure} {fonts} {
    catch {destroy .mb}
d686 1
a686 1
	    -highlightthickness 1
d689 8
a696 3
} {62 30}
test menubutton-7.13 {ComputeMenuButtonGeometry procedure} {nonPortable fonts} {
    catch {destroy .mb}
d698 1
a698 1
	    -highlightthickness 1 -indicatoron 1
d701 9
a709 2
} {78 28}
test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {testImageType unix nonPortable} {
a712 1
    catch {destroy .mb}
d714 1
a714 1
	    -highlightthickness 2 -indicatoron 1
d717 10
a726 2
} {64 23}
test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {testImageType win nonPortable} {
a729 1
    catch {destroy .mb}
d731 1
a731 1
	    -highlightthickness 2 -indicatoron 1
d734 4
a737 1
} {65 23}
a738 2
set l [interp hidden]
deleteWindows
d740 3
a742 2
test menubutton-8.1 {menubutton vs hidden commands} {
    catch {destroy .mb}
d746 6
a751 2
    list [winfo children .] [interp hidden]
} [list {} $l]
a752 1
eval image delete [image names]
d759 3
@


1.10
log
@Use standard constraint names
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.9 2004/05/23 17:34:48 dkf Exp $
d91 1
a91 1
} {1 {wrong # args: should be "menubutton pathName ?options?"}}
d110 1
a110 1
} {1 {wrong # args: should be ".mb option ?arg arg ...?"}}
@


1.9
log
@First step towards improving test style.  Also start using Tcl 8.5 features.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.8 2003/04/01 21:06:45 dgp Exp $
d305 1
a305 1
test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {testImageType unixOnly nonPortable} {
d315 1
a315 1
test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {testImageType pcOnly nonPortable} {
@


1.8
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
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.7 2002/07/13 20:28:35 dgp Exp $
a343 13













@


1.7
log
@	* Converted more files to tcltest and factored out common code.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.6 2001/05/21 14:07:33 tmh Exp $
d16 1
a16 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]
d342 1
a342 1
::tcltest::cleanupTests
@


1.6
log
@implement TIP11, -compound option for menubutton widget
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.5 1999/04/21 21:53:29 rjohnson Exp $
d15 6
a20 17
if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

if {[lsearch [image types] test] < 0} {
    puts "This application hasn't been compiled with the \"test\" image"
    puts "type, so I can't run this test.  Are you sure you're using"
    puts "tktest instead of wish?"
    ::tcltest::cleanupTests
    return
}

foreach i [winfo children .] {
    destroy $i
}
wm geometry . {}
raise .
d33 3
a35 1
image create test image1
d78 1
a78 1
    test menubutton-1.$i {configuration options} {
d175 1
a175 1
test menubutton-4.4 {ConfigureMenuButton procedure} {
d203 1
a203 1
    eval destroy [winfo children .]
d214 1
a214 1
    eval destroy [winfo children .]
d220 1
a220 1
test menubutton-7.1 {ComputeMenuButtonGeometry procedure} {
d226 1
a226 1
test menubutton-7.2 {ComputeMenuButtonGeometry procedure} {
d232 1
a232 1
test menubutton-7.3 {ComputeMenuButtonGeometry procedure} {
d238 1
a238 1
test menubutton-7.4 {ComputeMenuButtonGeometry procedure} {
d245 1
a245 1
test menubutton-7.5 {ComputeMenuButtonGeometry procedure} {
d308 1
a308 1
test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {unixOnly nonPortable} {
d318 1
a318 1
test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {pcOnly nonPortable} {
d330 1
a330 1
eval destroy [winfo children .]
d341 1
a341 1
eval destroy [winfo children .]
@


1.6.2.1
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@d9 1
a9 1
# RCS: @@(#) $Id$
d15 17
a31 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
d44 1
a44 3
if {[testConstraint testImageType]} {
    image create test image1
}
d87 1
a87 1
    test menubutton-1.$i {configuration options} testImageType {
d184 1
a184 1
test menubutton-4.4 {ConfigureMenuButton procedure} testImageType {
d212 1
a212 1
    deleteWindows
d223 1
a223 1
    deleteWindows
d229 1
a229 1
test menubutton-7.1 {ComputeMenuButtonGeometry procedure} testImageType {
d235 1
a235 1
test menubutton-7.2 {ComputeMenuButtonGeometry procedure} testImageType {
d241 1
a241 1
test menubutton-7.3 {ComputeMenuButtonGeometry procedure} testImageType {
d247 1
a247 1
test menubutton-7.4 {ComputeMenuButtonGeometry procedure} testImageType {
d254 1
a254 1
test menubutton-7.5 {ComputeMenuButtonGeometry procedure} testImageType {
d317 1
a317 1
test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {testImageType unixOnly nonPortable} {
d327 1
a327 1
test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {testImageType pcOnly nonPortable} {
d339 1
a339 1
deleteWindows
d350 1
a350 1
deleteWindows
@


1.5
log
@
Merged 8-1-0 into mainline.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.4 1999/04/19 23:54:56 hershey Exp $
d141 1
a141 1
} {32}
@


1.5.14.1
log
@sync with head
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.6 2001/05/21 14:07:33 tmh Exp $
d141 1
a141 1
} {33}
@


1.5.16.1
log
@        * Merged in updates from HEAD branch.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.6 2001/05/21 14:07:33 tmh Exp $
d141 1
a141 1
} {33}
@


1.4
log
@changed tests--marked some nonPortable; added new constraints to fix bug 1770
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.3 1999/04/16 01:51:39 stanton Exp $
@


1.3
log
@* Merged 8.1 branch into the main trunk
@
text
@d9 1
a9 1
# RCS: @@(#) $Id$
d194 1
a194 1
test menubutton-4.5 {ConfigureMenuButton procedure} {fonts} {
d310 1
a310 1
test menubutton-7.13 {ComputeMenuButtonGeometry procedure} {fonts} {
@


1.3.2.1
log
@
Merged with mainline.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.4 1999/04/19 23:54:56 hershey Exp $
d194 1
a194 1
test menubutton-4.5 {ConfigureMenuButton procedure} {nonPortable fonts} {
d310 1
a310 1
test menubutton-7.13 {ComputeMenuButtonGeometry procedure} {nonPortable fonts} {
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d6 2
a7 3
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d15 4
d23 1
a26 4
if {[info procs test] != "test"} {
    source defs
}

d54 1
a54 1
    {-anchor nw nw bogus {bad anchor position "bogus": must be n, ne, e, se, s, sw, w, nw, or center}}
d62 1
a62 1
    {-direction below below badValue {bad direction value "badValue": must be above, below, left, right, or flush}}
d77 2
a78 2
    {-relief groove groove 1.5 {bad relief type "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
    {-state normal normal bogus {bad state value "bogus": must be normal, active, or disabled}}
d125 1
a125 1
} {1 {bad option "c": must be cget or configure}}
d207 1
a207 1
} {1 {bad direction value "badValue": must be above, below, left, right, or flush} below {}}
d317 1
a317 1
test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {unix nonPortable} {
d327 1
a327 1
test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {pc nonPortable} {
d352 16
@


1.1
log
@Initial revision
@
text
@d10 1
a10 1
# SCCS: @@(#) menubut.test 1.26 97/07/31 10:08:50
@


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


1.1.4.2
log
@Change Menubutton to use TK_OPTION interface to eliminate static data.
@
text
@d10 1
a10 1
# RCS: @@(#) $Id: menubut.test,v 1.1.4.1 1998/09/30 02:18:49 stanton Exp $
d54 1
a54 1
    {-anchor nw nw bogus {bad anchor "bogus": must be n, ne, e, se, s, sw, w, nw, or center}}
d62 1
a62 1
    {-direction below below badValue {bad direction "badValue": must be above, below, flush, left, or right}}
d77 2
a78 2
    {-relief groove groove 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
    {-state normal normal bogus {bad state "bogus": must be active, disabled, or normal}}
d125 1
a125 1
} {1 {ambiguous option "c": must be cget or configure}}
d207 1
a207 1
} {1 {bad direction "badValue": must be above, below, flush, left, or right} below {}}
@


1.1.4.3
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
@a5 2
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
d7 4
a10 1
# RCS: @@(#) $Id: menubut.test,v 1.1.4.2 1999/02/16 06:00:42 lfb Exp $
d23 2
a24 2
if {[lsearch [namespace children] ::test] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
a352 3
# cleanup
::test::cleanupTests
return
@


1.1.4.4
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
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.1.4.3 1999/03/11 18:51:01 hershey Exp $
d22 1
a22 1
if {[lsearch [namespace children] ::tcltest] == -1} {
d316 1
a316 1
test menubutton-7.14 {ComputeMenuButtonGeometry procedure} {unixOnly nonPortable} {
d353 1
a353 1
::tcltest::cleanupTests
a354 12












@


1.1.4.5
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
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.1.4.4 1999/03/24 01:16:58 hershey Exp $
a354 1

@


1.1.4.6
log
@Now all test files that skip tests by returning early (which ideally they
shouldn't do) call ::tcltest::cleanupTests before returning.  The defs.tcl
file has one hew constraint:  userInteraction, used by tests that require
user interaction.  The next putback will include an updated version of the
"visual" test file to use this mechanism.
@
text
@d9 1
a9 1
# RCS: @@(#) $Id: menubut.test,v 1.1.4.5 1999/03/24 02:54:53 hershey Exp $
a14 4
if {[lsearch [namespace children] ::tcltest] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

a18 1
    ::tcltest::cleanupTests
d22 4
d326 1
a326 1
test menubutton-7.15 {ComputeMenuButtonGeometry procedure} {pcOnly nonPortable} {
@


