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,
|
|
|
|
MeteringScreenLayoutFeature.histogram: 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,
|
2023-08-06 14:28:20 +00:00
|
|
|
MeteringScreenLayoutFeature.histogram: true,
|
2023-09-02 08:32:08 +00:00
|
|
|
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,
|
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,
|
2023-08-06 14:28:20 +00:00
|
|
|
MeteringScreenLayoutFeature.histogram: true,
|
2023-06-21 09:29:36 +00:00
|
|
|
}.toJson(),
|
2023-08-06 14:28:20 +00:00
|
|
|
{
|
2023-09-02 08:32:08 +00:00
|
|
|
'3': true,
|
2023-08-06 14:28:20 +00:00
|
|
|
'0': true,
|
|
|
|
'1': true,
|
|
|
|
'2': true,
|
|
|
|
},
|
2023-06-21 09:29:36 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|