Add voice broadcast playback seekbar (#9529)

This commit is contained in:
Michael Weimann 2022-11-04 11:50:19 +01:00 committed by GitHub
parent 04bc8fb71c
commit 66d0b318bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 339 additions and 70 deletions

View file

@ -65,6 +65,18 @@ describe("VoiceBroadcastChunkEvents", () => {
expect(chunkEvents.getLength()).toBe(3259);
});
it("getLengthTo(first event) should return 0", () => {
expect(chunkEvents.getLengthTo(eventSeq1Time1)).toBe(0);
});
it("getLengthTo(some event) should return the time excl. that event", () => {
expect(chunkEvents.getLengthTo(eventSeq3Time2)).toBe(7 + 3141);
});
it("getLengthTo(last event) should return the time excl. that event", () => {
expect(chunkEvents.getLengthTo(eventSeq4Time1)).toBe(7 + 3141 + 42);
});
it("should return the expected next chunk", () => {
expect(chunkEvents.getNext(eventSeq2Time4Dup)).toBe(eventSeq3Time2);
});
@ -72,6 +84,18 @@ describe("VoiceBroadcastChunkEvents", () => {
it("should return undefined for next last chunk", () => {
expect(chunkEvents.getNext(eventSeq4Time1)).toBeUndefined();
});
it("findByTime(0) should return the first chunk", () => {
expect(chunkEvents.findByTime(0)).toBe(eventSeq1Time1);
});
it("findByTime(some time) should return the chunk with this time", () => {
expect(chunkEvents.findByTime(7 + 3141 + 21)).toBe(eventSeq3Time2);
});
it("findByTime(entire duration) should return the last chunk", () => {
expect(chunkEvents.findByTime(7 + 3141 + 42 + 69)).toBe(eventSeq4Time1);
});
});
describe("when adding events where at least one does not have a sequence", () => {