mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 17:30:41 +00:00
generate single dark screenshots
This commit is contained in:
parent
e231e09929
commit
4890eea1b7
1 changed files with 52 additions and 30 deletions
|
@ -82,6 +82,7 @@ void main() {
|
||||||
|
|
||||||
mockCaffeineService = _MockCaffeineService();
|
mockCaffeineService = _MockCaffeineService();
|
||||||
when(() => mockCaffeineService.isKeepScreenOn()).thenAnswer((_) async => false);
|
when(() => mockCaffeineService.isKeepScreenOn()).thenAnswer((_) async => false);
|
||||||
|
when(() => mockCaffeineService.keepScreenOn(true)).thenAnswer((_) async => true);
|
||||||
when(() => mockCaffeineService.keepScreenOn(false)).thenAnswer((_) async => false);
|
when(() => mockCaffeineService.keepScreenOn(false)).thenAnswer((_) async => false);
|
||||||
|
|
||||||
mockHapticsService = _MockHapticsService();
|
mockHapticsService = _MockHapticsService();
|
||||||
|
@ -109,39 +110,44 @@ void main() {
|
||||||
when(() => mockHapticsService.responseVibration()).thenAnswer((_) async {});
|
when(() => mockHapticsService.responseVibration()).thenAnswer((_) async {});
|
||||||
});
|
});
|
||||||
|
|
||||||
void generateScreenshots(Color color) {
|
Future<void> pumpApplication(WidgetTester tester) async {
|
||||||
testWidgets(
|
await tester.pumpWidget(
|
||||||
'${color.value}',
|
IAPProviders(
|
||||||
(tester) async {
|
sharedPreferences: _MockSharedPreferences(),
|
||||||
when(() => mockUserPreferencesService.primaryColor).thenReturn(color);
|
child: EquipmentProfiles(
|
||||||
|
selected: _mockEquipmentProfiles[1],
|
||||||
await tester.pumpWidget(
|
values: _mockEquipmentProfiles,
|
||||||
IAPProviders(
|
child: Films(
|
||||||
sharedPreferences: _MockSharedPreferences(),
|
selected: const Film('Ilford HP5+', 400),
|
||||||
child: EquipmentProfiles(
|
values: const [Film.other(), Film('Ilford HP5+', 400)],
|
||||||
selected: _mockEquipmentProfiles[1],
|
filmsInUse: const [Film.other(), Film('Ilford HP5+', 400)],
|
||||||
values: _mockEquipmentProfiles,
|
child: ServicesProvider(
|
||||||
child: Films(
|
environment: const Environment.prod().copyWith(hasLightSensor: true),
|
||||||
selected: const Film('Ilford HP5+', 400),
|
userPreferencesService: mockUserPreferencesService,
|
||||||
values: const [Film.other(), Film('Ilford HP5+', 400)],
|
caffeineService: mockCaffeineService,
|
||||||
filmsInUse: const [Film.other(), Film('Ilford HP5+', 400)],
|
hapticsService: mockHapticsService,
|
||||||
child: ServicesProvider(
|
permissionsService: mockPermissionsService,
|
||||||
environment: const Environment.prod().copyWith(hasLightSensor: true),
|
lightSensorService: mockLightSensorService,
|
||||||
userPreferencesService: mockUserPreferencesService,
|
volumeEventsService: mockVolumeEventsService,
|
||||||
caffeineService: mockCaffeineService,
|
child: const UserPreferencesProvider(
|
||||||
hapticsService: mockHapticsService,
|
child: Application(),
|
||||||
permissionsService: mockPermissionsService,
|
|
||||||
lightSensorService: mockLightSensorService,
|
|
||||||
volumeEventsService: mockVolumeEventsService,
|
|
||||||
child: const UserPreferencesProvider(
|
|
||||||
child: Application(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
await tester.pumpAndSettle();
|
),
|
||||||
|
);
|
||||||
|
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');
|
//await tester.takeScreenshot(binding, '${color.value}-metering-reflected');
|
||||||
|
|
||||||
|
@ -177,6 +183,22 @@ void main() {
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.takeScreenshot(binding, '${color.value}-equipment_profiles-iso_picker');
|
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');
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue