OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tk8.6.12 / tests / cmds.test
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 package require tcltest 2.2
9 eval tcltest::configure $argv
10 tcltest::loadTestedCommands
11 namespace import -force tcltest::test
12
13 update
14
15 test cmds-1.1 {tkwait visibility, argument errors} -body {
16     tkwait visibility
17 } -returnCodes {error} -result {wrong # args: should be "tkwait variable|visibility|window name"}
18 test cmds-1.2 {tkwait visibility, argument errors} -body {
19     tkwait visibility foo bar
20 } -returnCodes {error} -result {wrong # args: should be "tkwait variable|visibility|window name"}
21 test cmds-1.3 {tkwait visibility, argument errors} -body {
22     tkwait visibility bad_window
23 } -returnCodes {error} -result {bad window path name "bad_window"}
24 test cmds-1.4 {tkwait visibility, waiting for window to be mapped} -setup {
25     button .b -text "Test"
26     set x init
27 } -body {
28     after 100 {set x delay; place .b -x 0 -y 0}
29     tkwait visibility .b
30     return $x
31 } -cleanup {
32     destroy .b
33 } -result {delay}
34 test cmds-1.5 {tkwait visibility, window gets deleted} -setup {
35     frame .f
36     button .f.b -text "Test"
37     pack .f.b
38     set x init
39 } -body {
40     after 100 {set x deleted; destroy .f}
41     tkwait visibility .f.b
42 } -returnCodes {error} -result {window ".f.b" was deleted before its visibility changed}
43 test cmds-1.6 {tkwait visibility, window gets deleted} -setup {
44     frame .f
45     button .f.b -text "Test"
46     pack .f.b
47     set x init
48 } -body {
49     after 100 {set x deleted; destroy .f}
50     catch {tkwait visibility .f.b}
51     return $x
52 } -cleanup {
53     destroy .f
54 } -result {deleted}
55
56
57 # cleanup
58 cleanupTests
59 return
60