2023-06-21 09:29:36 +00:00
|
|
|
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
|
|
|
void main() {
|
2023-08-06 14:28:20 +00:00
|
|
|
group(
|
|
|
|
'fromJson()',
|
|
|
|
() {
|
|
|
|
test('All keys', () {
|
|
|
|
expect(
|
|
|
|
MeteringScreenLayoutConfigJson.fromJson(
|
|
|
|
{
|
|
|
|
'0': true,
|
|
|
|
'1': true,
|
|
|
|
'2': true,
|
2023-09-02 08:32:08 +00:00
|
|
|
'3': true,
|
2023-08-06 14:28:20 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
{
|
|
|
|
MeteringScreenLayoutFeature.extremeExposurePairs: true,
|
|
|
|
MeteringScreenLayoutFeature.filmPicker: true,
|
2023-09-02 08:32:08 +00:00
|
|
|
MeteringScreenLayoutFeature.equipmentProfiles: true,
|
2023-08-06 14:28:20 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2023-09-02 08:32:08 +00:00
|
|
|
test('Legacy (no histogram & equipment profiles)', () {
|
2023-08-06 14:28:20 +00:00
|
|
|
expect(
|
|
|
|
MeteringScreenLayoutConfigJson.fromJson(
|
|
|
|
{
|
2023-09-02 08:32:08 +00:00
|
|
|
'0': false,
|
|
|
|
'1': false,
|
2023-08-06 14:28:20 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
{
|
2023-09-02 08:32:08 +00:00
|
|
|
MeteringScreenLayoutFeature.extremeExposurePairs: false,
|
|
|
|
MeteringScreenLayoutFeature.filmPicker: false,
|
|
|
|
MeteringScreenLayoutFeature.equipmentProfiles: true,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Legacy (no equipment profiles)', () {
|
|
|
|
expect(
|
|
|
|
MeteringScreenLayoutConfigJson.fromJson(
|
|
|
|
{
|
|
|
|
'0': false,
|
|
|
|
'1': false,
|
|
|
|
'2': false,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
{
|
|
|
|
MeteringScreenLayoutFeature.extremeExposurePairs: false,
|
|
|
|
MeteringScreenLayoutFeature.filmPicker: false,
|
|
|
|
MeteringScreenLayoutFeature.equipmentProfiles: true,
|
2023-08-06 14:28:20 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
2023-06-21 09:29:36 +00:00
|
|
|
|
2023-09-02 08:32:08 +00:00
|
|
|
test('toJson()', () {
|
2023-06-21 09:29:36 +00:00
|
|
|
expect(
|
|
|
|
{
|
2023-09-02 08:32:08 +00:00
|
|
|
MeteringScreenLayoutFeature.equipmentProfiles: true,
|
2023-06-21 09:29:36 +00:00
|
|
|
MeteringScreenLayoutFeature.extremeExposurePairs: true,
|
|
|
|
MeteringScreenLayoutFeature.filmPicker: true,
|
|
|
|
}.toJson(),
|
2023-08-06 14:28:20 +00:00
|
|
|
{
|
2023-11-11 20:05:11 +00:00
|
|
|
'equipmentProfiles': true,
|
|
|
|
'extremeExposurePairs': true,
|
|
|
|
'filmPicker': true,
|
2023-08-06 14:28:20 +00:00
|
|
|
},
|
2023-06-21 09:29:36 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|