mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Split tests for computePlatformResolvedLocale with N (flutter/engine#32385)
This commit is contained in:
parent
3dc1430a3b
commit
f2e7fb8cca
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user