New locale resolution algorithm to use full preferred locale list, include scriptCode in Locale. (#23583)
This commit is contained in:
@@ -225,13 +225,25 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||
Duration additionalTime = const Duration(milliseconds: 250),
|
||||
});
|
||||
|
||||
/// Artificially calls dispatchLocaleChanged on the Widget binding,
|
||||
/// Artificially calls dispatchLocalesChanged on the Widget binding,
|
||||
/// then flushes microtasks.
|
||||
///
|
||||
/// Passes only one single Locale. Use [setLocales] to pass a full preferred
|
||||
/// locales list.
|
||||
Future<void> setLocale(String languageCode, String countryCode) {
|
||||
return TestAsyncUtils.guard<void>(() async {
|
||||
assert(inTest);
|
||||
final Locale locale = Locale(languageCode, countryCode);
|
||||
dispatchLocaleChanged(locale);
|
||||
final Locale locale = Locale(languageCode, countryCode == '' ? null : countryCode);
|
||||
dispatchLocalesChanged(<Locale>[locale]);
|
||||
});
|
||||
}
|
||||
|
||||
/// Artificially calls dispatchLocalesChanged on the Widget binding,
|
||||
/// then flushes microtasks.
|
||||
Future<void> setLocales(List<Locale> locales) {
|
||||
return TestAsyncUtils.guard<void>(() async {
|
||||
assert(inTest);
|
||||
dispatchLocalesChanged(locales);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user