mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
address second review: shuffle cache invalidation, locking, ended latch
This commit is contained in:
@@ -321,7 +321,7 @@ class QueueRepositoryTest {
|
||||
(0 until snapshot.size).mapNotNull { repository.itemAt(snapshot, it)?.song?.id }
|
||||
|
||||
@Test
|
||||
fun aStaleShuffleOrderIsDroppedWhenTheQueueLengthChanges() =
|
||||
fun aStaleShuffleOrderIsIgnoredWhenTheQueueLengthChanges() =
|
||||
runTest {
|
||||
seedLibrary()
|
||||
repository.replace(listOf(repository.albumEntry(1, "al1")))
|
||||
@@ -331,7 +331,6 @@ class QueueRepositoryTest {
|
||||
db.libraryDao().upsertSongs(listOf(song("s6", "al1", track = 4, album = "First Album")))
|
||||
|
||||
assertFalse(repository.snapshot().shuffled)
|
||||
assertFalse(repository.modes().shuffle)
|
||||
}
|
||||
|
||||
private suspend fun seedLibrary() {
|
||||
|
||||
@@ -819,6 +819,27 @@ class PlaybackControllerTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun repeatAllLoopsAfterEndingWithRepeatOff() {
|
||||
seedAlbum(2, sourceId = 1)
|
||||
|
||||
controller.playAlbum(1, "al1", 0)
|
||||
await { controller.state.value.isPlaying }
|
||||
|
||||
handle.finish()
|
||||
handle.emitEvents()
|
||||
await { !controller.state.value.isPlaying }
|
||||
|
||||
controller.togglePlayPause()
|
||||
await { controller.state.value.isPlaying }
|
||||
controller.cycleRepeat()
|
||||
assertEquals(RepeatMode.All, controller.state.value.repeat)
|
||||
|
||||
handle.finish()
|
||||
handle.emitEvents()
|
||||
await { controller.state.value.isPlaying }
|
||||
}
|
||||
|
||||
private fun seedAlbum(
|
||||
count: Int,
|
||||
sourceId: Long,
|
||||
|
||||
Reference in New Issue
Block a user