update runtime thread tests

Threads are now removed after every "inner" step. Any thread that
reaches its DONE conditions is immediately removed instead of requiring
an extra step to remove it. As such tests that check the number of
threads have been updated to consider this.
This commit is contained in:
Michael "Z" Goddard 2018-10-31 17:56:12 -04:00
parent b833ef8d24
commit 2ffa8eb333
No known key found for this signature in database
GPG key ID: 762CD40DD5349872
5 changed files with 73 additions and 34 deletions
src/engine

View file

@ -188,6 +188,13 @@ class Runtime extends EventEmitter {
*/
this._nonMonitorThreadCount = 0;
/**
* All threads that finished running and were removed from this.threads
* by behaviour in Sequencer.stepThreads.
* @type {Array<Thread>}
*/
this._lastStepDoneThreads = null;
/**
* Currently known number of clones, used to enforce clone limit.
* @type {number}
@ -1560,6 +1567,9 @@ class Runtime extends EventEmitter {
this._emitProjectRunStatus(
this.threads.length + doneThreads.length -
this._getMonitorThreadCount([...this.threads, ...doneThreads]));
// Store threads that completed this iteration for testing and other
// internal purposes.
this._lastStepDoneThreads = doneThreads;
if (this.renderer) {
// @todo: Only render when this.redrawRequested or clones rendered.
if (this.profiler !== null) {