mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
rebuild the queue window from the shuffled snapshot when starting a shuffled queue
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user