mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 05:46:03 +00:00
fix(music): hide the Favorites soundtrack collection until it has a track (#2835)
The Favorites collection in the music tab was always listed, even when no tracks had been favorited. - Favorites is now only listed in the Collections source once it has at least one track - With no favorites and no other collections, the Collections tab no longer shows - Adding a track to Favorites brings it back - The collection detail page still resolves Favorites by id, so an already-open page does not close when its last track is removed Adds a test for the empty, populated and other-collections cases.
This commit is contained in:
3 files changed
+16
-4
No files matched your search
@@ -40,4 +40,15 @@ class SoundtrackCollectionsTest {
|
||||
val list = listOf(Collection(2_000_000_005, "x", emptyList()))
|
||||
assertEquals(2_000_000_006, SoundtrackCollections.nextId(list))
|
||||
}
|
||||
|
||||
@Test fun emptyFavoritesCanBeLeftOutOfTheLibraryList() {
|
||||
val context = androidx.test.core.app.ApplicationProvider.getApplicationContext<android.content.Context>()
|
||||
SoundtrackCollections.load(context)
|
||||
val custom = SoundtrackCollections.create(context, "Chill", emptyList())!!
|
||||
val favorites = SoundtrackCollections.FAVORITES_ID
|
||||
assertEquals(listOf(custom), SoundtrackCollections.games(context, "Favorites", skipEmptyFavorites = true).map { it.appId })
|
||||
assertEquals(listOf(favorites, custom), SoundtrackCollections.games(context, "Favorites").map { it.appId })
|
||||
SoundtrackCollections.add(context, favorites, listOf(ref("a")))
|
||||
assertEquals(listOf(favorites, custom), SoundtrackCollections.games(context, "Favorites", skipEmptyFavorites = true).map { it.appId })
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user