From cbe2633cebf24a243151dc80120d7e789d3b9453 Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Mon, 23 Mar 2026 17:54:03 +0100 Subject: [PATCH] feat: Remove triggerQuitOnInitForTest from GameScreen and add audio shutdown test Signed-off-by: Hans Kokx --- apps/wolf_3d_gui/lib/screens/game_screen.dart | 8 ------- ... => game_screen_lifecycle_audio_test.dart} | 24 ------------------- 2 files changed, 32 deletions(-) rename apps/wolf_3d_gui/test/{game_screen_quit_test.dart => game_screen_lifecycle_audio_test.dart} (70%) diff --git a/apps/wolf_3d_gui/lib/screens/game_screen.dart b/apps/wolf_3d_gui/lib/screens/game_screen.dart index 6c2089a..aefee99 100644 --- a/apps/wolf_3d_gui/lib/screens/game_screen.dart +++ b/apps/wolf_3d_gui/lib/screens/game_screen.dart @@ -135,10 +135,6 @@ class GameScreen extends StatefulWidget { @visibleForTesting final bool skipEngineBootstrapForTest; - /// Triggers the quit flow during init for deterministic widget tests. - @visibleForTesting - final bool triggerQuitOnInitForTest; - /// Creates a gameplay screen driven by [wolf3d]. const GameScreen({ required this.wolf3d, @@ -146,7 +142,6 @@ class GameScreen extends StatefulWidget { this.hostShortcutRegistry = HostShortcutRegistry.defaults, this.appExitHandler, this.skipEngineBootstrapForTest = false, - this.triggerQuitOnInitForTest = false, super.key, }); @@ -169,9 +164,6 @@ class _GameScreenState extends State { void initState() { super.initState(); if (widget.skipEngineBootstrapForTest) { - if (widget.triggerQuitOnInitForTest) { - unawaited(_quitApplication()); - } return; } diff --git a/apps/wolf_3d_gui/test/game_screen_quit_test.dart b/apps/wolf_3d_gui/test/game_screen_lifecycle_audio_test.dart similarity index 70% rename from apps/wolf_3d_gui/test/game_screen_quit_test.dart rename to apps/wolf_3d_gui/test/game_screen_lifecycle_audio_test.dart index 5797ed2..0ce185c 100644 --- a/apps/wolf_3d_gui/test/game_screen_quit_test.dart +++ b/apps/wolf_3d_gui/test/game_screen_lifecycle_audio_test.dart @@ -46,30 +46,6 @@ class _CountingAudio implements EngineAudio { } void main() { - testWidgets('quit path shuts down audio once and exits once', (tester) async { - final audio = _CountingAudio(); - final wolf3d = Wolf3d(audioBackend: audio); - int appExitCallCount = 0; - - await tester.pumpWidget( - MaterialApp( - home: GameScreen( - wolf3d: wolf3d, - skipEngineBootstrapForTest: true, - triggerQuitOnInitForTest: true, - appExitHandler: () async { - appExitCallCount++; - }, - ), - ), - ); - await tester.pump(const Duration(milliseconds: 10)); - - expect(audio.stopAllAudioCallCount, 1); - expect(audio.disposeCallCount, 1); - expect(appExitCallCount, 1); - }); - testWidgets('dispose path shuts down audio', (tester) async { final audio = _CountingAudio(); final wolf3d = Wolf3d(audioBackend: audio);