UI testing: wait until event queue empties jv stx-8.0.0
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 26 Nov 2017 20:40:34 +0000
branchjv
changeset 696 268bf2c60556
parent 681 61b376859809
child 720 5cdbe4a734ce
UI testing: wait until event queue empties ...when `#do:`ing an user action. This is necessary for widget/tools that pushes more work back onto an even queue (in order to make the system more responsive).
ext/ui/SimpleViewInteractor.st
--- a/ext/ui/SimpleViewInteractor.st	Wed Jul 12 09:59:48 2017 +0200
+++ b/ext/ui/SimpleViewInteractor.st	Sun Nov 26 20:40:34 2017 +0000
@@ -82,6 +82,17 @@
         self error: 'User action did not finish in ', timeout printString , 'ms'.
     ].
 
+    "/ A thus point, `aBlock` has processed by the event queue. Now we have to 
+    "/ wait for event queue to empty - some widget/tools just delay the actual action
+    "/ by pushing the real work back into queue. Following makes sure those delayed
+    "/ actions are processed too. 
+    blocker1 := Semaphore new.
+    view sensor pushAction:[
+        blocker1 signal.
+    ].
+    blocker1 wait.
+
+
     "Created: / 31-01-2015 / 08:27:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 18-07-2016 / 18:56:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !