mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-23 07:50:42 +00:00
Fixed Android screenshots generator
This commit is contained in:
parent
d9ce47e0dd
commit
6dd17961b5
2 changed files with 46 additions and 41 deletions
|
@ -46,7 +46,7 @@ class _MockIAPProvidersState extends State<MockIAPProviders> {
|
|||
storageService: mockIAPStorageService,
|
||||
child: FilmsProvider(
|
||||
storageService: mockIAPStorageService,
|
||||
availableFilms: mockFilms,
|
||||
availableFilms: widget.films ?? mockFilms,
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -22,6 +22,8 @@ import '../integration_test/utils/widget_tester_actions.dart';
|
|||
|
||||
//https://stackoverflow.com/a/67186625/13167574
|
||||
|
||||
const _mockFilm = Film('Ilford HP5+', 400);
|
||||
|
||||
/// Just a screenshot generator. No expectations here.
|
||||
void main() {
|
||||
final binding = IntegrationTestWidgetsFlutterBinding();
|
||||
|
@ -62,12 +64,17 @@ void main() {
|
|||
});
|
||||
}
|
||||
|
||||
setUpAll(() async {
|
||||
if (Platform.isAndroid) await binding.convertFlutterSurfaceToImage();
|
||||
});
|
||||
|
||||
/// Generates several screenshots with the light theme
|
||||
testWidgets(
|
||||
'Generate light theme screenshots',
|
||||
(tester) async {
|
||||
testWidgets('Generate light theme screenshots', (tester) async {
|
||||
mockSharedPrefs(ThemeType.light, lightThemeColor);
|
||||
await tester.pumpApplication();
|
||||
await tester.pumpApplication(
|
||||
films: [_mockFilm],
|
||||
selectedFilm: _mockFilm,
|
||||
);
|
||||
|
||||
await tester.takePhoto();
|
||||
await tester.takeScreenshot(binding, 'light-metering_reflected');
|
||||
|
@ -100,15 +107,17 @@ void main() {
|
|||
await tester.tap(find.byIcon(Icons.iso).first);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.takeScreenshot(binding, 'light-equipment_profiles_iso_picker');
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
/// and the additionally the first one with the dark theme
|
||||
testWidgets(
|
||||
'Generate dark theme screenshots',
|
||||
(tester) async {
|
||||
mockSharedPrefs(ThemeType.dark, darkThemeColor);
|
||||
await tester.pumpApplication();
|
||||
await tester.pumpApplication(
|
||||
films: [_mockFilm],
|
||||
selectedFilm: _mockFilm,
|
||||
);
|
||||
|
||||
await tester.takePhoto();
|
||||
await tester.takeScreenshot(binding, 'dark-metering_reflected');
|
||||
|
@ -127,10 +136,6 @@ final String _platformFolder = Platform.isAndroid ? 'android' : 'ios';
|
|||
|
||||
extension on WidgetTester {
|
||||
Future<void> takeScreenshot(IntegrationTestWidgetsFlutterBinding binding, String name) async {
|
||||
if (Platform.isAndroid) {
|
||||
await binding.convertFlutterSurfaceToImage();
|
||||
await pumpAndSettle();
|
||||
}
|
||||
await binding.takeScreenshot("$_platformFolder/${const String.fromEnvironment('deviceName')}/$name");
|
||||
await pumpAndSettle();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue