Flutter test and unplugged phone failing on specific locales

62 Views Asked by At

I am designing localization support in my flutter app and noticed an issue when running widget tests. In my widgetTests I set the local test value prior to pumpWidget (tester.platformDispatcher.localesTestValue = [...]). After a pumpAndSettle call I then ask the HomePage to report its locale and verify it with my expected value. This test works great on Locales like 'en', 'de', 'es' and 'fr'. However when I run 'ar', 'fa' or 'be' (non-latin scripts - both LTR and RTL) the test fails with the message that my HomePage was not found. Some analysis and a debugDumpApp() call reports that the pumpAndSettle command is only pumping 1x instead of 2x (as with 'en', 'de' ...) and the app doesn't make it past the following lines (last few lines of the debugDumpApp call):

... └Semantics(container: false, properties: SemanticsProperties, tooltip: null, renderObject: RenderSemanticsAnnotations#a6ea1) └Localizations(locale: ar, delegates [_AppLocalizationsDelegate[AppLocalizations], GlobalMaterialLocalizations.delegate(79 locales), GlobalCupertinoLocalizations.delegate(78 locales), GlobalWidgetsLocalizations.delegate(79 locales), LocaleNamesLocalizations Delegate[LocaleNames], DefaultMaterialLocalizations.delegate(en_US), DefaultCupertinoLocalizations.delegate(en_US), DefaultWidgetsLocalizations.delegate(en_US)], state: _LocalizationsState#89e88) └SizedBox.shrink(renderObject: RenderConstrainedBox#63f54)

All locales work when running the app from AndroidStudio on my device. However, by accident I noticed that once I unplug the phone locale support for 'ar', 'fa' and 'be' also fails. Note: The locales work when running it on a phone from Android Studio; the locales also work when stopping the app in AndroidStudio, but with the device still connected to my Windows laptop; the locales stop working when the device is unplugged.

I am not using any costum fonts

Edit: The debugDumpApp() reports the following lines when run with Locale('de') instead:

... └Semantics(container: false, properties: SemanticsProperties, tooltip: null, renderObject: RenderSemanticsAnnotations#8e42d) └Localizations(locale: de, delegates: [_AppLocalizationsDelegate[AppLocalizations], GlobalMaterialLocalizations.delegate(79 locales), GlobalCupertinoLocalizations.delegate(78 locales), GlobalWidgetsLocalizations.delegate(79 locales), LocaleNamesLocalizationsDelegate[LocaleNames], DefaultMaterialLocalizations.delegate(en_US), DefaultCupertinoLocalizations.delegate(en_US), DefaultWidgetsLocalizations.delegate(en_US)], state: _LocalizationsState#aac69) └Semantics(container: false, properties: SemanticsProperties, tooltip: null, textDirection: ltr, renderObject: RenderSemanticsAnnotations#ca0be) └_LocalizationsScope-[GlobalKey#2ac46] └Directionality(textDirection: ltr) └Title(title: "Flutter Localizations", color: Color(0xff2196f3)) ...

0

There are 0 best solutions below