ui: drop bio justification and normalize cached biographies

Read normalization heals biographies cached before line breaks were preserved, without waiting for a refresh.
This commit is contained in:
austinried
2026-10-19 13:55:16 +00:00
parent 028685d62b
commit 77190a2af1
4 changed files with 17 additions and 61 deletions
@@ -338,6 +338,16 @@ class LibraryRepositoryTest {
assertNull(normalizeBiography(" "))
}
@Test
fun aPreviouslyStoredBioIsNormalizedWhenRead() =
runBlocking {
withSource {
val sourceId = sourceRepository.activeSourceIdOnce()!!
db.libraryDao().upsertArtistBio(ArtistBio(sourceId, "ar1", "One Two"))
assertEquals("One\n\nTwo", repository.artistBio(sourceId, "ar1").first()?.biography)
}
}
@Test
fun aFailedRefreshKeepsTheStoredBio() =
runBlocking {
@@ -17,7 +17,6 @@ import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollTo
import androidx.compose.ui.test.performScrollToNode
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.rememberTextMeasurer
import androidx.compose.ui.unit.sp
@@ -330,27 +329,6 @@ class ArtistDetailScreenTest {
assertEquals(listOf("First paragraph.", "", "Second paragraph."), paragraphBreak)
}
@Test
fun aJustifiedLineFillsTheAvailableWidth() {
val style = TextStyle(fontSize = 14.sp)
var plainWidth = 0
var justifiedWidth = 0
var justified = ""
composeRule.setContent {
val measurer = rememberTextMeasurer()
val line = AnnotatedString("one two three four five")
plainWidth = measurer.measure(line, style, maxLines = 1).size.width
val result = justifyBioLine(line, measurer, style, 400)
justifiedWidth = measurer.measure(result, style, maxLines = 1).size.width
justified = result.text
}
composeRule.waitForIdle()
assertTrue(justifiedWidth > plainWidth)
assertTrue(justifiedWidth <= 400)
assertTrue(justified.contains(" "))
}
private fun album(
id: String,
name: String,