mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
test: cover more up-next drag states
Cover context drags within the runs on either side of the block while the anchor is the playing track, plus moving the playing up-next track.
This commit is contained in:
@@ -621,6 +621,50 @@ class PlaybackControllerTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun draggingWithinTheContextRunsAroundTheBlockKeepsPlayerAndQueueInSync() {
|
||||||
|
seedAlbum(5, sourceId = 1)
|
||||||
|
seedSong("x1", "al2")
|
||||||
|
|
||||||
|
controller.playAlbum(1, "al1", 2)
|
||||||
|
await {
|
||||||
|
controller.state.value.item
|
||||||
|
?.id == "s3"
|
||||||
|
}
|
||||||
|
controller.addToQueue(1, QueueKind.Song, "x1")
|
||||||
|
await { runBlocking { controller.upcomingItem()?.id } == "x1" }
|
||||||
|
|
||||||
|
runBlocking { controller.move(0, 1) }
|
||||||
|
|
||||||
|
var expected =
|
||||||
|
runBlocking {
|
||||||
|
val snapshot = queues.snapshot()
|
||||||
|
(0 until snapshot.size).mapNotNull { queues.itemAt(snapshot, it)?.song?.id }
|
||||||
|
}
|
||||||
|
assertEquals(expected, handle.items.map { it.id })
|
||||||
|
assertEquals(
|
||||||
|
"s3",
|
||||||
|
controller.state.value.item
|
||||||
|
?.id,
|
||||||
|
)
|
||||||
|
assertEquals(expected.indexOf("s3").toLong(), controller.state.value.position)
|
||||||
|
|
||||||
|
runBlocking { controller.move(4, 5) }
|
||||||
|
|
||||||
|
expected =
|
||||||
|
runBlocking {
|
||||||
|
val snapshot = queues.snapshot()
|
||||||
|
(0 until snapshot.size).mapNotNull { queues.itemAt(snapshot, it)?.song?.id }
|
||||||
|
}
|
||||||
|
assertEquals(expected, handle.items.map { it.id })
|
||||||
|
assertEquals(
|
||||||
|
"s3",
|
||||||
|
controller.state.value.item
|
||||||
|
?.id,
|
||||||
|
)
|
||||||
|
assertEquals(expected.indexOf("s3").toLong(), controller.state.value.position)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun movingThePlayingUpNextTrackInTheBlockKeepsPlayerAndQueueInSync() {
|
fun movingThePlayingUpNextTrackInTheBlockKeepsPlayerAndQueueInSync() {
|
||||||
seedAlbum(5, sourceId = 1)
|
seedAlbum(5, sourceId = 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user