mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Scenes: a hold resumed partway waits for the clip it started again
The resumed hold reads scene media like any hold: a clip still playing is waited for, and only without one does it wait out the rest of the hold.
This commit is contained in:
1 parent
b2c7144cce
commit
6904ce0e7a
4 files changed
+43
-13
No files matched your search
@@ -2108,6 +2108,34 @@ test('a revocation also covers the release a stopped run reaches later', async (
|
||||
} finally { await director.destroy(); restore(); }
|
||||
});
|
||||
|
||||
test('a hold resumed partway waits for a clip that starts again, else only its rest', async () => {
|
||||
const hold = async (pendingReads) => {
|
||||
let reads = 0;
|
||||
const module = {
|
||||
getSceneShotMediaHold: () => ({ pending: reads++ < pendingReads, maxWaitMs: 20000 }),
|
||||
};
|
||||
const waits = [];
|
||||
await SceneDirector.prototype._holdShot.call(
|
||||
{
|
||||
_layerStatesForShot: () => ({ media: { enabled: true, params: { beatId: 'b' } } }),
|
||||
dataManager: { layers: new Map([['media', { module }]]) },
|
||||
_effectiveShotHoldSec: () => 3,
|
||||
_sleep: async (ms) => waits.push(ms),
|
||||
stopScene: () => assert.fail('no timeout'),
|
||||
},
|
||||
{ id: 'scene' },
|
||||
{ id: 'shot' },
|
||||
{ cancelled: false },
|
||||
{ holdElapsedSec: 1, holdDurationSec: 3 },
|
||||
);
|
||||
return waits;
|
||||
};
|
||||
// The clip plays again: the hold polls until it is done, as any hold does.
|
||||
assert.deepEqual(await hold(4), [70, 70]);
|
||||
// The moment was past the clip: only the rest of the hold.
|
||||
assert.deepEqual(await hold(0), [2000]);
|
||||
});
|
||||
|
||||
/** Drive frame-by-frame camera motion headlessly for one test. */
|
||||
function installAnimationFrames() {
|
||||
const original = globalThis.requestAnimationFrame;
|
||||
|
||||
Reference in new issue
Block a user