fix: harden S4 audio verification

This commit is contained in:
goose
2026-10-01 09:02:23 -04:00
parent 0615f5b89d
commit 4e356ee7b8
6 changed files with 102 additions and 6 deletions
+11 -1
View File
@@ -1,19 +1,29 @@
extends GutTest
const GameScene = preload("res://scenes/Game.tscn")
const AudioLibrary = preload("res://scripts/infrastructure/audio_library.gd")
var empty_audio_home := ""
var previous_audio_home := ""
var game: Game
func before_each() -> void:
previous_audio_home = OS.get_environment("DCW_AUDIO_HOME")
empty_audio_home = ProjectSettings.globalize_path("user://s4-empty-audio-home")
DirAccess.make_dir_recursive_absolute(empty_audio_home)
OS.set_environment("DCW_AUDIO_HOME", empty_audio_home)
game = GameScene.instantiate()
# Replace the scene library before ready to isolate both production search roots.
var scene_audio := game.get_node("AudioLibrary")
var isolated_audio := AudioLibrary.new(empty_audio_home)
isolated_audio.name = "AudioLibrary"
game.remove_child(scene_audio)
scene_audio.free()
game.add_child(isolated_audio)
add_child_autofree(game)
await get_tree().process_frame
func after_each() -> void:
OS.set_environment("DCW_AUDIO_HOME", "")
OS.set_environment("DCW_AUDIO_HOME", previous_audio_home)
func test_real_game_resolves_combat_with_empty_audio_home() -> void:
var audio = game.get_node("AudioLibrary")