mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
test: pin independent artist and artist sort rows
The info rows do not depend on each other: a track with artists but no artist sort keeps the artists row, and a track with an artist sort but no artist name still shows the sort row. Pin both so a later label or value change cannot start requiring both.
This commit is contained in:
@@ -303,18 +303,64 @@ class LibraryInfoDialogTest {
|
|||||||
composeRule.onNodeWithText("Artist sort").assertDoesNotExist()
|
composeRule.onNodeWithText("Artist sort").assertDoesNotExist()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun aMixedArtistTrackWithoutASortShowsOnlyTheArtistsRow() {
|
||||||
|
composeRule.setContent {
|
||||||
|
SubtracksTheme {
|
||||||
|
SongInfoDialog(
|
||||||
|
song =
|
||||||
|
song(
|
||||||
|
artists = listOf(ArtistRef("ar1", "Artist A"), ArtistRef("ar2", "Artist B")),
|
||||||
|
artistSort = "",
|
||||||
|
),
|
||||||
|
download = null,
|
||||||
|
localFile = null,
|
||||||
|
streamEncoding = null,
|
||||||
|
onDismiss = {},
|
||||||
|
genres = emptyList(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
composeRule.onNodeWithText("Artists").assertIsDisplayed()
|
||||||
|
composeRule.onNodeWithText("Artist A · Artist B").assertIsDisplayed()
|
||||||
|
composeRule.onNodeWithText("Artists sort").assertDoesNotExist()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun aTrackWithOnlyAnArtistSortShowsOnlyTheSortRow() {
|
||||||
|
composeRule.setContent {
|
||||||
|
SubtracksTheme {
|
||||||
|
SongInfoDialog(
|
||||||
|
song = song(artists = emptyList(), artist = null, artistSort = "Alpha"),
|
||||||
|
download = null,
|
||||||
|
localFile = null,
|
||||||
|
streamEncoding = null,
|
||||||
|
onDismiss = {},
|
||||||
|
genres = emptyList(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
composeRule.onNodeWithText("Artist sort").assertIsDisplayed()
|
||||||
|
composeRule.onNodeWithText("Alpha").assertIsDisplayed()
|
||||||
|
composeRule.onNodeWithText("Artist").assertDoesNotExist()
|
||||||
|
composeRule.onNodeWithText("Artists").assertDoesNotExist()
|
||||||
|
}
|
||||||
|
|
||||||
private fun song(
|
private fun song(
|
||||||
artists: List<ArtistRef>,
|
artists: List<ArtistRef>,
|
||||||
|
artist: String? = artists.firstOrNull()?.name,
|
||||||
sortName: String = "Song",
|
sortName: String = "Song",
|
||||||
artistSort: String = "Artist",
|
artistSort: String = artist.orEmpty(),
|
||||||
) = Song(
|
) = Song(
|
||||||
sourceId = 1,
|
sourceId = 1,
|
||||||
id = "s1",
|
id = "s1",
|
||||||
albumId = "al1",
|
albumId = "al1",
|
||||||
artistId = artists.first().id,
|
artistId = artists.firstOrNull()?.id,
|
||||||
title = "Song",
|
title = "Song",
|
||||||
album = "Album",
|
album = "Album",
|
||||||
artist = artists.first().name,
|
artist = artist,
|
||||||
duration = 200,
|
duration = 200,
|
||||||
track = 1,
|
track = 1,
|
||||||
disc = 1,
|
disc = 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user