Improve `SimpleView >> waitUntilAllEventsProcesses`
The new implementation uses a kind of polling rather than
waiting on a semaphore. While normnally polling is not
preferred way, in this case it helps to cover situation
where queued events push another event back unto a queue.
This is a common (reccommended) practice for doing more
complex updates and time-consuming updates.
--- a/SimpleView.st Wed Jan 23 16:08:55 2019 +0000
+++ b/SimpleView.st Wed Jan 23 21:35:00 2019 +0000
@@ -11696,14 +11696,16 @@
in tests you may need to delay assertions until all events
are processed."
- | blocker |
-
- [ Screen current eventPending ] whileTrue.
- blocker := Semaphore new.
- self sensor pushAction: [ blocker signal ].
- blocker wait.
+ [ Screen current eventPending ] whileTrue:[
+ Delay waitForMilliseconds: 50.
+ ].
+ [ self sensor hasEvents ] whileTrue: [
+ Delay waitForMilliseconds: 50.
+ ].
"Created: / 31-03-2016 / 22:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 23-01-2019 / 21:05:32 / jv"
+ "Modified: / 23-01-2019 / 21:09:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
waitUntilVisible