mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 17:00: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];
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue