rebuild the queue window from the shuffled snapshot when starting a shuffled queue

This commit is contained in:
austinried
2026-10-04 00:29:55 +00:00
parent 8bd07e4332
commit 7236ce76d4
2 changed files with 24 additions and 0 deletions
@@ -522,6 +522,7 @@ class PlaybackController(
start
}
queueRepository.setCursor(position)
this.snapshot = queueRepository.snapshot()
loadWindow(position, autoplay = true)
}
@@ -747,6 +747,29 @@ class PlaybackControllerTest {
}
}
@Test
fun tappingASongWhileShuffledPlaysThatSong() {
seedAlbum(5, sourceId = 1)
controller.playAlbum(1, "al1", 0)
await {
controller.state.value.item
?.id == "s1"
}
controller.toggleShuffle()
await { controller.state.value.shuffle }
controller.playAlbum(1, "al1", 3)
await {
controller.state.value.item
?.id == "s4"
}
assertEquals(0L, controller.state.value.position)
assertEquals("s4", handle.items.first().id)
}
private fun seedAlbum(
count: Int,
sourceId: Long,