mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
fix: uppercase section headings in the app language (#1148)
* fix: uppercase section headings in the app language * fix: localize store section headings
This commit is contained in:
1 parent
da916e7ed7
commit
c2a3740237
3 files changed
+53
-3
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.LocaleList
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.test.onAllNodesWithText
|
||||
import androidx.compose.ui.test.assertCountEquals
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import java.util.Locale
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28])
|
||||
class HeadingLocaleTest {
|
||||
@get:Rule val compose = createRobolectricComposeRule()
|
||||
|
||||
@Test fun headingsFollowTheAppLanguageAndRecomposeWhenItChanges() {
|
||||
val appLocale = mutableStateOf(Locale.forLanguageTag("tr"))
|
||||
compose.setContent {
|
||||
val configuration = Configuration(LocalConfiguration.current).apply {
|
||||
setLocales(LocaleList(appLocale.value))
|
||||
}
|
||||
CompositionLocalProvider(LocalConfiguration provides configuration) {
|
||||
DroidDeckTheme {
|
||||
Column {
|
||||
Eyebrow("Bileşenler Iİıi")
|
||||
SectionTitle("Bileşenler Iİıi", null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
compose.onAllNodesWithText("BİLEŞENLER IİIİ").assertCountEquals(2)
|
||||
compose.runOnIdle { appLocale.value = Locale.ENGLISH }
|
||||
compose.onAllNodesWithText("BILEŞENLER IİII").assertCountEquals(2)
|
||||
compose.runOnIdle { appLocale.value = Locale.forLanguageTag("tr") }
|
||||
compose.onAllNodesWithText("BİLEŞENLER IİIİ").assertCountEquals(2)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user