1# This file is a Tcl script to test the procedures in the file
2# tkCmds.c.  It is organized in the standard fashion for Tcl tests.
3#
4# Copyright (c) 1996 Sun Microsystems, Inc.
5# Copyright (c) 1998-1999 by Scriptics Corporation.
6# All rights reserved.
7#
8# RCS: @(#) $Id: cmds.test,v 1.4 2002/07/14 05:48:46 dgp Exp $
9
10package require tcltest 2.1
11namespace import -force tcltest::configure
12namespace import -force tcltest::testsDirectory
13configure -testdir [file join [pwd] [file dirname [info script]]]
14configure -loadfile [file join [testsDirectory] constraints.tcl]
15tcltest::loadTestedCommands
16
17update
18
19test cmds-1.1 {tkwait visibility, argument errors} {
20    list [catch {tkwait visibility} msg] $msg
21} {1 {wrong # args: should be "tkwait variable|visibility|window name"}}
22test cmds-1.2 {tkwait visibility, argument errors} {
23    list [catch {tkwait visibility foo bar} msg] $msg
24} {1 {wrong # args: should be "tkwait variable|visibility|window name"}}
25test cmds-1.3 {tkwait visibility, argument errors} {
26    list [catch {tkwait visibility bad_window} msg] $msg
27} {1 {bad window path name "bad_window"}}
28test cmds-1.4 {tkwait visibility, waiting for window to be mapped} {
29    button .b -text "Test"
30    set x init
31    after 100 {set x delay; place .b -x 0 -y 0}
32    tkwait visibility .b
33    destroy .b
34    set x
35} {delay}
36test cmds-1.5 {tkwait visibility, window gets deleted} {
37    frame .f
38    button .f.b -text "Test"
39    pack .f.b
40    set x init
41    after 100 {set x deleted; destroy .f}
42    list [catch {tkwait visibility .f.b} msg] $msg $x
43} {1 {window ".f.b" was deleted before its visibility changed} deleted}
44
45# cleanup
46::tcltest::cleanupTests
47return
48
49
50
51
52
53
54
55
56
57
58
59
60
61