summaryrefslogtreecommitdiffstats
path: root/tests/image.test
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/image.test
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/image.test')
-rw-r--r--tests/image.test28
1 files changed, 8 insertions, 20 deletions
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