Make Scratch 3 project timer more compatible with Scratch 2 currentMSecs usage

These compatibility changes:
 - Use runtime.currentMSecs for the Clock timer "now" value
 - Start executing hats before other threads change values
 - Update test and fixtures to work with earlier hat execution
 - Add test for hat execution block order
This commit is contained in:
Katie Broida 2019-01-22 15:53:13 -05:00
parent c5abcf5888
commit 2a60391fb4
9 changed files with 31 additions and 17 deletions
test/unit

View file

@ -23,12 +23,15 @@ test('cycle', t => {
setTimeout(() => {
c.resetProjectTimer();
setTimeout(() => {
t.ok(c.projectTimer() > 0);
// The timer shouldn't advance until all threads have been stepped
t.ok(c.projectTimer() === 0);
c.pause();
t.ok(c.projectTimer() > 0);
t.ok(c.projectTimer() === 0);
c.resume();
t.ok(c.projectTimer() > 0);
t.ok(c.projectTimer() === 0);
t.end();
}, 100);
}, 100);
rt._step();
t.ok(c.projectTimer() > 0);
});