Files
SDKmuta/test/target_style_test.dart
2026-11-28 12:22:02 +01:00

29 lines
1.2 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:sd_kovinar/models/target_style.dart';
void main() {
test('every target design has its image, and ids are unique', () {
final ids = <int>{};
for (final style in [...TargetStyle.all, ...TargetStyle.holidays]) {
expect(ids.add(style.id), isTrue, reason: 'duplicate id ${style.id}');
final asset = style.asset;
if (style.isDefault) {
expect(asset, isNull); // drawn as vectors
} else {
expect(File(asset!).existsSync(), isTrue, reason: '$asset missing');
}
}
// Every design (picker and holidays) has its screen background, dark and light
for (final style in [...TargetStyle.all, ...TargetStyle.holidays]) {
for (final dark in [true, false]) {
expect(File(style.background(dark)).existsSync(), isTrue, reason: '${style.background(dark)} missing');
}
}
expect(TargetStyle.byId(13), TargetStyle.fallback); // removed skin falls back to the default
expect(TargetStyle.all.length, 9); // the default and eight designs (a 3 × 3 picker)
expect(TargetStyle.byId(24), TargetStyle.fallback); // a design no longer shipped falls back too
});
}