Skip to content

Commit 492c58f

Browse files
committed
Use the locale consistently
1 parent 709f00c commit 492c58f

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

integration_test/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
This will generate some screenshots and save them to the Play Store metadata folder.
22

3-
1) Set the correct value for the device size by setting the `destination` variable
4-
2) Start the correct emulator and
5-
run
3+
1) Start the correct emulator/simulator for the device size you want.
4+
2) Run, selecting the device size via `--dart-define=DEVICE_TYPE`:
65
```
76
flutter drive \
87
--driver=test_driver/screenshot_driver.dart \
98
--target=integration_test/make_screenshots_test.dart \
109
--dart-define=DEVICE_TYPE=androidPhone
1110
```
12-
For the values of device type, consult the values of the DeviceType enum in
13-
`make_screenshots_test.dart`
14-
3) flutter drive --driver=test_driver/screenshot_driver.dart --target=integration_test/make_screenshots_test.dart --dart-define=DEVICE_TYPE=androidPhone`
15-
4) If you get errors or the screenshots are not written to disk, edit the
16-
`languages` list and comment some of the languages
11+
For the available device types, consult the `DeviceType` enum in
12+
`make_screenshots_test.dart`.
13+
3) If you get errors or the screenshots are not written to disk, edit the
14+
`languages` list and comment some of the languages out.
1715

1816
See also
1917

integration_test/make_screenshots_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void main() {
162162
// });
163163

164164
testWidgets('gym mode stats screen - $language', (WidgetTester tester) async {
165-
await tester.pumpWidget(createGymModeResultsScreen(locale: languageCode));
165+
await tester.pumpWidget(createGymModeResultsScreen(locale: locale));
166166
await tester.pumpAndSettle();
167167
await takeScreenshot(tester, binding, language, '03 - gym mode');
168168
});

integration_test/screenshots_03_gym_mode.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ Widget createGymModeScreen({Locale? locale}) {
9494
);
9595
}
9696

97-
Widget createGymModeResultsScreen({String locale = 'en'}) {
97+
Widget createGymModeResultsScreen({Locale? locale}) {
98+
locale ??= const Locale('en');
9899
final controller = PageController(initialPage: 0);
99100

100101
final key = GlobalKey<NavigatorState>();
@@ -120,7 +121,7 @@ Widget createGymModeResultsScreen({String locale = 'en'}) {
120121
),
121122

122123
child: MaterialApp(
123-
locale: Locale(locale),
124+
locale: locale,
124125
debugShowCheckedModeBanner: false,
125126
localizationsDelegates: AppLocalizations.localizationsDelegates,
126127
supportedLocales: AppLocalizations.supportedLocales,

0 commit comments

Comments
 (0)