store the shuffle order in a table with a cache; keep previous at the start unless repeating

This commit is contained in:
austinried
2026-10-04 00:29:55 +00:00
parent b5799d7202
commit 8bd07e4332
8 changed files with 127 additions and 34 deletions
@@ -689,7 +689,7 @@ class PlaybackControllerTest {
}
@Test
fun previousFromTheStartWrapsToTheLastTrack() {
fun previousFromTheStartRestartsWithoutRepeat() {
seedAlbum(3, sourceId = 1)
controller.playAlbum(1, "al1", 0)
@@ -698,6 +698,27 @@ class PlaybackControllerTest {
?.id == "s1"
}
controller.previous()
assertTrue(handle.operations.contains("seekTo(0)"))
assertEquals(
"s1",
controller.state.value.item
?.id,
)
}
@Test
fun previousFromTheStartWrapsWithRepeatAll() {
seedAlbum(3, sourceId = 1)
controller.playAlbum(1, "al1", 0)
await {
controller.state.value.item
?.id == "s1"
}
controller.cycleRepeat()
controller.previous()
await {
controller.state.value.item