set sharedprefs mock without redundant group

This commit is contained in:
Vadim 2023-10-17 12:08:37 +02:00
parent 4f1908c200
commit e91d0f88c7

View file

@ -29,7 +29,6 @@ void main() {
final Color darkThemeColor = primaryColorsList[3];
void mockSharedPrefs(ThemeType theme, Color color) {
setUp(() {
SharedPreferences.setMockInitialValues({
/// Metering values
UserPreferencesService.evSourceTypeKey: EvSourceType.camera.index,
@ -60,16 +59,13 @@ void main() {
UserPreferencesService.primaryColorKey: color.value,
UserPreferencesService.dynamicColorKey: false,
});
});
}
group(
'Light theme',
() {
mockSharedPrefs(ThemeType.light, lightThemeColor);
/// Generates several screenshots with the light theme
testWidgets(
'Generate light screenshots',
'Generate light theme screenshots',
(tester) async {
mockSharedPrefs(ThemeType.light, lightThemeColor);
await tester.pumpApplication();
await tester.takePhoto();
@ -107,16 +103,12 @@ void main() {
await tester.takeScreenshot(binding, '${lightThemeColor.value}_equipment_profiles_iso_picker');
},
);
},
);
group(
'Dark theme',
() {
mockSharedPrefs(ThemeType.dark, darkThemeColor);
/// and the additionally the first one with the dark theme
testWidgets(
'Generate dark screenshots',
'Generate dark theme screenshots',
(tester) async {
mockSharedPrefs(ThemeType.dark, darkThemeColor);
await tester.pumpApplication();
await tester.takePhoto();
@ -132,8 +124,6 @@ void main() {
}
},
);
},
);
}
extension on WidgetTester {