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.
This commit is contained in:
austinried
2026-10-19 14:13:22 +00:00
parent e32df2fb08
commit 14ed037996
@@ -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)