mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
added zoom checks to e2e test
This commit is contained in:
parent
5edf6edd3c
commit
830a63e4ce
3 changed files with 49 additions and 0 deletions
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
|
@ -61,5 +61,18 @@
|
||||||
],
|
],
|
||||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "integration-test",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "debug",
|
||||||
|
"args": [
|
||||||
|
"--flavor",
|
||||||
|
"dev",
|
||||||
|
"--dart-define",
|
||||||
|
"cameraStubImage=assets/camera_stub_image.jpg"
|
||||||
|
],
|
||||||
|
"program": "${workspaceFolder}/integration_test/run_all_tests.dart",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
|
@ -15,7 +15,9 @@ import 'package:lightmeter/screens/metering/components/shared/readings_container
|
||||||
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart';
|
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart';
|
import 'package:lightmeter/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart';
|
import 'package:lightmeter/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart';
|
||||||
|
import 'package:lightmeter/screens/settings/components/shared/dialog_slider_picker/widget_dialog_slider_picker.dart';
|
||||||
import 'package:lightmeter/screens/settings/screen_settings.dart';
|
import 'package:lightmeter/screens/settings/screen_settings.dart';
|
||||||
|
import 'package:lightmeter/utils/double_to_zoom.dart';
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
@ -56,6 +58,8 @@ void testE2E(String description) {
|
||||||
await tester.setNdValues(0, mockEquipmentProfiles[0].ndValues);
|
await tester.setNdValues(0, mockEquipmentProfiles[0].ndValues);
|
||||||
await tester.setApertureValues(0, mockEquipmentProfiles[0].apertureValues);
|
await tester.setApertureValues(0, mockEquipmentProfiles[0].apertureValues);
|
||||||
await tester.setShutterSpeedValues(0, mockEquipmentProfiles[0].shutterSpeedValues);
|
await tester.setShutterSpeedValues(0, mockEquipmentProfiles[0].shutterSpeedValues);
|
||||||
|
await tester.setZoomValue(0, mockEquipmentProfiles[0].lensZoom);
|
||||||
|
expect(find.text('x1.91'), findsOneWidget);
|
||||||
expect(find.text('f/1.7 - f/16'), findsOneWidget);
|
expect(find.text('f/1.7 - f/16'), findsOneWidget);
|
||||||
expect(find.text('1/1000 - 16"'), findsOneWidget);
|
expect(find.text('1/1000 - 16"'), findsOneWidget);
|
||||||
|
|
||||||
|
@ -65,6 +69,8 @@ void testE2E(String description) {
|
||||||
await tester.setProfileName(mockEquipmentProfiles[1].name);
|
await tester.setProfileName(mockEquipmentProfiles[1].name);
|
||||||
await tester.expandEquipmentProfileContainer(mockEquipmentProfiles[1].name);
|
await tester.expandEquipmentProfileContainer(mockEquipmentProfiles[1].name);
|
||||||
await tester.setApertureValues(1, mockEquipmentProfiles[1].apertureValues);
|
await tester.setApertureValues(1, mockEquipmentProfiles[1].apertureValues);
|
||||||
|
await tester.setZoomValue(1, mockEquipmentProfiles[1].lensZoom);
|
||||||
|
expect(find.text('x5.02'), findsOneWidget);
|
||||||
expect(find.text('f/3.5 - f/22'), findsOneWidget);
|
expect(find.text('f/3.5 - f/22'), findsOneWidget);
|
||||||
expect(find.text('1/1000 - 16"'), findsNWidgets(2));
|
expect(find.text('1/1000 - 16"'), findsNWidgets(2));
|
||||||
await tester.navigatorPop();
|
await tester.navigatorPop();
|
||||||
|
@ -171,6 +177,9 @@ extension EquipmentProfileActions on WidgetTester {
|
||||||
|
|
||||||
Future<void> setShutterSpeedValues(int profileIndex, List<ShutterSpeedValue> values) =>
|
Future<void> setShutterSpeedValues(int profileIndex, List<ShutterSpeedValue> values) =>
|
||||||
_setDialogRangePickerValues<ShutterSpeedValue>(profileIndex, S.current.shutterSpeedValues, values);
|
_setDialogRangePickerValues<ShutterSpeedValue>(profileIndex, S.current.shutterSpeedValues, values);
|
||||||
|
|
||||||
|
Future<void> setZoomValue(int profileIndex, double value) =>
|
||||||
|
_setDialogSliderPickerValue(profileIndex, S.current.lensZoom, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension on WidgetTester {
|
extension on WidgetTester {
|
||||||
|
@ -235,6 +244,30 @@ extension on WidgetTester {
|
||||||
|
|
||||||
await tapSaveButton();
|
await tapSaveButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _setDialogSliderPickerValue(
|
||||||
|
int profileIndex,
|
||||||
|
String listTileTitle,
|
||||||
|
double value,
|
||||||
|
) async {
|
||||||
|
await tap(find.text(listTileTitle).at(profileIndex));
|
||||||
|
await pumpAndSettle();
|
||||||
|
|
||||||
|
final sliderFinder = find.byType(Slider);
|
||||||
|
final trackWidth = getSize(sliderFinder).width - (2 * Dimens.paddingL);
|
||||||
|
final trackStep = trackWidth / (widget<Slider>(sliderFinder).max - widget<Slider>(sliderFinder).min);
|
||||||
|
|
||||||
|
final oldValue = widget<Slider>(sliderFinder).value;
|
||||||
|
final oldStart = (oldValue - 1) * trackStep;
|
||||||
|
final newStart = (value - 1) * trackStep;
|
||||||
|
await dragFrom(
|
||||||
|
getTopLeft(sliderFinder) + Offset(Dimens.paddingL + oldStart, getSize(sliderFinder).height / 2),
|
||||||
|
Offset(newStart - oldStart, 0),
|
||||||
|
);
|
||||||
|
await pump();
|
||||||
|
|
||||||
|
await tapSaveButton();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _expectMeteringState(
|
Future<void> _expectMeteringState(
|
||||||
|
@ -257,6 +290,7 @@ Future<void> _expectMeteringState(
|
||||||
await tester.scrollToTheLastExposurePair(equipmentProfile: equipmentProfile);
|
await tester.scrollToTheLastExposurePair(equipmentProfile: equipmentProfile);
|
||||||
expectExposurePairsListItem(tester, slowest.split(' - ')[0], slowest.split(' - ')[1]);
|
expectExposurePairsListItem(tester, slowest.split(' - ')[0], slowest.split(' - ')[1]);
|
||||||
expectMeasureButton(ev);
|
expectMeasureButton(ev);
|
||||||
|
expect(find.text(equipmentProfile.lensZoom.toZoom()), findsOneWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _expectMeteringStateAndMeasure(
|
Future<void> _expectMeteringStateAndMeasure(
|
||||||
|
|
|
@ -91,6 +91,7 @@ final mockEquipmentProfiles = [
|
||||||
IsoValue(1600, StopType.full),
|
IsoValue(1600, StopType.full),
|
||||||
IsoValue(3200, StopType.full),
|
IsoValue(3200, StopType.full),
|
||||||
],
|
],
|
||||||
|
lensZoom: 1.91,
|
||||||
),
|
),
|
||||||
EquipmentProfile(
|
EquipmentProfile(
|
||||||
id: '2',
|
id: '2',
|
||||||
|
@ -120,6 +121,7 @@ final mockEquipmentProfiles = [
|
||||||
IsoValue(1600, StopType.full),
|
IsoValue(1600, StopType.full),
|
||||||
IsoValue(3200, StopType.full),
|
IsoValue(3200, StopType.full),
|
||||||
],
|
],
|
||||||
|
lensZoom: 5.02,
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue