mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-15 00:42:54 +01:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user