summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrmax <rmax>2005-05-31 15:24:38 (GMT)
committerrmax <rmax>2005-05-31 15:24:38 (GMT)
commit3c42e2dc1d71aa694730d3e243523dc60d840308 (patch)
tree771c0c00e22d4b21a5bd9bc23d8efa7032bc658a /tests
parent51820aae78413a2e68e732649a8f5c2d42ca4fc6 (diff)
downloadtk-3c42e2dc1d71aa694730d3e243523dc60d840308.zip
tk-3c42e2dc1d71aa694730d3e243523dc60d840308.tar.gz
tk-3c42e2dc1d71aa694730d3e243523dc60d840308.tar.bz2
* doc/Inactive.3 (new file): C level API documentationn for
TIP#245 (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime). * tests/tk.test: Added tests for the TIP#245 implementation.
Diffstat (limited to 'tests')
-rw-r--r--tests/tk.test46
1 files changed, 39 insertions, 7 deletions
diff --git a/tests/tk.test b/tests/tk.test
index c2a781b..d4fd43e 100644
--- a/tests/tk.test
+++ b/tests/tk.test
@@ -5,18 +5,18 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# Copyright (c) 2002 ActiveState Corporation.
#
-# RCS: @(#) $Id: tk.test,v 1.12 2004/06/24 12:45:44 dkf Exp $
+# RCS: @(#) $Id: tk.test,v 1.13 2005/05/31 15:24:53 rmax Exp $
package require tcltest 2.1
eval tcltest::configure $argv
tcltest::loadTestedCommands
-test tk-1.1 {tk command: general} {
- list [catch {tk} msg] $msg
-} {1 {wrong # args: should be "tk option ?arg?"}}
-test tk-1.2 {tk command: general} {
- list [catch {tk xyz} msg] $msg
-} {1 {bad option "xyz": must be appname, caret, scaling, useinputmethods, or windowingsystem}}
+test tk-1.1 {tk command: general} \
+ -body {tk} -returnCodes 1 \
+ -result {wrong # args: should be "tk option ?arg?"}
+test tk-1.2 {tk command: general} \
+ -body {tk xyz} -returnCodes 1 \
+ -result {bad option "xyz": must be appname, caret, scaling, useinputmethods, windowingsystem, or inactive}
set appname [tk appname]
test tk-2.1 {tk command: appname} {
@@ -129,6 +129,38 @@ test tk-5.6 {tk caret} {
list [catch {tk caret . -x 20 -y 25 -h 30; tk caret . -hei} msg] $msg
} {0 30}
+# tk inactive
+test tk-5.1 {tk inactive} -body {
+ string is integer [tk inactive]
+} -result 1
+test tk-5.2 {tk inactive reset} -body {
+ catch {tk inactive reset}
+} -result 0
+test tk-5.3 {tk inactive wrong argument} -body {
+ tk inactive foo
+} -returnCodes 1 -result {bad option "foo": must be reset}
+test tk-5.4 {tk inactive too many arguments} -body {
+ tk inactive reset foo
+} -returnCodes 1 -result {wrong # args: should be "tk inactive ?-displayof window? ?reset?"}
+test tk-5.3 {tk inactive} -body {
+ tk inactive reset
+ update
+ after 100
+ set i [tk inactive]
+ expr {$i == -1 || ( $i > 90 && $i < 200 )}
+} -result 1
+
+# tk inactive in safe interpreters
+safe::interpCreate foo
+safe::loadTk foo
+test tk-6.1 {tk inactive in a safe interpreter} -body {
+ foo eval {tk inactive}
+} -result -1
+test tk-6.2 {tk inactive reset in a safe interpreter} -body {
+ foo eval {tk inactive reset}
+} -returnCodes 1 -result {resetting the user inactivity timer is not allowed in a safe interpreter}
+::safe::interpDelete foo
+
# cleanup
cleanupTests
return