fix(viewer): make recorded layers deterministic

This commit is contained in:
DCCONSTRUCTIONS
2026-07-23 11:42:19 +03:00
parent 3a64f54dea
commit ee15160862
6 changed files with 222 additions and 34 deletions
@@ -128,6 +128,51 @@ test("recorded autoplay waits for the full range and then runs exactly once", ()
assert.equal(gate.attempted(), true);
});
test("recorded autoplay starts at the first presentable camera frame without shrinking the range", () => {
const gate = createRecordedAutoplayGate();
const seeks = [];
const range = { min: 0, max: 535_717_620_042 };
assert.equal(gate.attempt(
true,
true,
true,
range,
(value) => seeks.push(value),
() => {},
35_421_857_292,
), true);
assert.deepEqual(seeks, [35_421_857_292]);
assert.deepEqual(range, { min: 0, max: 535_717_620_042 });
});
test("recorded autoplay clamps an invalid presentation start to the admitted archive", () => {
const before = createRecordedAutoplayGate();
const after = createRecordedAutoplayGate();
const seeks = [];
const range = { min: 5, max: 10 };
assert.equal(before.attempt(
true,
true,
true,
range,
(value) => seeks.push(value),
() => {},
-50,
), true);
assert.equal(after.attempt(
true,
true,
true,
range,
(value) => seeks.push(value),
() => {},
50,
), true);
assert.deepEqual(seeks, [5, 10]);
});
test("a failed vendor autoplay attempt is consumed instead of rewinding later", () => {
const gate = createRecordedAutoplayGate();
let seeks = 0;