generate single dark screenshots

This commit is contained in:
Vadim 2023-09-25 21:49:40 +02:00
parent e231e09929
commit 4890eea1b7

View file

@ -82,6 +82,7 @@ void main() {
mockCaffeineService = _MockCaffeineService();
when(() => mockCaffeineService.isKeepScreenOn()).thenAnswer((_) async => false);
when(() => mockCaffeineService.keepScreenOn(true)).thenAnswer((_) async => true);
when(() => mockCaffeineService.keepScreenOn(false)).thenAnswer((_) async => false);
mockHapticsService = _MockHapticsService();
@ -109,12 +110,7 @@ void main() {
when(() => mockHapticsService.responseVibration()).thenAnswer((_) async {});
});
void generateScreenshots(Color color) {
testWidgets(
'${color.value}',
(tester) async {
when(() => mockUserPreferencesService.primaryColor).thenReturn(color);
Future<void> pumpApplication(WidgetTester tester) async {
await tester.pumpWidget(
IAPProviders(
sharedPreferences: _MockSharedPreferences(),
@ -142,6 +138,16 @@ void main() {
),
);
await tester.pumpAndSettle();
}
/// Generates several screenshots with the light theme
/// and the additionally the first one with the dark theme
void generateScreenshots(Color color) {
testWidgets(
'${color.value}_light',
(tester) async {
when(() => mockUserPreferencesService.primaryColor).thenReturn(color);
await pumpApplication(tester);
//await tester.takeScreenshot(binding, '${color.value}-metering-reflected');
@ -177,6 +183,22 @@ void main() {
await tester.pumpAndSettle();
await tester.takeScreenshot(binding, '${color.value}-equipment_profiles-iso_picker');
},
skip: true,
);
testWidgets(
'${color.value}_dark',
(tester) async {
when(() => mockUserPreferencesService.themeType).thenReturn(ThemeType.dark);
when(() => mockUserPreferencesService.primaryColor).thenReturn(color);
await pumpApplication(tester);
//await tester.takeScreenshot(binding, '${color.value}-metering-reflected');
await tester.tap(find.byType(MeteringMeasureButton));
await tester.tap(find.byType(MeteringMeasureButton));
await tester.takeScreenshot(binding, '${color.value}-metering-incident_dark');
},
);
}