sync with iap rename

This commit is contained in:
Vadim 2024-11-11 14:27:03 +01:00
parent 4e6f9dff17
commit 1cd1bc298a
10 changed files with 29 additions and 29 deletions

View file

@ -22,11 +22,11 @@ class FilmsStorageService {
Future<void> deleteFilm(FilmExponential _) async {}
Future<Map<String, SelectableValue<Film>>> getPredefinedFilms() async {
Future<TogglableMap<Film>> getPredefinedFilms() async {
return const {};
}
Future<Map<String, SelectableValue<FilmExponential>>> getCustomFilms() async {
Future<TogglableMap<FilmExponential>> getCustomFilms() async {
return const {};
}
}

View file

@ -50,7 +50,7 @@ void testE2E(String description) {
(tester) async {
await tester.pumpApplication(
equipmentProfiles: {},
predefinedFilms: mockFilms.toSelectableMap(),
predefinedFilms: mockFilms.toTogglableMap(),
customFilms: {},
);

View file

@ -10,24 +10,24 @@ class _MockEquipmentProfilesStorageService extends Mock implements EquipmentProf
class _MockFilmsStorageService extends Mock implements FilmsStorageService {}
class MockIAPProviders extends StatefulWidget {
final SelectableMap<EquipmentProfile> equipmentProfiles;
final TogglableMap<EquipmentProfile> equipmentProfiles;
final String selectedEquipmentProfileId;
final Map<String, SelectableValue<Film>> predefinedFilms;
final Map<String, SelectableValue<FilmExponential>> customFilms;
final TogglableMap<Film> predefinedFilms;
final TogglableMap<FilmExponential> customFilms;
final String selectedFilmId;
final Widget child;
MockIAPProviders({
SelectableMap<EquipmentProfile>? equipmentProfiles,
TogglableMap<EquipmentProfile>? equipmentProfiles,
this.selectedEquipmentProfileId = '',
Map<String, SelectableValue<Film>>? predefinedFilms,
Map<String, SelectableValue<FilmExponential>>? customFilms,
TogglableMap<Film>? predefinedFilms,
TogglableMap<FilmExponential>? customFilms,
String? selectedFilmId,
required this.child,
super.key,
}) : equipmentProfiles = equipmentProfiles ?? mockEquipmentProfiles.toSelectableMap(),
predefinedFilms = predefinedFilms ?? mockFilms.toSelectableMap(),
customFilms = customFilms ?? mockFilms.toSelectableMap(),
}) : equipmentProfiles = equipmentProfiles ?? mockEquipmentProfiles.toTogglableMap(),
predefinedFilms = predefinedFilms ?? mockFilms.toTogglableMap(),
customFilms = customFilms ?? mockFilms.toTogglableMap(),
selectedFilmId = selectedFilmId ?? const FilmStub().id;
@override

View file

@ -20,10 +20,10 @@ const mockPhotoEv100 = 8.3;
extension WidgetTesterCommonActions on WidgetTester {
Future<void> pumpApplication({
IAPProductStatus productStatus = IAPProductStatus.purchased,
SelectableMap<EquipmentProfile>? equipmentProfiles,
TogglableMap<EquipmentProfile>? equipmentProfiles,
String selectedEquipmentProfileId = '',
Map<String, SelectableValue<Film>>? predefinedFilms,
Map<String, SelectableValue<FilmExponential>>? customFilms,
TogglableMap<Film>? predefinedFilms,
TogglableMap<FilmExponential>? customFilms,
String selectedFilmId = '',
}) async {
await pumpWidget(

View file

@ -34,7 +34,7 @@ class EquipmentProfilesProvider extends StatefulWidget {
}
class EquipmentProfilesProviderState extends State<EquipmentProfilesProvider> {
final SelectableMap<EquipmentProfile> _customProfiles = {};
final TogglableMap<EquipmentProfile> _customProfiles = {};
String _selectedId = '';
EquipmentProfile get _selectedProfile =>
@ -135,7 +135,7 @@ enum _EquipmentProfilesModelAspect {
}
class EquipmentProfiles extends InheritedModel<_EquipmentProfilesModelAspect> {
final SelectableMap<EquipmentProfile> profiles;
final TogglableMap<EquipmentProfile> profiles;
final EquipmentProfile selected;
const EquipmentProfiles({

View file

@ -25,8 +25,8 @@ class FilmsProvider extends StatefulWidget {
}
class FilmsProviderState extends State<FilmsProvider> {
final Map<String, SelectableValue<Film>> predefinedFilms = {};
final Map<String, SelectableValue<FilmExponential>> customFilms = {};
final TogglableMap<Film> predefinedFilms = {};
final TogglableMap<FilmExponential> customFilms = {};
String _selectedId = '';
Film get _selectedFilm => customFilms[_selectedId]?.value ?? predefinedFilms[_selectedId]?.value ?? const FilmStub();
@ -121,10 +121,10 @@ enum _FilmsModelAspect {
}
class Films extends InheritedModel<_FilmsModelAspect> {
final Map<String, SelectableValue<Film>> predefinedFilms;
final TogglableMap<Film> predefinedFilms;
@protected
final Map<String, SelectableValue<FilmExponential>> customFilms;
final TogglableMap<FilmExponential> customFilms;
final Film selected;
const Films({

View file

@ -93,7 +93,7 @@ void main() {
testWidgets('Generate light theme screenshots', (tester) async {
await mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor);
await tester.pumpApplication(
predefinedFilms: [_mockFilm].toSelectableMap(),
predefinedFilms: [_mockFilm].toTogglableMap(),
customFilms: {},
selectedFilmId: _mockFilm.id,
);
@ -133,7 +133,7 @@ void main() {
(tester) async {
await mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor);
await tester.pumpApplication(
predefinedFilms: [_mockFilm].toSelectableMap(),
predefinedFilms: [_mockFilm].toTogglableMap(),
customFilms: {},
selectedFilmId: _mockFilm.id,
);
@ -158,7 +158,7 @@ void main() {
color: _lightThemeColor,
);
await tester.pumpApplication(
predefinedFilms: [_mockFilm].toSelectableMap(),
predefinedFilms: [_mockFilm].toTogglableMap(),
customFilms: {},
selectedFilmId: _mockFilm.id,
);

View file

@ -26,7 +26,7 @@ void main() {
),
).thenAnswer((_) async {});
when(() => storageService.deleteProfile(any<String>())).thenAnswer((_) async {});
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toSelectableMap()));
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toTogglableMap()));
});
tearDown(() {
@ -69,7 +69,7 @@ void main() {
() {
setUp(() {
when(() => storageService.selectedEquipmentProfileId).thenReturn(_customProfiles.first.id);
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toSelectableMap()));
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toTogglableMap()));
});
testWidgets(

View file

@ -17,7 +17,7 @@ void main() {
setUpAll(() {
storageService = _MockEquipmentProfilesStorageService();
when(() => storageService.getProfiles()).thenAnswer((_) async => _mockEquipmentProfiles.toSelectableMap());
when(() => storageService.getProfiles()).thenAnswer((_) async => _mockEquipmentProfiles.toTogglableMap());
when(() => storageService.selectedEquipmentProfileId).thenReturn('');
});
@ -84,7 +84,7 @@ void main() {
'Equipment profile picker shows only profiles in use',
(tester) async {
when(() => storageService.getProfiles())
.thenAnswer((_) async => _mockEquipmentProfiles.skip(1).toList().toSelectableMap());
.thenAnswer((_) async => _mockEquipmentProfiles.skip(1).toList().toTogglableMap());
await pumpApplication(tester);
await tester.openAnimatedPicker<EquipmentProfilePicker>();
expectRadioListTile<EquipmentProfile>(S.current.none, isSelected: true);

View file

@ -25,7 +25,7 @@ void main() {
),
).thenAnswer((_) async {});
when(() => storageService.deleteProfile(any<String>())).thenAnswer((_) async {});
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toSelectableMap()));
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toTogglableMap()));
});
tearDown(() {