mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
moved screenshots generator to screenshots folder
This commit is contained in:
parent
62121780ce
commit
9dbe46a64c
4 changed files with 53 additions and 27 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -61,4 +61,4 @@ ios/Runner/GoogleService-Info.plist
|
|||
|
||||
coverage/
|
||||
test/coverage_helper_test.dart
|
||||
screenshots/
|
||||
screenshots/*.png
|
37
screenshots/README.md
Normal file
37
screenshots/README.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Screenshots
|
||||
|
||||
The easiest way to create several sets of identical screenshots for Android and iOS is to generate them instead of taking them manually. Generating screenshots will save time and effort while also providing a consistent output.
|
||||
|
||||
## Context
|
||||
|
||||
As a user I want to see the most relevant screenshots in the store, so that I can see the actual state of the app.
|
||||
|
||||
## Screenshot cases
|
||||
|
||||
- Metering screen
|
||||
|
||||
1. Reflected light metering mode*
|
||||
2. Incident light metering mode* **
|
||||
3. Opened ISO picker
|
||||
|
||||
- Settings screen
|
||||
|
||||
1. Just the screen
|
||||
2. Opened metering screen layout features dialog
|
||||
|
||||
- Equipment profiles screen
|
||||
|
||||
1. Just the screen
|
||||
2. Opened equipment profile ISO picker
|
||||
|
||||
> *also in dark mode
|
||||
|
||||
> **Android only
|
||||
|
||||
## Run the generator
|
||||
|
||||
```console
|
||||
sh screenshots/generate_screenshots.sh
|
||||
```
|
||||
|
||||
Screenshots will be stored in the _screenshots/_ folder.
|
|
@ -10,18 +10,19 @@ import 'package:lightmeter/data/models/theme_type.dart';
|
|||
import 'package:lightmeter/data/models/volume_action.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:lightmeter/res/theme.dart';
|
||||
import 'package:lightmeter/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart';
|
||||
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/iso_picker/widget_picker_iso.dart';
|
||||
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart';
|
||||
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart';
|
||||
import 'package:lightmeter/screens/settings/screen_settings.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'utils/platform_channel_mock.dart';
|
||||
import 'utils/widget_tester_actions.dart';
|
||||
import '../integration_test/mocks/paid_features_mock.dart';
|
||||
import '../integration_test/utils/widget_tester_actions.dart';
|
||||
|
||||
//https://stackoverflow.com/a/67186625/13167574
|
||||
|
||||
/// Just a screenshot generator. No expectations here.
|
||||
void main() {
|
||||
final binding = IntegrationTestWidgetsFlutterBinding();
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
@ -29,6 +30,7 @@ void main() {
|
|||
final Color darkThemeColor = primaryColorsList[3];
|
||||
|
||||
void mockSharedPrefs(ThemeType theme, Color color) {
|
||||
// ignore: invalid_use_of_visible_for_testing_member
|
||||
SharedPreferences.setMockInitialValues({
|
||||
/// Metering values
|
||||
UserPreferencesService.evSourceTypeKey: EvSourceType.camera.index,
|
||||
|
@ -74,14 +76,11 @@ void main() {
|
|||
if (Platform.isAndroid) {
|
||||
await tester.tap(find.byTooltip(S.current.tooltipUseLightSensor));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byType(MeteringMeasureButton));
|
||||
await sendMockIncidentEv(7.3);
|
||||
await tester.tap(find.byType(MeteringMeasureButton));
|
||||
await tester.toggleIncidentMetering(7.3);
|
||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_metering_incident');
|
||||
}
|
||||
|
||||
await tester.tap(find.byType(IsoValuePicker));
|
||||
await tester.pumpAndSettle(Dimens.durationL);
|
||||
await tester.openAnimatedPicker<IsoValuePicker>();
|
||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_metering_iso_picker');
|
||||
|
||||
await tester.tapCancelButton();
|
||||
|
@ -89,12 +88,13 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_settings');
|
||||
|
||||
await tester.tapListTile(S.current.meteringScreenLayout);
|
||||
await tester.tapDescendantTextOf<SettingsScreen>(S.current.meteringScreenLayout);
|
||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}_settings_metering_screen_layout');
|
||||
|
||||
await tester.tapCancelButton();
|
||||
await tester.tapListTile(S.current.equipmentProfiles);
|
||||
await tester.tap(find.byType(EquipmentProfileContainer).first);
|
||||
await tester.tapDescendantTextOf<SettingsScreen>(S.current.equipmentProfiles);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tapDescendantTextOf<EquipmentProfilesScreen>(mockEquipmentProfiles.first.name);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.takeScreenshot(binding, '${lightThemeColor.value}-equipment_profiles');
|
||||
|
||||
|
@ -117,9 +117,7 @@ void main() {
|
|||
if (Platform.isAndroid) {
|
||||
await tester.tap(find.byTooltip(S.current.tooltipUseLightSensor));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byType(MeteringMeasureButton));
|
||||
await sendMockIncidentEv(7.3);
|
||||
await tester.tap(find.byType(MeteringMeasureButton));
|
||||
await tester.toggleIncidentMetering(7.3);
|
||||
await tester.takeScreenshot(binding, '${darkThemeColor.value}_metering_incident');
|
||||
}
|
||||
},
|
||||
|
@ -135,13 +133,4 @@ extension on WidgetTester {
|
|||
await binding.takeScreenshot(name);
|
||||
await pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> tapListTile(String title) async {
|
||||
final listTile = find.byWidgetPredicate(
|
||||
(widget) => widget is ListTile && widget.title is Text && (widget.title as Text?)?.data == title,
|
||||
);
|
||||
expect(listTile, findsOneWidget);
|
||||
await tap(listTile);
|
||||
await pumpAndSettle();
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ flutter drive \
|
|||
--dart-define="cameraPreviewAspectRatio=240/320" \
|
||||
--dart-define="cameraStubImage=assets/camera_stub_image.jpg" \
|
||||
--driver=test_driver/screenshot_driver.dart \
|
||||
--target=integration_test/generate_screenshots.dart \
|
||||
--target=screenshots/generate_screenshots.dart \
|
||||
--profile \
|
||||
--flavor=dev \
|
||||
--no-dds \
|
Loading…
Reference in a new issue