mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
test(android): exercise application locale updates
This commit is contained in:
@@ -6,10 +6,10 @@ import ai.openclaw.app.i18n.nativeText
|
||||
import ai.openclaw.app.i18n.resolveNativeText
|
||||
import ai.openclaw.app.i18n.verbatimText
|
||||
import ai.openclaw.app.node.NodePresenceAliveBeacon
|
||||
import ai.openclaw.app.ui.chat.contextMeterThinkingLabel
|
||||
import ai.openclaw.app.ui.formatApprovalDuration
|
||||
import ai.openclaw.app.ui.formatCronWake
|
||||
import ai.openclaw.app.ui.formatUsageUpdated
|
||||
import ai.openclaw.app.ui.chat.contextMeterThinkingLabel
|
||||
import ai.openclaw.app.ui.skillWorkshopStatusLabel
|
||||
import android.os.Build
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
@@ -82,11 +82,11 @@ class NativeStringsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun resolvingStateFlowEmitsWhenThePersistedAppLocaleChanges() =
|
||||
fun resolvingStateFlowEmitsWhenTheAppLocaleChanges() =
|
||||
runBlocking {
|
||||
val app = RuntimeEnvironment.getApplication()
|
||||
NativeStringResources.install(app)
|
||||
persistAppLocales(app, "en")
|
||||
NativeStringResources.install(app)
|
||||
val resolved = MutableStateFlow(nativeText("Mic off")).resolveNativeText()
|
||||
val firstEmission = CompletableDeferred<Unit>()
|
||||
val emissions = mutableListOf<String>()
|
||||
@@ -100,13 +100,14 @@ class NativeStringsTest {
|
||||
|
||||
try {
|
||||
firstEmission.await()
|
||||
persistAppLocales(app, "fr")
|
||||
NativeStringResources.setApplicationLocales(LocaleListCompat.forLanguageTags("fr"))
|
||||
notifyNativeLocaleChanged()
|
||||
collection.join()
|
||||
|
||||
assertEquals(listOf("Mic off", "Micro désactivé"), emissions)
|
||||
} finally {
|
||||
collection.cancel()
|
||||
NativeStringResources.setApplicationLocales(LocaleListCompat.getEmptyLocaleList())
|
||||
app.deleteFile(APP_LOCALES_FILE)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user