31 lines
1.0 KiB
GDScript
31 lines
1.0 KiB
GDScript
extends GutTest
|
|
|
|
const GameScene = preload("res://scenes/Game.tscn")
|
|
var empty_audio_home := ""
|
|
var game: Game
|
|
|
|
func before_each() -> void:
|
|
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()
|
|
add_child_autofree(game)
|
|
await get_tree().process_frame
|
|
|
|
func after_each() -> void:
|
|
OS.set_environment("DCW_AUDIO_HOME", "")
|
|
|
|
func test_real_game_resolves_combat_with_empty_audio_home() -> void:
|
|
var audio = game.get_node("AudioLibrary")
|
|
|
|
game.submit_test_action(Vector2i.RIGHT)
|
|
var first_melee := game.submit_test_action(Vector2i.RIGHT)
|
|
var lethal_melee := game.submit_test_action(Vector2i.RIGHT)
|
|
|
|
assert_eq(first_melee[0].kind, &"melee")
|
|
assert_eq(lethal_melee[1].kind, &"enemy_defeated")
|
|
assert_false(game.get_game_state().enemies.has(&"goblin"))
|
|
assert_eq(audio.current_ambience_context, "combat")
|
|
assert_eq(audio.get_last_ambience_path(), "")
|
|
assert_eq(audio.get_last_sfx_path(), "")
|