2019-09-18 15:15:10 +00:00
|
|
|
import { expect } from "chai";
|
2024-05-03 18:31:14 +00:00
|
|
|
import { TimelineValue } from "./TimelineValue.js";
|
2019-09-18 15:15:10 +00:00
|
|
|
|
|
|
|
describe("TimelineValue", () => {
|
|
|
|
it("can be created and disposed", () => {
|
|
|
|
const sched = new TimelineValue(0);
|
|
|
|
sched.dispose();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("can add events to the timeline", () => {
|
|
|
|
const sched = new TimelineValue(10);
|
2024-05-03 18:31:14 +00:00
|
|
|
sched.set(11, 1);
|
|
|
|
sched.set(1, 12);
|
2019-09-18 15:15:10 +00:00
|
|
|
sched.set(3, 4);
|
|
|
|
expect(sched.get(0)).to.equal(10);
|
|
|
|
expect(sched.get(1)).to.equal(11);
|
|
|
|
expect(sched.get(2)).to.equal(11);
|
|
|
|
expect(sched.get(4)).to.equal(3);
|
|
|
|
expect(sched.get(12)).to.equal(1);
|
|
|
|
sched.dispose();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("returns the initial value if there is nothing scheduled", () => {
|
|
|
|
const sched = new TimelineValue(10);
|
|
|
|
expect(sched.get(0)).to.equal(10);
|
|
|
|
sched.dispose();
|
|
|
|
});
|
|
|
|
});
|