Merge pull request #825 from eseidelGoogle/locale_test
Add a test to stocks for changing the locale
This commit is contained in:
@@ -29,7 +29,7 @@ class _PointerState {
|
||||
_pointerCount += 1;
|
||||
_pointer = _pointerCount;
|
||||
}
|
||||
|
||||
|
||||
bool get down => _down;
|
||||
bool _down = false;
|
||||
void setDown() {
|
||||
@@ -248,8 +248,12 @@ class FlutterBinding extends HitTestTarget {
|
||||
}
|
||||
|
||||
void _handleLocaleChanged() {
|
||||
dispatchLocaleChanged(ui.window.locale);
|
||||
}
|
||||
|
||||
void dispatchLocaleChanged(ui.Locale locale) {
|
||||
for (BindingObserver observer in _observers)
|
||||
observer.didChangeLocale(ui.window.locale);
|
||||
observer.didChangeLocale(locale);
|
||||
}
|
||||
|
||||
void _handlePersistentFrameCallback(Duration timeStamp) {
|
||||
|
||||
@@ -32,6 +32,12 @@ class WidgetTester {
|
||||
pump(duration);
|
||||
}
|
||||
|
||||
void setLocale(String languageCode, String countryCode) {
|
||||
ui.Locale locale = new ui.Locale(languageCode, countryCode);
|
||||
FlutterBinding.instance.dispatchLocaleChanged(locale);
|
||||
async.flushMicrotasks();
|
||||
}
|
||||
|
||||
void pump([ Duration duration ]) {
|
||||
if (duration != null)
|
||||
async.elapse(duration);
|
||||
|
||||
Reference in New Issue
Block a user