os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winNotify.test
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winNotify.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,174 @@
1.4 +# This file tests the tclWinNotify.c file.
1.5 +#
1.6 +# This file contains a collection of tests for one or more of the Tcl
1.7 +# built-in commands. Sourcing this file into Tcl runs the tests and
1.8 +# generates output for errors. No output means no errors were found.
1.9 +#
1.10 +# Copyright (c) 1997 by Sun Microsystems, Inc.
1.11 +# Copyright (c) 1998-1999 by Scriptics Corporation.
1.12 +#
1.13 +# See the file "license.terms" for information on usage and redistribution
1.14 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.15 +#
1.16 +# RCS: @(#) $Id: winNotify.test,v 1.7 2000/04/10 17:19:06 ericm Exp $
1.17 +
1.18 +if {[lsearch [namespace children] ::tcltest] == -1} {
1.19 + package require tcltest
1.20 + namespace import -force ::tcltest::*
1.21 +}
1.22 +
1.23 +set ::tcltest::testConstraints(testeventloop) \
1.24 + [expr {[info commands testeventloop] != {}}]
1.25 +
1.26 +# There is no explicit test for InitNotifier or NotifierExitHandler
1.27 +
1.28 +test winNotify-1.1 {Tcl_SetTimer: positive timeout} {pcOnly} {
1.29 + set done 0
1.30 + after 1000 { set done 1 }
1.31 + vwait done
1.32 + set done
1.33 +} 1
1.34 +test winNotify-1.2 {Tcl_SetTimer: positive timeout, message pending} {pcOnly} {
1.35 + set x 0
1.36 + set y 1
1.37 + set a1 [after 0 { incr y }]
1.38 + after cancel $a1
1.39 + after 500 { incr x }
1.40 + vwait x
1.41 + list $x $y
1.42 +} {1 1}
1.43 +test winNotify-1.3 {Tcl_SetTimer: cancelling positive timeout} {pcOnly} {
1.44 + set x 0
1.45 + set y 1
1.46 + set id [after 10000 { incr y }]
1.47 + after 0 { incr x }
1.48 + vwait x
1.49 + after cancel $id
1.50 + list $x $y
1.51 +} {1 1}
1.52 +test winNotify-1.4 {Tcl_SetTimer: null timeout, message pending} {pcOnly} {
1.53 + set x 0
1.54 + set y 1
1.55 + after 0 { incr x }
1.56 + after 0 { incr y }
1.57 + vwait x
1.58 + list $x $y
1.59 +} {1 2}
1.60 +
1.61 +test winNotify-2.1 {Tcl_ResetIdleTimer} {pcOnly} {
1.62 + set x 0
1.63 + update
1.64 + after idle { incr x }
1.65 + vwait x
1.66 + set x
1.67 +} 1
1.68 +test winNotify-2.2 {Tcl_ResetIdleTimer: message pending} {pcOnly} {
1.69 + set x 0
1.70 + set y 1
1.71 + update
1.72 + after idle { incr x }
1.73 + after idle { incr y }
1.74 + update
1.75 + list $x $y
1.76 +} {1 2}
1.77 +
1.78 +test winNotify-3.1 {NotifierProc: non-modal normal timer} {pcOnly testeventloop} {
1.79 + update
1.80 + set x 0
1.81 + foreach i [after info] {
1.82 + after cancel $i
1.83 + }
1.84 + after 500 { incr x; testeventloop done }
1.85 + testeventloop wait
1.86 + set x
1.87 +} 1
1.88 +test winNotify-3.2 {NotifierProc: non-modal normal timer, rescheduled} {pcOnly testeventloop} {
1.89 + update
1.90 + set x 0
1.91 + foreach i [after info] {
1.92 + after cancel $i
1.93 + }
1.94 + after 500 { incr x; after 100 {incr x; testeventloop done }}
1.95 + testeventloop wait
1.96 + set x
1.97 +} 2
1.98 +test winNotify-3.3 {NotifierProc: modal normal timer} {pcOnly} {
1.99 + update
1.100 + set x 0
1.101 + foreach i [after info] {
1.102 + after cancel $i
1.103 + }
1.104 + after 500 { incr x }
1.105 + vwait x
1.106 + set x
1.107 +} 1
1.108 +test winNotify-3.4 {NotifierProc: modal normal timer, rescheduled} {pcOnly} {
1.109 + update
1.110 + set x 0
1.111 + foreach i [after info] {
1.112 + after cancel $i
1.113 + }
1.114 + set y 0
1.115 + after 500 { incr y; after 100 {incr x}}
1.116 + vwait x
1.117 + list $x $y
1.118 +} {1 1}
1.119 +test winNotify-3.5 {NotifierProc: non-modal idle timer} {pcOnly testeventloop} {
1.120 + update
1.121 + set x 0
1.122 + foreach i [after info] {
1.123 + after cancel $i
1.124 + }
1.125 + after idle { incr x; testeventloop done }
1.126 + testeventloop wait
1.127 + set x
1.128 +} 1
1.129 +test winNotify-3.6 {NotifierProc: non-modal idle timer, rescheduled} {pcOnly testeventloop} {
1.130 + update
1.131 + set x 0
1.132 + foreach i [after info] {
1.133 + after cancel $i
1.134 + }
1.135 + after idle { incr x; after idle {incr x; testeventloop done }}
1.136 + testeventloop wait
1.137 + set x
1.138 +} 2
1.139 +test winNotify-3.7 {NotifierProc: modal idle timer} {pcOnly} {
1.140 + update
1.141 + set x 0
1.142 + foreach i [after info] {
1.143 + after cancel $i
1.144 + }
1.145 + after idle { incr x }
1.146 + vwait x
1.147 + set x
1.148 +} 1
1.149 +test winNotify-3.8 {NotifierProc: modal idle timer, rescheduled} {pcOnly} {
1.150 + update
1.151 + set x 0
1.152 + foreach i [after info] {
1.153 + after cancel $i
1.154 + }
1.155 + set y 0
1.156 + after idle { incr y; after idle {incr x}}
1.157 + vwait x
1.158 + list $x $y
1.159 +} {1 1}
1.160 +
1.161 +# Tcl_DoOneEvent is tested by the timer.test, io.test, and event.test files
1.162 +
1.163 +# cleanup
1.164 +::tcltest::cleanupTests
1.165 +return
1.166 +
1.167 +
1.168 +
1.169 +
1.170 +
1.171 +
1.172 +
1.173 +
1.174 +
1.175 +
1.176 +
1.177 +