summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorculler <culler>2019-05-21 19:49:48 (GMT)
committerculler <culler>2019-05-21 19:49:48 (GMT)
commit32d393d515efed07e6dc3cf3ef73626197f496fe (patch)
tree1ac94de1a4e5aac699836a503b2c9ac2b2f79b2b /tests
parent98be79b4923b0a5ad357ec4aea70ba4e96317ef7 (diff)
downloadtk-32d393d515efed07e6dc3cf3ef73626197f496fe.zip
tk-32d393d515efed07e6dc3cf3ef73626197f496fe.tar.gz
tk-32d393d515efed07e6dc3cf3ef73626197f496fe.tar.bz2
Use vwait with a timeout to wait for test image display, as suggested by dkf.
Diffstat (limited to 'tests')
-rw-r--r--tests/canvImg.test4
-rw-r--r--tests/image.test28
2 files changed, 11 insertions, 21 deletions
diff --git a/tests/canvImg.test b/tests/canvImg.test
index c28eb5b..28f0375 100644
--- a/tests/canvImg.test
+++ b/tests/canvImg.test
@@ -166,9 +166,11 @@ test canvImg-4.2 {ConfigureImage procedure} -constraints testImageType -setup {
update
set x {}
set y {}
+ set timer [after 3000 {set y "timed out"}]
.c itemconfigure i1 -image foo2
update idletasks
- update
+ vwait y
+ after cancel timer
list $x $y [.c bbox i1]
} -cleanup {
.c delete all
diff --git a/tests/image.test b/tests/image.test
index 28adba3..f4bc9e0 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -12,24 +12,6 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
-#
-# This procedure is used to make sure that a test image has
-# actually been displayed from inside the [NSView drawRect] method.
-if {[tk windowingsystem] == "aqua"} {
- proc imageWait {} {
- # Allow the display proc to fail and trigger drawRect.
- update idletasks;
- # Wait a bit for drawRect to actually be run.
- set timeout 0;
- after 200 {set timeout 1};
- vwait timeout
- }
-} else {
- proc imageWait {} {
- update;
- }
-}
-
imageInit
# Canvas used in some tests in the whole file
@@ -80,8 +62,11 @@ test image-1.7 {Tk_ImageCmd procedure, "create" option} -constraints {
.c create image 100 150 -image myimage
update
set x {}
+ set timer [after 3000 {set x "timed out"}]
image create test myimage -variable x
- imageWait
+ update idletasks
+ vwait x
+ after cancel timer
return $x
} -cleanup {
imageCleanup
@@ -378,8 +363,11 @@ test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
.c create image 50 50 -image foo
update
set x {}
+ set timer [after 3000 {set x "timed out"}]
foo changed 5 6 7 8 30 15
- imageWait
+ update idletasks
+ vwait x
+ after cancel timer
return $x
} -cleanup {
.c delete all