playback: resolve the pending tap preference inside the start lock

This commit is contained in:
austinried
2026-11-12 07:53:06 +00:00
parent 2bbff7e477
commit d05fb6fc07
2 changed files with 35 additions and 10 deletions
@@ -2613,6 +2613,34 @@ class PlaybackControllerTest {
assertEquals(1L, slowController.state.value.position)
}
@Test
fun aSongTappedWhileThePlayerConnectsKeepsItsOrder() {
seedAlbum(3, sourceId = 1)
val (slowPrefs, entered, gate) = gatedSongTapPreferences()
val slowController =
PlaybackController(
sources,
queues,
FakePlayerConnection(handle),
downloads,
slowPrefs,
scope = CoroutineScope(SupervisorJob() + dispatcher).also { extraScopes += it },
)
slowController.playAlbum(1, "al1", 0)
runBlocking { entered.await() }
slowController.playAlbum(1, "al1", 1)
gate.complete(Unit)
runBlocking { delay(1_000) }
assertEquals(
"s2",
slowController.state.value.item
?.id,
)
assertEquals(1L, slowController.state.value.position)
}
@Test
fun jumpingInTheQueueWhileShuffledKeepsTheOrder() {
seedAlbum(5, sourceId = 1)