mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-15 00:42:54 +01:00
playback: resolve the pending tap preference inside the start lock
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user