Add watercolour artwork for all campaign discoveries

This commit is contained in:
Hadrian Burkhardt
2026-10-31 18:25:02 +01:00
parent e163cbb832
commit 36fbbce6ef
32 changed files with 348 additions and 25 deletions
+86 -1
View File
@@ -9,6 +9,91 @@ import 'package:lumen/ui/board.dart';
import 'package:lumen/ui/paper.dart';
void main() {
testWidgets('campaign discoveries use bundled art with a pixel fallback', (
tester,
) async {
addTearDown(tester.view.reset);
final book = (await tester.runAsync(Book.load))!;
final g = Game(book, Progress.memory({'story_access_level': 11}));
expect(book.levels.every((l) => l.illustrationAsset != null), true);
for (final size in [const Size(360, 640), const Size(960, 600)]) {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
for (var index = 0; index < book.levels.length; index++) {
g.reveal(index, readAhead: true);
await tester.pumpWidget(
MaterialApp(
home: MediaQuery(
data: MediaQueryData(
size: size,
textScaler: const TextScaler.linear(1.5),
),
child: Notebook(game: g, adsEnabled: false),
),
),
);
await tester.pumpAndSettle();
final asset = book.levels[index].illustrationAsset;
if (asset != null) {
final art = find.image(AssetImage(asset));
expect(art, findsOneWidget);
expect(find.byType(PixelPicture), findsNothing);
await tester.ensureVisible(art);
await tester.pumpAndSettle();
expect(tester.getSize(art).height, 190);
} else {
expect(find.byType(PixelPicture), findsOneWidget);
}
final next = find.text(
index == 11 ? 'Return to the notebook' : 'Turn the page →',
);
await tester.ensureVisible(next);
await tester.pumpAndSettle();
expect(tester.getRect(next).bottom, lessThan(size.height));
expect(g.solved, 0);
expect(tester.takeException(), isNull);
}
g.showStory(3);
await tester.pumpAndSettle();
final match = find.image(
AssetImage(book.levels.first.illustrationAsset!),
);
expect(match, findsOneWidget);
expect(tester.getSize(match).height, 155);
final nextLeaf = find.text('Next leaf →');
await tester.ensureVisible(nextLeaf);
await tester.pumpAndSettle();
expect(nextLeaf.hitTestable(), findsOneWidget);
expect(tester.takeException(), isNull);
}
await tester.pumpWidget(const SizedBox());
});
testWidgets('a discovery without artwork keeps its pixel picture', (
tester,
) async {
final book = (await tester.runAsync(Book.load))!;
final original = book.levels.first;
book.levels[0] = CampaignLevel({
'chapter': original.chapter,
'title': original.title,
'object': original.object,
'before': original.before,
'after': original.after,
'picture': original.picture.join(),
'clues': original.clues,
'areas': original.areas,
});
final game = Game(book, Progress.memory());
game.reveal(0, readAhead: true);
await tester.pumpWidget(LumenApp(game: game, adsEnabled: false));
await tester.pumpAndSettle();
expect(find.byType(PixelPicture), findsOneWidget);
expect(game.solved, 0);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
});
testWidgets('page margins turn leaves; grid drags never turn', (
tester,
) async {
@@ -179,7 +264,7 @@ void main() {
tester.view.physicalSize = const Size(width, height);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final book = await Book.load();
final book = (await tester.runAsync(Book.load))!;
final game = Game(book, Progress.memory());
game.startCampaign(0);
await tester.pumpWidget(LumenApp(game: game, adsEnabled: false));