mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
sync with iap rename
This commit is contained in:
parent
4e6f9dff17
commit
1cd1bc298a
10 changed files with 29 additions and 29 deletions
|
@ -22,11 +22,11 @@ class FilmsStorageService {
|
||||||
|
|
||||||
Future<void> deleteFilm(FilmExponential _) async {}
|
Future<void> deleteFilm(FilmExponential _) async {}
|
||||||
|
|
||||||
Future<Map<String, SelectableValue<Film>>> getPredefinedFilms() async {
|
Future<TogglableMap<Film>> getPredefinedFilms() async {
|
||||||
return const {};
|
return const {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, SelectableValue<FilmExponential>>> getCustomFilms() async {
|
Future<TogglableMap<FilmExponential>> getCustomFilms() async {
|
||||||
return const {};
|
return const {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ void testE2E(String description) {
|
||||||
(tester) async {
|
(tester) async {
|
||||||
await tester.pumpApplication(
|
await tester.pumpApplication(
|
||||||
equipmentProfiles: {},
|
equipmentProfiles: {},
|
||||||
predefinedFilms: mockFilms.toSelectableMap(),
|
predefinedFilms: mockFilms.toTogglableMap(),
|
||||||
customFilms: {},
|
customFilms: {},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -10,24 +10,24 @@ class _MockEquipmentProfilesStorageService extends Mock implements EquipmentProf
|
||||||
class _MockFilmsStorageService extends Mock implements FilmsStorageService {}
|
class _MockFilmsStorageService extends Mock implements FilmsStorageService {}
|
||||||
|
|
||||||
class MockIAPProviders extends StatefulWidget {
|
class MockIAPProviders extends StatefulWidget {
|
||||||
final SelectableMap<EquipmentProfile> equipmentProfiles;
|
final TogglableMap<EquipmentProfile> equipmentProfiles;
|
||||||
final String selectedEquipmentProfileId;
|
final String selectedEquipmentProfileId;
|
||||||
final Map<String, SelectableValue<Film>> predefinedFilms;
|
final TogglableMap<Film> predefinedFilms;
|
||||||
final Map<String, SelectableValue<FilmExponential>> customFilms;
|
final TogglableMap<FilmExponential> customFilms;
|
||||||
final String selectedFilmId;
|
final String selectedFilmId;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
MockIAPProviders({
|
MockIAPProviders({
|
||||||
SelectableMap<EquipmentProfile>? equipmentProfiles,
|
TogglableMap<EquipmentProfile>? equipmentProfiles,
|
||||||
this.selectedEquipmentProfileId = '',
|
this.selectedEquipmentProfileId = '',
|
||||||
Map<String, SelectableValue<Film>>? predefinedFilms,
|
TogglableMap<Film>? predefinedFilms,
|
||||||
Map<String, SelectableValue<FilmExponential>>? customFilms,
|
TogglableMap<FilmExponential>? customFilms,
|
||||||
String? selectedFilmId,
|
String? selectedFilmId,
|
||||||
required this.child,
|
required this.child,
|
||||||
super.key,
|
super.key,
|
||||||
}) : equipmentProfiles = equipmentProfiles ?? mockEquipmentProfiles.toSelectableMap(),
|
}) : equipmentProfiles = equipmentProfiles ?? mockEquipmentProfiles.toTogglableMap(),
|
||||||
predefinedFilms = predefinedFilms ?? mockFilms.toSelectableMap(),
|
predefinedFilms = predefinedFilms ?? mockFilms.toTogglableMap(),
|
||||||
customFilms = customFilms ?? mockFilms.toSelectableMap(),
|
customFilms = customFilms ?? mockFilms.toTogglableMap(),
|
||||||
selectedFilmId = selectedFilmId ?? const FilmStub().id;
|
selectedFilmId = selectedFilmId ?? const FilmStub().id;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -20,10 +20,10 @@ const mockPhotoEv100 = 8.3;
|
||||||
extension WidgetTesterCommonActions on WidgetTester {
|
extension WidgetTesterCommonActions on WidgetTester {
|
||||||
Future<void> pumpApplication({
|
Future<void> pumpApplication({
|
||||||
IAPProductStatus productStatus = IAPProductStatus.purchased,
|
IAPProductStatus productStatus = IAPProductStatus.purchased,
|
||||||
SelectableMap<EquipmentProfile>? equipmentProfiles,
|
TogglableMap<EquipmentProfile>? equipmentProfiles,
|
||||||
String selectedEquipmentProfileId = '',
|
String selectedEquipmentProfileId = '',
|
||||||
Map<String, SelectableValue<Film>>? predefinedFilms,
|
TogglableMap<Film>? predefinedFilms,
|
||||||
Map<String, SelectableValue<FilmExponential>>? customFilms,
|
TogglableMap<FilmExponential>? customFilms,
|
||||||
String selectedFilmId = '',
|
String selectedFilmId = '',
|
||||||
}) async {
|
}) async {
|
||||||
await pumpWidget(
|
await pumpWidget(
|
||||||
|
|
|
@ -34,7 +34,7 @@ class EquipmentProfilesProvider extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EquipmentProfilesProviderState extends State<EquipmentProfilesProvider> {
|
class EquipmentProfilesProviderState extends State<EquipmentProfilesProvider> {
|
||||||
final SelectableMap<EquipmentProfile> _customProfiles = {};
|
final TogglableMap<EquipmentProfile> _customProfiles = {};
|
||||||
String _selectedId = '';
|
String _selectedId = '';
|
||||||
|
|
||||||
EquipmentProfile get _selectedProfile =>
|
EquipmentProfile get _selectedProfile =>
|
||||||
|
@ -135,7 +135,7 @@ enum _EquipmentProfilesModelAspect {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EquipmentProfiles extends InheritedModel<_EquipmentProfilesModelAspect> {
|
class EquipmentProfiles extends InheritedModel<_EquipmentProfilesModelAspect> {
|
||||||
final SelectableMap<EquipmentProfile> profiles;
|
final TogglableMap<EquipmentProfile> profiles;
|
||||||
final EquipmentProfile selected;
|
final EquipmentProfile selected;
|
||||||
|
|
||||||
const EquipmentProfiles({
|
const EquipmentProfiles({
|
||||||
|
|
|
@ -25,8 +25,8 @@ class FilmsProvider extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilmsProviderState extends State<FilmsProvider> {
|
class FilmsProviderState extends State<FilmsProvider> {
|
||||||
final Map<String, SelectableValue<Film>> predefinedFilms = {};
|
final TogglableMap<Film> predefinedFilms = {};
|
||||||
final Map<String, SelectableValue<FilmExponential>> customFilms = {};
|
final TogglableMap<FilmExponential> customFilms = {};
|
||||||
String _selectedId = '';
|
String _selectedId = '';
|
||||||
|
|
||||||
Film get _selectedFilm => customFilms[_selectedId]?.value ?? predefinedFilms[_selectedId]?.value ?? const FilmStub();
|
Film get _selectedFilm => customFilms[_selectedId]?.value ?? predefinedFilms[_selectedId]?.value ?? const FilmStub();
|
||||||
|
@ -121,10 +121,10 @@ enum _FilmsModelAspect {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Films extends InheritedModel<_FilmsModelAspect> {
|
class Films extends InheritedModel<_FilmsModelAspect> {
|
||||||
final Map<String, SelectableValue<Film>> predefinedFilms;
|
final TogglableMap<Film> predefinedFilms;
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
final Map<String, SelectableValue<FilmExponential>> customFilms;
|
final TogglableMap<FilmExponential> customFilms;
|
||||||
final Film selected;
|
final Film selected;
|
||||||
|
|
||||||
const Films({
|
const Films({
|
||||||
|
|
|
@ -93,7 +93,7 @@ void main() {
|
||||||
testWidgets('Generate light theme screenshots', (tester) async {
|
testWidgets('Generate light theme screenshots', (tester) async {
|
||||||
await mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor);
|
await mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor);
|
||||||
await tester.pumpApplication(
|
await tester.pumpApplication(
|
||||||
predefinedFilms: [_mockFilm].toSelectableMap(),
|
predefinedFilms: [_mockFilm].toTogglableMap(),
|
||||||
customFilms: {},
|
customFilms: {},
|
||||||
selectedFilmId: _mockFilm.id,
|
selectedFilmId: _mockFilm.id,
|
||||||
);
|
);
|
||||||
|
@ -133,7 +133,7 @@ void main() {
|
||||||
(tester) async {
|
(tester) async {
|
||||||
await mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor);
|
await mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor);
|
||||||
await tester.pumpApplication(
|
await tester.pumpApplication(
|
||||||
predefinedFilms: [_mockFilm].toSelectableMap(),
|
predefinedFilms: [_mockFilm].toTogglableMap(),
|
||||||
customFilms: {},
|
customFilms: {},
|
||||||
selectedFilmId: _mockFilm.id,
|
selectedFilmId: _mockFilm.id,
|
||||||
);
|
);
|
||||||
|
@ -158,7 +158,7 @@ void main() {
|
||||||
color: _lightThemeColor,
|
color: _lightThemeColor,
|
||||||
);
|
);
|
||||||
await tester.pumpApplication(
|
await tester.pumpApplication(
|
||||||
predefinedFilms: [_mockFilm].toSelectableMap(),
|
predefinedFilms: [_mockFilm].toTogglableMap(),
|
||||||
customFilms: {},
|
customFilms: {},
|
||||||
selectedFilmId: _mockFilm.id,
|
selectedFilmId: _mockFilm.id,
|
||||||
);
|
);
|
||||||
|
|
|
@ -26,7 +26,7 @@ void main() {
|
||||||
),
|
),
|
||||||
).thenAnswer((_) async {});
|
).thenAnswer((_) async {});
|
||||||
when(() => storageService.deleteProfile(any<String>())).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(() {
|
tearDown(() {
|
||||||
|
@ -69,7 +69,7 @@ void main() {
|
||||||
() {
|
() {
|
||||||
setUp(() {
|
setUp(() {
|
||||||
when(() => storageService.selectedEquipmentProfileId).thenReturn(_customProfiles.first.id);
|
when(() => storageService.selectedEquipmentProfileId).thenReturn(_customProfiles.first.id);
|
||||||
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toSelectableMap()));
|
when(() => storageService.getProfiles()).thenAnswer((_) => Future.value(_customProfiles.toTogglableMap()));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
|
|
|
@ -17,7 +17,7 @@ void main() {
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
storageService = _MockEquipmentProfilesStorageService();
|
storageService = _MockEquipmentProfilesStorageService();
|
||||||
when(() => storageService.getProfiles()).thenAnswer((_) async => _mockEquipmentProfiles.toSelectableMap());
|
when(() => storageService.getProfiles()).thenAnswer((_) async => _mockEquipmentProfiles.toTogglableMap());
|
||||||
when(() => storageService.selectedEquipmentProfileId).thenReturn('');
|
when(() => storageService.selectedEquipmentProfileId).thenReturn('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void main() {
|
||||||
'Equipment profile picker shows only profiles in use',
|
'Equipment profile picker shows only profiles in use',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
when(() => storageService.getProfiles())
|
when(() => storageService.getProfiles())
|
||||||
.thenAnswer((_) async => _mockEquipmentProfiles.skip(1).toList().toSelectableMap());
|
.thenAnswer((_) async => _mockEquipmentProfiles.skip(1).toList().toTogglableMap());
|
||||||
await pumpApplication(tester);
|
await pumpApplication(tester);
|
||||||
await tester.openAnimatedPicker<EquipmentProfilePicker>();
|
await tester.openAnimatedPicker<EquipmentProfilePicker>();
|
||||||
expectRadioListTile<EquipmentProfile>(S.current.none, isSelected: true);
|
expectRadioListTile<EquipmentProfile>(S.current.none, isSelected: true);
|
||||||
|
|
|
@ -25,7 +25,7 @@ void main() {
|
||||||
),
|
),
|
||||||
).thenAnswer((_) async {});
|
).thenAnswer((_) async {});
|
||||||
when(() => storageService.deleteProfile(any<String>())).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(() {
|
tearDown(() {
|
||||||
|
|
Loading…
Reference in a new issue