mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
home polish: genres by most played in a wrapping flow, tighter album corners, spaced left-aligned artists
This commit is contained in:
@@ -124,22 +124,22 @@ class LibraryHomeDaoTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun genresOrderByMostRecentPlayWithinTheGenre() =
|
||||
fun genresOrderByMostPlayed() =
|
||||
runTest {
|
||||
val sourceId = source()
|
||||
val dao = db.libraryDao()
|
||||
dao.upsertSongs(
|
||||
listOf(
|
||||
song(sourceId, "s1", "One", genre = "Rock", played = 100),
|
||||
song(sourceId, "s2", "Two", genre = "Jazz", played = 400),
|
||||
song(sourceId, "s3", "Three", genre = "Rock", played = 300),
|
||||
song(sourceId, "s4", "Four", genre = "Classical", played = null),
|
||||
song(sourceId, "s1", "One", genre = "Rock", playCount = 5),
|
||||
song(sourceId, "s2", "Two", genre = "Jazz", playCount = 2),
|
||||
song(sourceId, "s3", "Three", genre = "Rock", playCount = 4),
|
||||
song(sourceId, "s4", "Four", genre = "Classical", playCount = 0),
|
||||
),
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
listOf("Jazz", "Rock", "Classical"),
|
||||
dao.genresByRecentPlay(sourceId).first(),
|
||||
listOf("Rock", "Jazz", "Classical"),
|
||||
dao.genresByMostPlayed(sourceId).first(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -150,8 +150,8 @@ class LibraryHomeDaoTest {
|
||||
val dao = db.libraryDao()
|
||||
dao.upsertSongs(
|
||||
listOf(
|
||||
song(sourceId, "s1", "One", genre = "Legacy", played = 100),
|
||||
song(sourceId, "s2", "Two", genre = "Legacy", played = 300),
|
||||
song(sourceId, "s1", "One", genre = "Legacy", playCount = 1),
|
||||
song(sourceId, "s2", "Two", genre = "Legacy", playCount = 3),
|
||||
),
|
||||
)
|
||||
insertGenre(sourceId, "s2", 0, "Rock")
|
||||
@@ -159,7 +159,7 @@ class LibraryHomeDaoTest {
|
||||
|
||||
assertEquals(
|
||||
listOf("Electronic", "Rock", "Legacy"),
|
||||
dao.genresByRecentPlay(sourceId).first(),
|
||||
dao.genresByMostPlayed(sourceId).first(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule
|
||||
import androidx.compose.ui.test.onAllNodesWithText
|
||||
import androidx.compose.ui.test.onRoot
|
||||
import androidx.compose.ui.test.performTouchInput
|
||||
import androidx.compose.ui.test.swipeUp
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.github.takahirom.roborazzi.RobolectricDeviceQualifiers
|
||||
import com.github.takahirom.roborazzi.captureRoboImage
|
||||
@@ -48,6 +50,31 @@ class HomeScreenshotTest {
|
||||
composeRule.onRoot().captureRoboImage("src/test/screenshots/home.png")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun homeGenres() {
|
||||
composeRule.setContent {
|
||||
SubtracksTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize()) {
|
||||
HomeScreen(
|
||||
feed = feed(),
|
||||
coverArt = { _, _ -> null },
|
||||
playingSongId = null,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
composeRule.waitUntil(timeoutMillis = 5_000) {
|
||||
composeRule.onAllNodesWithText("Recently added").fetchSemanticsNodes().isNotEmpty()
|
||||
}
|
||||
repeat(2) {
|
||||
composeRule.onRoot().performTouchInput {
|
||||
swipeUp(startY = centerY + 600f, endY = centerY - 600f, durationMillis = 300)
|
||||
}
|
||||
composeRule.waitForIdle()
|
||||
}
|
||||
composeRule.onRoot().captureRoboImage("src/test/screenshots/home_genres.png")
|
||||
}
|
||||
|
||||
private fun feed() =
|
||||
HomeFeed(
|
||||
recentlyPlayedAlbums = albums("Recent"),
|
||||
|
||||
Reference in New Issue
Block a user