mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-22 22:12:28 -05:00
Move test
This commit is contained in:
parent
60aeebf668
commit
45c95f3370
2 changed files with 21 additions and 21 deletions
|
@ -250,3 +250,24 @@ test('Disposing the runtime emits an event', t => {
|
|||
t.equal(disposed, true);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Clock is reset on runtime dispose', t => {
|
||||
const rt = new Runtime();
|
||||
const c = rt.ioDevices.clock;
|
||||
let simulatedTime = 0;
|
||||
|
||||
c._projectTimer = {
|
||||
timeElapsed: () => simulatedTime,
|
||||
start: () => {
|
||||
simulatedTime = 0;
|
||||
}
|
||||
};
|
||||
|
||||
t.ok(c.projectTimer() === 0);
|
||||
simulatedTime += 1000;
|
||||
t.ok(c.projectTimer() === 1);
|
||||
rt.dispose();
|
||||
// When the runtime is disposed, the clock should be reset
|
||||
t.ok(c.projectTimer() === 0);
|
||||
t.end();
|
||||
});
|
||||
|
|
|
@ -35,24 +35,3 @@ test('cycle', t => {
|
|||
rt._step();
|
||||
t.ok(c.projectTimer() > 0);
|
||||
});
|
||||
|
||||
test('reset on runtime dispose', t => {
|
||||
const rt = new Runtime();
|
||||
const c = rt.ioDevices.clock;
|
||||
let simulatedTime = 0;
|
||||
|
||||
c._projectTimer = {
|
||||
timeElapsed: () => simulatedTime,
|
||||
start: () => {
|
||||
simulatedTime = 0;
|
||||
}
|
||||
};
|
||||
|
||||
t.ok(c.projectTimer() === 0);
|
||||
simulatedTime += 1000;
|
||||
t.ok(c.projectTimer() === 1);
|
||||
rt.dispose();
|
||||
// When the runtime is disposed, the clock should be reset
|
||||
t.ok(c.projectTimer() === 0);
|
||||
t.end();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue