Merge pull request #825 from eseidelGoogle/locale_test

Add a test to stocks for changing the locale
This commit is contained in:
Eric Seidel
2015-12-08 16:34:53 -08:00
5 changed files with 44 additions and 4 deletions

View File

@@ -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) {

View File

@@ -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);