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