diff --git a/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt b/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt index 94efc81096..09fce5bcdf 100644 --- a/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt +++ b/app/src/main/kotlin/org/cru/godtools/ui/languages/LanguageName+Previews.kt @@ -5,6 +5,7 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview import java.util.Locale +import org.cru.godtools.model.Language @Composable @Preview(locale = "en", showBackground = true) @@ -14,6 +15,7 @@ private fun LeftToRightLanguageNames() = Column { LanguageName(Locale.forLanguageTag("bs-BA")) HorizontalDivider() LanguageName(Locale.ENGLISH) + LanguageName(language = forcedNameLanguage) } @Composable @@ -24,4 +26,11 @@ private fun RightToLeftLanguageNames() = Column { LanguageName(Locale.forLanguageTag("bs-BA")) HorizontalDivider() LanguageName(Locale.ENGLISH) + LanguageName(language = forcedNameLanguage) } + +private val forcedNameLanguage = Language( + code = Locale.ENGLISH, + name = "German", + isForcedName = true, +) diff --git a/app/src/testDebug/kotlin/org/cru/godtools/ui/languages/LanguageNamePaparazziTest.kt b/app/src/testDebug/kotlin/org/cru/godtools/ui/languages/LanguageNamePaparazziTest.kt new file mode 100644 index 0000000000..37af428a70 --- /dev/null +++ b/app/src/testDebug/kotlin/org/cru/godtools/ui/languages/LanguageNamePaparazziTest.kt @@ -0,0 +1,39 @@ +package org.cru.godtools.ui.languages + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.android.ide.common.rendering.api.SessionParams.RenderingMode +import com.android.resources.NightMode +import com.google.testing.junit.testparameterinjector.TestParameter +import com.google.testing.junit.testparameterinjector.TestParameterInjector +import java.util.Locale +import org.cru.godtools.model.Language +import org.cru.godtools.ui.BasePaparazziTest +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(TestParameterInjector::class) +class LanguageNamePaparazziTest(@TestParameter nightMode: NightMode) : + BasePaparazziTest(nightMode = nightMode, renderingMode = RenderingMode.SHRINK) { + private val forcedNameLanguage = Language( + code = Locale.ENGLISH, + name = "German", + isForcedName = true, + ) + + @Test + fun `LanguageNames()`() = centerInSnapshot { + Column(Modifier.padding(16.dp)) { + LanguageName(Locale("ar")) + HorizontalDivider() + LanguageName(Locale.forLanguageTag("bs-BA")) + HorizontalDivider() + LanguageName(Locale.ENGLISH) + HorizontalDivider() + LanguageName(language = forcedNameLanguage) + } + } +}