Split tests for computePlatformResolvedLocale with N (flutter/engine#32385)

This commit is contained in:
utzcoz 2022-04-08 04:11:04 +08:00 committed by GitHub
parent 3dc1430a3b
commit f2e7fb8cca
2 changed files with 6 additions and 6 deletions

View File

@ -1212,7 +1212,7 @@ public class FlutterJNI {
String languageCode = strings[i + 0];
String countryCode = strings[i + 1];
String scriptCode = strings[i + 2];
// Convert to Locales via LocaleBuilder if available (API 24+) to include scriptCode.
// Convert to Locales via LocaleBuilder if available (API 21+) to include scriptCode.
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Locale.Builder localeBuilder = new Locale.Builder();
if (!languageCode.isEmpty()) {
@ -1226,7 +1226,7 @@ public class FlutterJNI {
}
supportedLocales.add(localeBuilder.build());
} else {
// Pre-API 24, we fall back on scriptCode-less locales.
// Pre-API 21, we fall back on scriptCode-less locales.
supportedLocales.add(new Locale(languageCode, countryCode));
}
}

View File

@ -140,8 +140,8 @@ public class LocalizationPluginTest {
// This test should be synced with the version for API 26.
@Test
@Config(sdk = Build.VERSION_CODES.N)
public void computePlatformResolvedLocaleAPI24() {
@Config(minSdk = Build.VERSION_CODES.N)
public void computePlatformResolvedLocale_fromAndroidN() {
// --- Test Setup ---
FlutterJNI flutterJNI = new FlutterJNI();
@ -235,8 +235,8 @@ public class LocalizationPluginTest {
// Tests the legacy pre API 24 algorithm.
@Test
@Config(sdk = Build.VERSION_CODES.JELLY_BEAN)
public void computePlatformResolvedLocaleAPI16() {
@Config(minSdk = Build.VERSION_CODES.JELLY_BEAN, maxSdk = Build.VERSION_CODES.M)
public void computePlatformResolvedLocale_beforeAndroidN() {
// --- Test Setup ---
FlutterJNI flutterJNI = new FlutterJNI();