mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +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
|
start
|
||||||
}
|
}
|
||||||
queueRepository.setCursor(position)
|
queueRepository.setCursor(position)
|
||||||
|
this.snapshot = queueRepository.snapshot()
|
||||||
loadWindow(position, autoplay = true)
|
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(
|
private fun seedAlbum(
|
||||||
count: Int,
|
count: Int,
|
||||||
sourceId: Long,
|
sourceId: Long,
|
||||||
|
|||||||
Reference in New Issue
Block a user