20 lines
634 B
GDScript
20 lines
634 B
GDScript
extends GutTest
|
|
|
|
const GameScene = preload("res://scenes/Game.tscn")
|
|
|
|
func test_hud_shows_exact_chest_prompt_only_while_the_chest_is_a_context_target() -> void:
|
|
var game := GameScene.instantiate() as Game
|
|
add_child_autofree(game)
|
|
await get_tree().process_frame
|
|
var state := game.get_game_state()
|
|
var hud := game.get_node("HUD") as GameHud
|
|
|
|
state.map.set_cell(Vector2i(4, 11), GridMapState.CellKind.FLOOR)
|
|
state.player.cell = Vector2i(4, 8)
|
|
hud.refresh(state)
|
|
assert_eq(hud.get_context_prompt(), "Espace — Ouvrir le coffre")
|
|
|
|
state.player.cell = Vector2i(4, 10)
|
|
hud.refresh(state)
|
|
assert_eq(hud.get_context_prompt(), "")
|