mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
share the artist song ordering and pin it with a test
This commit is contained in:
@@ -191,8 +191,8 @@ interface QueueDao {
|
||||
@Query(
|
||||
"SELECT songs.id FROM songs " +
|
||||
"JOIN albums ON albums.sourceId = songs.sourceId AND albums.id = songs.albumId " +
|
||||
"WHERE songs.sourceId = :sourceId AND albums.artistId = :artistId " +
|
||||
"ORDER BY albums.year DESC, albums.name COLLATE NOCASE, albums.id, songs.disc, songs.track, songs.id",
|
||||
"WHERE songs.sourceId = :sourceId AND albums.artistId = :artistId" +
|
||||
ARTIST_SONGS_ORDER,
|
||||
)
|
||||
suspend fun artistSongIds(
|
||||
sourceId: Long,
|
||||
|
||||
@@ -2282,6 +2282,19 @@ class PlaybackControllerTest {
|
||||
assertEquals(setOf("a1", "a2", "a3", "b1", "b2"), handle.items.map { it.id }.toSet())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun artistQueueRowsFollowTheFlatShuffleIdOrder() {
|
||||
seedArtist()
|
||||
runBlocking { queues.replace(listOf(queues.artistEntry(1, "ar1"))) }
|
||||
|
||||
val snapshot = runBlocking { queues.snapshot() }
|
||||
val paged = (0 until snapshot.size).map { runBlocking { queues.itemAt(snapshot, it)?.song?.id } }
|
||||
val flat = runBlocking { db.queueDao().artistSongIds(1, "ar1") }
|
||||
|
||||
assertEquals(listOf("b1", "b2", "a1", "a2", "a3"), flat)
|
||||
assertEquals(flat, paged)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun restoringResumesFromTheSavedPosition() {
|
||||
seedAlbum(3, sourceId = 1)
|
||||
|
||||
Reference in New Issue
Block a user