From f485a044247b4fde0f24e85c794f42835d41e2f8 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:27:42 +0200 Subject: [PATCH] `IsoValuePicker` tests --- .../readings_container/iso_picker_test.dart | 61 +++++++++++++++++++ .../readings_container/nd_picker_test.dart | 1 - 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 test/screens/metering/components/shared/readings_container/iso_picker_test.dart diff --git a/test/screens/metering/components/shared/readings_container/iso_picker_test.dart b/test/screens/metering/components/shared/readings_container/iso_picker_test.dart new file mode 100644 index 0000000..9068df4 --- /dev/null +++ b/test/screens/metering/components/shared/readings_container/iso_picker_test.dart @@ -0,0 +1,61 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:lightmeter/generated/l10n.dart'; +import 'package:lightmeter/screens/metering/components/shared/readings_container/components/iso_picker/widget_picker_iso.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; + +import '../../../../../application_mock.dart'; +import 'utils.dart'; + +void main() { + Future pumpApplication( + WidgetTester tester, { + List values = IsoValue.values, + IsoValue selectedValue = const IsoValue(100, StopType.full), + }) async { + assert(values.contains(selectedValue)); + await tester.pumpWidget( + WidgetTestApplicationMock( + child: Row( + children: [ + Expanded( + child: IsoValuePicker( + selectedValue: selectedValue, + values: values, + onChanged: (_) {}, + ), + ), + ], + ), + ), + ); + await tester.pumpAndSettle(); + } + + testWidgets( + 'Check dialog icon and title consistency', + (tester) async { + await pumpApplication(tester); + expectReadingValueContainerText(S.current.iso); + await tester.openAnimatedPicker(); + expect(find.byIcon(Icons.iso), findsOneWidget); + expectDialogPickerText(S.current.iso); + expectDialogPickerText(S.current.filmSpeed); + }, + ); + + group( + 'Display selected value', + () { + testWidgets( + 'Any', + (tester) async { + await pumpApplication(tester); + expectReadingValueContainerText('100'); + await tester.openAnimatedPicker(); + expectRadioListTile('100', isSelected: true); + }, + ); + }, + ); +} diff --git a/test/screens/metering/components/shared/readings_container/nd_picker_test.dart b/test/screens/metering/components/shared/readings_container/nd_picker_test.dart index 376fd64..3deb824 100644 --- a/test/screens/metering/components/shared/readings_container/nd_picker_test.dart +++ b/test/screens/metering/components/shared/readings_container/nd_picker_test.dart @@ -42,7 +42,6 @@ void main() { expectDialogPickerText(S.current.nd); expectDialogPickerText(S.current.ndFilterFactor); }, - skip: true, ); group(