mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 01:10:39 +00:00
set sharedprefs mock without redundant group
This commit is contained in:
parent
4f1908c200
commit
e91d0f88c7
1 changed files with 73 additions and 83 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue