From b16b75bf44ef22f8713d905184580cfc80ddc019 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Mon, 12 May 2025 00:31:20 +0200 Subject: [PATCH] fixed screenshot generator --- screenshots/README.md | 2 +- screenshots/generate_screenshots.dart | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/screenshots/README.md b/screenshots/README.md index 8c6555e..5f9dc18 100644 --- a/screenshots/README.md +++ b/screenshots/README.md @@ -52,7 +52,7 @@ Apple requires screenshots a specific list of devices, so we can implement a cus Can be run on Simulator. ```console -sh screenshots/generate_ios_screenshots.sh +sh screenshots/scripts/generate_ios_screenshots.sh ``` ### Apply store constraints and text data diff --git a/screenshots/generate_screenshots.dart b/screenshots/generate_screenshots.dart index 64cc9b2..55ac05d 100644 --- a/screenshots/generate_screenshots.dart +++ b/screenshots/generate_screenshots.dart @@ -6,6 +6,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; +import 'package:lightmeter/data/camera_info_service.dart'; import 'package:lightmeter/data/models/camera_feature.dart'; import 'package:lightmeter/data/models/ev_source_type.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; @@ -95,6 +96,19 @@ void main() { setUpAll(() async { if (Platform.isAndroid) await binding.convertFlutterSurfaceToImage(); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( + CameraInfoService.cameraInfoPlatformChannel, + (methodCall) async { + switch (methodCall.method) { + case "mainCameraEfl": + return Platform.isAndroid + ? 24.0 // Pixel 6 + : 26.0; // iPhone 13 Pro + default: + return null; + } + }, + ); }); /// Generates several screenshots with the light theme @@ -128,6 +142,9 @@ void main() { await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.edit_outlined).first); await tester.pumpAndSettle(); + await tester.tap(find.text(S.current.isoValues)); // open and close a dialog to hide keyboard + await tester.pumpAndSettle(); + await tester.tapCancelButton(); await tester.takeScreenshotLight(binding, 'equipment-profiles'); });