m3_lightmeter/test/data/models/metering_screen_layout_config_test.dart
Vadim 4bb080a144
Implemented IAP & Equipment profiles (#89)
* added equipment profiles to layout config

* calculate layout height based on `MeteringScreenLayoutFeature`

* Update cd_dev.yml

* Fixed equipment profile tile padding

* import

* `webfactory/ssh-agent`

* Update pubspec.yaml

* fixed `MeteringScreenLayoutConfigJson` tests

* fixed `UserPreferencesService` tests

* reset selected equipment profile when layout feature is disabled

* `IAPProductType.equipment` -> `IAPProductType.paidFeatures`

* updated packages versions

* Update shared_prefs_service.dart

* Fixed & tested exposure pairs list builder

* typo

* typo

* added iap repo stub

* Renamed `EquipmentProfileData` ->`EquipmentProfile`

* Moved `EquipmentProfileProvider` to iap repo

* Update README.md

* Fixed `EquipmentProfileListener`

* Improved `EquipmentProfilesListTile` statuses visualization

* Update README.md

* Update ci.yml

* Post-merge fixes

* typo

* Added workflow checks

* more sophisticated iap icons

* Include IAP by default

* added loader for `IAPProductStatus.pending`

* typo

* Added equipment profiles list placeholder

* typo

* separated `IconPlaceholder`

* improved `buildExposureValues` testing

* cleanup
2023-09-02 10:32:08 +02:00

80 lines
2.1 KiB
Dart

import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
import 'package:test/test.dart';
void main() {
group(
'fromJson()',
() {
test('All keys', () {
expect(
MeteringScreenLayoutConfigJson.fromJson(
{
'0': true,
'1': true,
'2': true,
'3': true,
},
),
{
MeteringScreenLayoutFeature.extremeExposurePairs: true,
MeteringScreenLayoutFeature.filmPicker: true,
MeteringScreenLayoutFeature.histogram: true,
MeteringScreenLayoutFeature.equipmentProfiles: true,
},
);
});
test('Legacy (no histogram & equipment profiles)', () {
expect(
MeteringScreenLayoutConfigJson.fromJson(
{
'0': false,
'1': false,
},
),
{
MeteringScreenLayoutFeature.extremeExposurePairs: false,
MeteringScreenLayoutFeature.filmPicker: false,
MeteringScreenLayoutFeature.histogram: true,
MeteringScreenLayoutFeature.equipmentProfiles: true,
},
);
});
test('Legacy (no equipment profiles)', () {
expect(
MeteringScreenLayoutConfigJson.fromJson(
{
'0': false,
'1': false,
'2': false,
},
),
{
MeteringScreenLayoutFeature.extremeExposurePairs: false,
MeteringScreenLayoutFeature.filmPicker: false,
MeteringScreenLayoutFeature.histogram: false,
MeteringScreenLayoutFeature.equipmentProfiles: true,
},
);
});
},
);
test('toJson()', () {
expect(
{
MeteringScreenLayoutFeature.equipmentProfiles: true,
MeteringScreenLayoutFeature.extremeExposurePairs: true,
MeteringScreenLayoutFeature.filmPicker: true,
MeteringScreenLayoutFeature.histogram: true,
}.toJson(),
{
'3': true,
'0': true,
'1': true,
'2': true,
},
);
});
}