mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 00:10:47 +00:00
place screenshots in platform-specific folders
This commit is contained in:
parent
5e446800e0
commit
4f86dee0f4
4 changed files with 25 additions and 13 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -61,4 +61,4 @@ ios/Runner/GoogleService-Info.plist
|
||||||
|
|
||||||
coverage/
|
coverage/
|
||||||
test/coverage_helper_test.dart
|
test/coverage_helper_test.dart
|
||||||
screenshots/*.png
|
screenshots/*/*.png
|
|
@ -8,12 +8,16 @@ import 'package:mocktail/mocktail.dart';
|
||||||
class _MockIAPStorageService extends Mock implements IAPStorageService {}
|
class _MockIAPStorageService extends Mock implements IAPStorageService {}
|
||||||
|
|
||||||
class MockIAPProviders extends StatefulWidget {
|
class MockIAPProviders extends StatefulWidget {
|
||||||
|
final List<EquipmentProfile> equipmentProfiles;
|
||||||
final String selectedEquipmentProfileId;
|
final String selectedEquipmentProfileId;
|
||||||
|
final List<Film> films;
|
||||||
final Film selectedFilm;
|
final Film selectedFilm;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
const MockIAPProviders({
|
const MockIAPProviders({
|
||||||
|
this.equipmentProfiles = const [],
|
||||||
this.selectedEquipmentProfileId = '',
|
this.selectedEquipmentProfileId = '',
|
||||||
|
this.films = mockFilms,
|
||||||
this.selectedFilm = const Film.other(),
|
this.selectedFilm = const Film.other(),
|
||||||
required this.child,
|
required this.child,
|
||||||
super.key,
|
super.key,
|
||||||
|
@ -66,7 +70,12 @@ final mockEquipmentProfiles = [
|
||||||
ApertureValue.values.indexOf(const ApertureValue(1.7, StopType.half)),
|
ApertureValue.values.indexOf(const ApertureValue(1.7, StopType.half)),
|
||||||
ApertureValue.values.indexOf(const ApertureValue(16, StopType.full)) + 1,
|
ApertureValue.values.indexOf(const ApertureValue(16, StopType.full)) + 1,
|
||||||
),
|
),
|
||||||
ndValues: NdValue.values.sublist(0, 3),
|
ndValues: const [
|
||||||
|
NdValue(0),
|
||||||
|
NdValue(2),
|
||||||
|
NdValue(4),
|
||||||
|
NdValue(8),
|
||||||
|
],
|
||||||
shutterSpeedValues: ShutterSpeedValue.values.sublist(
|
shutterSpeedValues: ShutterSpeedValue.values.sublist(
|
||||||
ShutterSpeedValue.values.indexOf(const ShutterSpeedValue(1000, true, StopType.full)),
|
ShutterSpeedValue.values.indexOf(const ShutterSpeedValue(1000, true, StopType.full)),
|
||||||
ShutterSpeedValue.values.indexOf(const ShutterSpeedValue(16, false, StopType.full)) + 1,
|
ShutterSpeedValue.values.indexOf(const ShutterSpeedValue(16, false, StopType.full)) + 1,
|
||||||
|
|
|
@ -63,6 +63,7 @@ extension WidgetTesterListTileActions on WidgetTester {
|
||||||
/// Useful for tapping a specific [ListTile] inside a specific screen or dialog
|
/// Useful for tapping a specific [ListTile] inside a specific screen or dialog
|
||||||
Future<void> tapDescendantTextOf<T>(String text) async {
|
Future<void> tapDescendantTextOf<T>(String text) async {
|
||||||
await tap(find.descendant(of: find.byType(T), matching: find.text(text)));
|
await tap(find.descendant(of: find.byType(T), matching: find.text(text)));
|
||||||
|
await pumpAndSettle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,37 +70,37 @@ void main() {
|
||||||
await tester.pumpApplication();
|
await tester.pumpApplication();
|
||||||
|
|
||||||
await tester.takePhoto();
|
await tester.takePhoto();
|
||||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_metering_reflected');
|
await tester.takeScreenshot(binding, 'light-metering_reflected');
|
||||||
|
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
await tester.tap(find.byTooltip(S.current.tooltipUseLightSensor));
|
await tester.tap(find.byTooltip(S.current.tooltipUseLightSensor));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.toggleIncidentMetering(7.3);
|
await tester.toggleIncidentMetering(7.3);
|
||||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_metering_incident');
|
await tester.takeScreenshot(binding, 'light-metering_incident');
|
||||||
}
|
}
|
||||||
|
|
||||||
await tester.openAnimatedPicker<IsoValuePicker>();
|
await tester.openAnimatedPicker<IsoValuePicker>();
|
||||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_metering_iso_picker');
|
await tester.takeScreenshot(binding, 'light-metering_iso_picker');
|
||||||
|
|
||||||
await tester.tapCancelButton();
|
await tester.tapCancelButton();
|
||||||
await tester.tap(find.byTooltip(S.current.tooltipOpenSettings));
|
await tester.tap(find.byTooltip(S.current.tooltipOpenSettings));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_settings');
|
await tester.takeScreenshot(binding, 'light-settings');
|
||||||
|
|
||||||
await tester.tapDescendantTextOf<SettingsScreen>(S.current.meteringScreenLayout);
|
await tester.tapDescendantTextOf<SettingsScreen>(S.current.meteringScreenLayout);
|
||||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_settings_metering_screen_layout');
|
await tester.takeScreenshot(binding, 'light-settings_metering_screen_layout');
|
||||||
|
|
||||||
await tester.tapCancelButton();
|
await tester.tapCancelButton();
|
||||||
await tester.tapDescendantTextOf<SettingsScreen>(S.current.equipmentProfiles);
|
await tester.tapDescendantTextOf<SettingsScreen>(S.current.equipmentProfiles);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tapDescendantTextOf<EquipmentProfilesScreen>(mockEquipmentProfiles.first.name);
|
await tester.tapDescendantTextOf<EquipmentProfilesScreen>(mockEquipmentProfiles.first.name);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}-equipment_profiles');
|
await tester.takeScreenshot(binding, 'light-equipment_profiles');
|
||||||
|
|
||||||
await tester.tap(find.byIcon(Icons.iso).first);
|
await tester.tap(find.byIcon(Icons.iso).first);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_equipment_profiles_iso_picker');
|
await tester.takeScreenshot(binding, 'light-equipment_profiles_iso_picker');
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/// and the additionally the first one with the dark theme
|
/// and the additionally the first one with the dark theme
|
||||||
|
@ -111,25 +111,27 @@ void main() {
|
||||||
await tester.pumpApplication();
|
await tester.pumpApplication();
|
||||||
|
|
||||||
await tester.takePhoto();
|
await tester.takePhoto();
|
||||||
await tester.takeScreenshot(binding, '${darkThemeColor.value}_metering_reflected');
|
await tester.takeScreenshot(binding, 'dark-metering_reflected');
|
||||||
|
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
await tester.tap(find.byTooltip(S.current.tooltipUseLightSensor));
|
await tester.tap(find.byTooltip(S.current.tooltipUseLightSensor));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.toggleIncidentMetering(7.3);
|
await tester.toggleIncidentMetering(7.3);
|
||||||
await tester.takeScreenshot(binding, '${darkThemeColor.value}_metering_incident');
|
await tester.takeScreenshot(binding, 'dark-metering_incident');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String _platformFolder = Platform.isAndroid ? 'android' : 'ios';
|
||||||
|
|
||||||
extension on WidgetTester {
|
extension on WidgetTester {
|
||||||
Future<void> takeScreenshot(IntegrationTestWidgetsFlutterBinding binding, String name) async {
|
Future<void> takeScreenshot(IntegrationTestWidgetsFlutterBinding binding, String name) async {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
await binding.convertFlutterSurfaceToImage();
|
await binding.convertFlutterSurfaceToImage();
|
||||||
await pumpAndSettle();
|
await pumpAndSettle();
|
||||||
}
|
}
|
||||||
await binding.takeScreenshot(name);
|
await binding.takeScreenshot("$_platformFolder/$name");
|
||||||
await pumpAndSettle();
|
await pumpAndSettle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue