From 75af91f7b750e0ba1eaa9883a67801aefe0cf500 Mon Sep 17 00:00:00 2001 From: Vanilagy <1696106+Vanilagy@users.noreply.github.com> Date: Thu, 18 Dec 2025 18:02:35 +0100 Subject: [PATCH] Validate nextKey behavior for audio tracks --- test/browser/sample-cursor.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/browser/sample-cursor.test.ts b/test/browser/sample-cursor.test.ts index 0e50aad..e45b9b73 100644 --- a/test/browser/sample-cursor.test.ts +++ b/test/browser/sample-cursor.test.ts @@ -996,6 +996,18 @@ test('AudioSampleCursor', async () => { // One pump was used for all the above commands, even tho they all seek to different key packets expect(cursor.debugInfo.pumpsStarted).toBe(4); + await cursor.seekToFirst(); + const nextSample = (await cursor.nextKey())!; // nextKey acts like next for audio tracks + const nextNextSample = (await cursor.nextKey())!; + expect(nextSample.timestamp).toBeCloseTo(firstSample.timestamp + firstSample.duration); + expect(nextNextSample.timestamp).toBeCloseTo(nextSample.timestamp + firstSample.duration); + + await cursor.seekToFirst(); + const actualNextSample = (await cursor.next())!; + expect(nextSample.timestamp).toBe(actualNextSample.timestamp); + + expect(cursor.debugInfo.pumpsStarted).toBe(6); + await cursor.close(); expect(AudioSample._openSampleCount).toBe(0);