From 14ed03799618996310edf0048e24ee5aa6c7b2bf Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Mon, 19 Oct 2026 02:34:53 +0000 Subject: [PATCH] test: cover more up-next drag states Cover context drags within the runs on either side of the block while the anchor is the playing track, plus moving the playing up-next track. --- .../playback/PlaybackControllerTest.kt | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/app/src/test/kotlin/com/subtracks/playback/PlaybackControllerTest.kt b/app/src/test/kotlin/com/subtracks/playback/PlaybackControllerTest.kt index 52b226fd..e65c7c3a 100644 --- a/app/src/test/kotlin/com/subtracks/playback/PlaybackControllerTest.kt +++ b/app/src/test/kotlin/com/subtracks/playback/PlaybackControllerTest.kt @@ -621,6 +621,50 @@ class PlaybackControllerTest { } } + @Test + fun draggingWithinTheContextRunsAroundTheBlockKeepsPlayerAndQueueInSync() { + seedAlbum(5, sourceId = 1) + seedSong("x1", "al2") + + controller.playAlbum(1, "al1", 2) + await { + controller.state.value.item + ?.id == "s3" + } + controller.addToQueue(1, QueueKind.Song, "x1") + await { runBlocking { controller.upcomingItem()?.id } == "x1" } + + runBlocking { controller.move(0, 1) } + + var expected = + runBlocking { + val snapshot = queues.snapshot() + (0 until snapshot.size).mapNotNull { queues.itemAt(snapshot, it)?.song?.id } + } + assertEquals(expected, handle.items.map { it.id }) + assertEquals( + "s3", + controller.state.value.item + ?.id, + ) + assertEquals(expected.indexOf("s3").toLong(), controller.state.value.position) + + runBlocking { controller.move(4, 5) } + + expected = + runBlocking { + val snapshot = queues.snapshot() + (0 until snapshot.size).mapNotNull { queues.itemAt(snapshot, it)?.song?.id } + } + assertEquals(expected, handle.items.map { it.id }) + assertEquals( + "s3", + controller.state.value.item + ?.id, + ) + assertEquals(expected.indexOf("s3").toLong(), controller.state.value.position) + } + @Test fun movingThePlayingUpNextTrackInTheBlockKeepsPlayerAndQueueInSync() { seedAlbum(5, sourceId = 1)