Expand narrated story, preserve solved patterns, and add ambience

Connect the island story with new character memories and narrative transitions.
Blend each solved symbol into its artwork and retain a replayable pattern stamp.
Allow completed grids to be inspected after navigation and app restarts.
Reduce campaign difficulty spikes and keep explained story hints free.

Append 24 narrated continuations while preserving original PCM takes. Add
four offline environmental loops with saved mute/volume controls, scene
fades, narration ducking and lifecycle handling.

Validation: 31 unit/widget tests, Flutter analysis, narration and soundscape
asset checks, tablet discovery layouts and extended-audio integration,
including simultaneous active voice and ambience mixer tracks.
This commit is contained in:
Hadrian Burkhardt
2026-11-02 05:04:57 +01:00
parent 6bd14a9e20
commit 68871ec573
102 changed files with 2322 additions and 520 deletions
+143
View File
@@ -7,9 +7,152 @@ import 'package:lumen/domain/puzzle.dart';
import 'package:lumen/main.dart';
import 'package:lumen/services/progress.dart';
import 'package:lumen/ui/board.dart';
import 'package:lumen/ui/discovery.dart';
import 'package:lumen/ui/paper.dart';
void main() {
testWidgets('atmosphere controls fit large text and remember mute', (
tester,
) async {
tester.view.physicalSize = const Size(360, 640);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final book = (await tester.runAsync(Book.load))!;
final g = Game(book, Progress.memory());
g.showStory(1);
await tester.pumpWidget(
MaterialApp(
home: MediaQuery(
data: const MediaQueryData(
size: Size(360, 640),
textScaler: TextScaler.linear(1.5),
),
child: Notebook(game: g, adsEnabled: false),
),
),
);
await tester.pumpAndSettle();
final settings = find.text('Sound & atmosphere');
await tester.ensureVisible(settings);
await tester.pumpAndSettle();
await tester.tap(settings);
await tester.pumpAndSettle();
expect(
tester.widget<SwitchListTile>(find.byType(SwitchListTile)).value,
true,
);
await tester.tap(find.byType(SwitchListTile));
await tester.pumpAndSettle();
expect(g.progress.flag('ambience_enabled'), false);
expect(tester.widget<Slider>(find.byType(Slider)).onChanged, isNull);
await tester.tap(find.text('Keep going'));
await tester.pumpAndSettle();
await tester.tap(settings);
await tester.pumpAndSettle();
expect(
tester.widget<SwitchListTile>(find.byType(SwitchListTile)).value,
false,
);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
});
testWidgets(
'discovery blends the solution into art and keeps a replayable symbol',
(tester) async {
const artKey = ValueKey('test-artwork');
final picture = List.generate(49, (i) => i % 3 == 0 ? 1 : 0);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Discovery(
picture: picture,
label: 'The lantern',
height: 190,
artwork: const SizedBox(key: artKey, width: 190, height: 190),
),
),
),
);
double opacity() => tester
.widget<Opacity>(
find.ancestor(
of: find.byKey(artKey),
matching: find.byType(Opacity),
),
)
.opacity;
expect(opacity(), 0);
await tester.pump(const Duration(milliseconds: 1600));
expect(opacity(), inExclusiveRange(0, 1));
await tester.pumpAndSettle();
expect(opacity(), 1);
final stamp = tester
.widgetList<PatternStamp>(find.byType(PatternStamp))
.singleWhere((s) => s.height == 56);
expect(stamp.picture, picture);
await tester.tap(find.text('See the transformation again'));
await tester.pump();
expect(opacity(), 0);
await tester.pumpAndSettle();
await tester.pumpWidget(const SizedBox());
},
);
testWidgets(
'back from a discovery opens its completed grid and forward revisits the memory',
(tester) async {
final book = (await tester.runAsync(Book.load))!;
final g = Game(
book,
Progress.memory({
'story_access_level': 11,
'done_story_v1_4': true,
'solved': 1,
}),
);
g.reveal(4);
await tester.pumpWidget(LumenApp(game: g, adsEnabled: false));
await tester.pumpAndSettle();
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
expect(g.screen, Screen.game);
expect(find.byType(Board), findsOneWidget);
expect(g.puzzle!.solved(g.cells), true);
final forward = find.text('Revisit the memory →');
await tester.ensureVisible(forward);
await tester.pumpAndSettle();
await tester.tap(forward);
await tester.pumpAndSettle();
expect(g.screen, Screen.reveal);
expect(g.campaignIndex, 4);
expect(g.solved, 1);
await tester.pumpWidget(const SizedBox());
},
);
testWidgets('campaign help stays free after the first explained hint', (
tester,
) async {
final book = (await tester.runAsync(Book.load))!;
final g = Game(book, Progress.memory({'story_access_level': 11}));
g.startCampaign(8);
await tester.pumpWidget(LumenApp(game: g, adsEnabled: false));
await tester.pumpAndSettle();
for (var i = 0; i < 2; i++) {
final before = List<int>.of(g.cells);
final hint = find.text('Hint · free');
await tester.ensureVisible(hint);
await tester.pumpAndSettle();
await tester.tap(hint);
await tester.pumpAndSettle();
expect(g.cells, isNot(before));
expect(find.text('Watch ad'), findsNothing);
await tester.tap(find.text('Keep going'));
await tester.pumpAndSettle();
}
expect(g.solved, 0);
await tester.pumpWidget(const SizedBox());
});
testWidgets(
'object illustrations remain hidden until their own pattern is solved',
(tester) async {