mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
group the downloads tree by the album's artist
The tree read the track artist off each song, so a downloaded album split into one group per guest performer and every song without a track artist landed in "Unknown artist". It reads the album's artist now, which is also the artist the node's delete resolves through, so the two agree. The badges are white glyphs with a dark outline and a progress ring with a visible track, after a look at the rendered result; larger and clearer than the first pass, which the art swallowed.
This commit is contained in:
@@ -816,6 +816,41 @@ class DownloadRepositoryTest {
|
||||
assertFalse(file(1, "s2").exists())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theTreeGroupsAnAlbumUnderItsAlbumArtistNotEachTrackArtist() =
|
||||
runTest {
|
||||
seedLibrary()
|
||||
runBlocking {
|
||||
db.libraryDao().upsertSongs(
|
||||
listOf(
|
||||
Song(
|
||||
sourceId = 1,
|
||||
id = "s3",
|
||||
albumId = "al1",
|
||||
artistId = "ar-guest",
|
||||
title = "Song 3",
|
||||
album = "Album",
|
||||
artist = "Guest",
|
||||
duration = 100,
|
||||
track = 3,
|
||||
disc = 1,
|
||||
starred = null,
|
||||
genre = null,
|
||||
),
|
||||
),
|
||||
)
|
||||
db.libraryDao().upsertArtists(
|
||||
listOf(Artist(sourceId = 1, id = "ar-guest", name = "Guest", albumCount = 0, starred = null, coverArt = null)),
|
||||
)
|
||||
db.downloadDao().upsert(SongDownload(1, "s1", DownloadStatus.Completed))
|
||||
db.downloadDao().upsert(SongDownload(1, "s3", DownloadStatus.Completed))
|
||||
}
|
||||
|
||||
val songs = runBlocking { repository.downloadedSongs(1).first() }
|
||||
|
||||
assertEquals(setOf("ar1" to "Artist"), songs.map { it.artistId to it.artistName }.toSet())
|
||||
}
|
||||
|
||||
private fun requestedSongIds(): List<String> = engine.requests.map { it.second.path.substringAfterLast('/') }
|
||||
|
||||
private fun seedSongs(tracks: IntRange) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.github.takahirom.roborazzi.captureRoboImage
|
||||
import com.subtracks.data.model.Album
|
||||
import com.subtracks.data.model.Artist
|
||||
import com.subtracks.data.model.CoverArtRef
|
||||
import com.subtracks.data.model.ListDownloadStatus
|
||||
import com.subtracks.data.model.Playlist
|
||||
import com.subtracks.data.model.PlaylistSongItem
|
||||
import com.subtracks.data.model.Song
|
||||
@@ -125,6 +126,37 @@ class AppScreenshotTest {
|
||||
composeRule.onRoot().captureRoboImage("src/test/screenshots/library_scrolled_under_header.png")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun libraryAlbumsWithDownloads() {
|
||||
val ids = Fixtures.albums.take(3).map { it.id }
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
LibraryScreen(
|
||||
selectedTab = LibraryTab.Albums,
|
||||
onTabSelected = {},
|
||||
albums = remember { flowOf(PagingData.from(Fixtures.albums)) },
|
||||
artists = remember { flowOf(PagingData.empty<Artist>()) },
|
||||
playlists = remember { flowOf(PagingData.empty<Playlist>()) },
|
||||
coverArt = { id, _ -> id?.let { CoverArtRef(it, "test:$it") } },
|
||||
onAlbumClick = {},
|
||||
onArtistClick = {},
|
||||
onPlaylistClick = {},
|
||||
onSync = {},
|
||||
onOpenSettings = {},
|
||||
artwork = artworkColorsFromSeed(Color.rgb(120, 80, 200)),
|
||||
albumDownloads =
|
||||
mapOf(
|
||||
ids[0] to ListDownloadStatus(total = 10, downloaded = 10),
|
||||
ids[1] to ListDownloadStatus(total = 10, downloaded = 4, downloading = 1),
|
||||
ids[2] to ListDownloadStatus(total = 10, downloaded = 4),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
awaitTag(ALBUM_COVER_TAG)
|
||||
composeRule.onRoot().captureRoboImage("src/test/screenshots/library_albums_downloads.png")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun libraryArtists() {
|
||||
setLibraryContent(LibraryTab.Artists)
|
||||
|
||||
Reference in New Issue
Block a user