home *** CD-ROM | disk | FTP | other *** search
- # This file is a Tcl script to test the code in tkEvent.c. It is
- # organized in the standard fashion for Tcl tests.
- #
- # Copyright (c) 1994 The Regents of the University of California.
- # Copyright (c) 1994-1995 Sun Microsystems, Inc.
- #
- # See the file "license.terms" for information on usage and redistribution
- # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- #
- # @(#) event.test 1.3 95/06/22 17:10:29
-
- if {[info procs test] != "test"} {
- source defs
- }
-
- foreach i [winfo children .] {
- destroy $i
- }
- wm geometry . {}
- raise .
-
- # XXX This test file is woefully incomplete. Right now it only tests
- # a few of the procedures in tkEvent.c. Please add more tests whenever
- # possible.
-
-
- proc tkerror msg {
- global x errorInfo errorCode y
- lappend x $msg $errorInfo $errorCode
- if [string match break* $msg] {
- return -code break
- }
- if [string match more* $msg] {
- after 0 {error "Another error"}
- after 0 {set y done; error "Still another"}
- tkwait variable y
- }
- }
-
- test event-1.1 {Tk_BackgroundError and HandleBgErrors procedures} {
- catch {unset errorCode}
- catch {unset errorInfo}
- after idle {error "First error"}
- after idle {error "Second error"}
- set x {}
- tkwait variable x
- set x
- } {{First error} {First error
- while executing
- "error "First error""
- ("after" script)} NONE {Second error} {Second error
- while executing
- "error "Second error""
- ("after" script)} NONE}
- test event-1.2 {Tk_BackgroundError and HandleBgErrors procedures} {
- catch {unset errorCode}
- catch {unset errorInfo}
- after idle {error "First error" "error code initialization" "foo bar baz"}
- after idle {error "Second error"}
- set x {}
- tkwait variable x
- set x
- } {{First error} {error code initialization
- ("after" script)} {foo bar baz} {Second error} {Second error
- while executing
- "error "Second error""
- ("after" script)} NONE}
- test event-1.3 {Tk_BackgroundError and HandleBgErrors procedures} {
- after idle {error "break returned"}
- after idle {error "number 1"}
- after idle {error "number 2"}
- set x {}
- tkwait variable x
- set x
- } {{break returned} {break returned
- while executing
- "error "break returned""
- ("after" script)} NONE}
- test event-1.4 {Tk_BackgroundError and HandleBgErrors procedures} {
- after idle {error "more errors, please"}
- after idle {error "number 1"}
- set x {}
- tkwait variable x
- set x
- } {{more errors, please} {more errors, please
- while executing
- "error "more errors, please""
- ("after" script)} NONE {number 1} {number 1
- while executing
- "error "number 1""
- ("after" script)} NONE {Another error} {Another error
- while executing
- "error "Another error""
- ("after" script)} NONE {Still another} {Still another
- while executing
- "error "Still another""
- ("after" script)} NONE}
-