mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
fix drag drop target, serialize queue edits, guard empty ranges
This commit is contained in:
@@ -437,6 +437,49 @@ class PlaybackControllerTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun movingTracksFarFromThePlayingOneDoesNotReloadTheWindow() {
|
||||
seedAlbum(100, sourceId = 1)
|
||||
|
||||
controller.playAlbum(1, "al1", 50)
|
||||
await {
|
||||
controller.state.value.item
|
||||
?.id == "s51"
|
||||
}
|
||||
handle.operations.clear()
|
||||
|
||||
runBlocking { controller.move(80, 90) }
|
||||
|
||||
assertEquals(
|
||||
"s51",
|
||||
controller.state.value.item
|
||||
?.id,
|
||||
)
|
||||
assertEquals(50L, controller.state.value.position)
|
||||
assertFalse(handle.operations.any { it.startsWith("setWindow") })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun movingATrackAcrossTheWindowKeepsPlaying() {
|
||||
seedAlbum(100, sourceId = 1)
|
||||
|
||||
controller.playAlbum(1, "al1", 50)
|
||||
await {
|
||||
controller.state.value.item
|
||||
?.id == "s51"
|
||||
}
|
||||
handle.operations.clear()
|
||||
|
||||
runBlocking { controller.move(10, 90) }
|
||||
|
||||
assertEquals(
|
||||
"s51",
|
||||
controller.state.value.item
|
||||
?.id,
|
||||
)
|
||||
assertFalse(handle.operations.any { it.startsWith("setWindow") })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun undoRestoresARemovedTrack() {
|
||||
seedAlbum(5, sourceId = 1)
|
||||
|
||||
@@ -82,6 +82,22 @@ class QueueViewModelTest {
|
||||
assertEquals((40L..199L).toList(), viewModel.rows.map { it.position })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun openingAtTheEndLoadsASingleRowAndExtendsOlder() {
|
||||
runBlocking { seedSongs(200) }
|
||||
controller.playSongs(1, 199)
|
||||
await { controller.state.value.position == 199L }
|
||||
|
||||
viewModel.open()
|
||||
await { viewModel.ready }
|
||||
|
||||
assertEquals(listOf(199L), viewModel.rows.map { it.position })
|
||||
|
||||
viewModel.loadOlder()
|
||||
await { viewModel.rows.firstOrNull()?.position == 139L }
|
||||
assertEquals((139L..199L).toList(), viewModel.rows.map { it.position })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun reorderingMovesTheRowLocally() {
|
||||
runBlocking { seedSongs(200) }
|
||||
|
||||
Reference in New Issue
Block a user