summaryrefslogtreecommitdiffstats
path: root/tests/id.test
diff options
context:
space:
mode:
authoraniap <aniap>2008-08-13 23:57:05 (GMT)
committeraniap <aniap>2008-08-13 23:57:05 (GMT)
commit7c24b436f3b30b717b0aa7768de2f123f709880a (patch)
treeea2537abdef81c1cf147cb68bf3d7081e87c9370 /tests/id.test
parent7725a02421f2c730493fbb97c8d5aae5e223d330 (diff)
downloadtk-7c24b436f3b30b717b0aa7768de2f123f709880a.zip
tk-7c24b436f3b30b717b0aa7768de2f123f709880a.tar.gz
tk-7c24b436f3b30b717b0aa7768de2f123f709880a.tar.bz2
Update to tcltest2
Diffstat (limited to 'tests/id.test')
-rw-r--r--tests/id.test66
1 files changed, 35 insertions, 31 deletions
diff --git a/tests/id.test b/tests/id.test
index bc8c5c6..1ffa93a 100644
--- a/tests/id.test
+++ b/tests/id.test
@@ -6,24 +6,27 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: id.test,v 1.9 2004/06/24 12:45:43 dkf Exp $
+# RCS: @(#) $Id: id.test,v 1.10 2008/08/13 23:58:01 aniap Exp $
-package require tcltest 2.1
+package require tcltest 2.2
+namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
-test id-1.1 {WindowIdCleanup, delaying window release} {unix testwrapper} {
+test id-1.1 {WindowIdCleanup, delaying window release} -constraints {
+ unix testwrapper
+} -body {
bind all <Destroy> {lappend x %W}
catch {unset map}
frame .f
set j 0
foreach i {a b c d e f g h i j k l m n o p q} {
- toplevel .f.$i -height 50 -width 100
- wm geometry .f.$i +$j+$j
- incr j 10
- update
- set map([winfo id .f.$i]) .f.$i
- set map([testwrapper .f.$i]) wrapper.f.$i
+ toplevel .f.$i -height 50 -width 100
+ wm geometry .f.$i +$j+$j
+ incr j 10
+ update
+ set map([winfo id .f.$i]) .f.$i
+ set map([testwrapper .f.$i]) wrapper.f.$i
}
set x {}
destroy .f
@@ -35,13 +38,13 @@ test id-1.1 {WindowIdCleanup, delaying window release} {unix testwrapper} {
update idletasks
set reused {}
foreach i {a b c d e} {
- set w .${i}2
- frame $w -height 20 -width 100 -bd 2 -relief raised
- pack $w
- if [info exists map([winfo id $w])] {
- lappend reused $map([winfo id $w])
- }
- set map([winfo id $w]) $w
+ set w .${i}2
+ frame $w -height 20 -width 100 -bd 2 -relief raised
+ pack $w
+ if [info exists map([winfo id $w])] {
+ lappend reused $map([winfo id $w])
+ }
+ set map([winfo id $w]) $w
}
# No window ids should have been reused: stale Destroy events still
@@ -55,13 +58,13 @@ test id-1.1 {WindowIdCleanup, delaying window release} {unix testwrapper} {
after 2000 {set y 1}
tkwait variable y
foreach i {a b c} {
- set w .${i}3
- frame $w -height 20 -width 100 -bd 2 -relief raised
- pack $w
- if [info exists map([winfo id $w])] {
- lappend reused $map([winfo id $w])
- }
- set map([winfo id $w])] $w
+ set w .${i}3
+ frame $w -height 20 -width 100 -bd 2 -relief raised
+ pack $w
+ if [info exists map([winfo id $w])] {
+ lappend reused $map([winfo id $w])
+ }
+ set map([winfo id $w])] $w
}
# Ids should not yet have been reused.
@@ -73,19 +76,20 @@ test id-1.1 {WindowIdCleanup, delaying window release} {unix testwrapper} {
after 6000 {set y 1}
tkwait variable y
foreach i {a b c d e f} {
- set w .${i}4
- frame $w -height 20 -width 100 -bd 2 -relief raised
- pack $w
- if [info exists map([winfo id $w])] {
- lappend reused $map([winfo id $w])
- }
- set map([winfo id $w])] $w
+ set w .${i}4
+ frame $w -height 20 -width 100 -bd 2 -relief raised
+ pack $w
+ if [info exists map([winfo id $w])] {
+ lappend reused $map([winfo id $w])
+ }
+ set map([winfo id $w])] $w
}
# Ids should be reused now, due to time delay. Destroy events should
# have been discarded.
lappend result [lsort $reused] [lsort $x]
-} {{.f .f.a .f.b .f.c .f.d .f.e .f.f .f.g .f.h .f.i .f.j .f.k .f.l .f.m .f.n .f.o .f.p .f.q} {} {} {.f.o .f.p .f.q wrapper.f.p wrapper.f.q} {}}
+} -result {{.f .f.a .f.b .f.c .f.d .f.e .f.f .f.g .f.h .f.i .f.j .f.k .f.l .f.m .f.n .f.o .f.p .f.q} {} {} {.f.o .f.p .f.q wrapper.f.p wrapper.f.q} {}}
+
bind all <Destroy> {}
# cleanup