Files
DungeonCrawlerWorld/tests/e2e/test_stair_deadline_e2e.gd
T

29 lines
1023 B
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
extends GutTest
const GameScene = preload("res://scenes/Game.tscn")
var game: Game
func before_each() -> void:
game = GameScene.instantiate()
add_child_autofree(game)
await get_tree().process_frame
func test_surface_stairs_are_immediately_open_then_first_dungeon_floor_has_a_deadline() -> void:
var state := game.get_game_state()
var hud := game.get_node("HUD") as GameHud
state.player.cell = state.floor_state.exit
hud.refresh(state, [], game.get_run_state())
assert_eq(hud.get_context_prompt(), "Espace — Descendre l’escalier")
game._unhandled_input(_key_event(KEY_E))
assert_eq(game.get_run_state().current_floor, 1)
assert_eq(state.player.cell, state.floor_state.entrance)
assert_eq(hud.get_context_prompt(), "Espace — Monter l’escalier")
assert_eq(game.get_run_state().current_floor_deadline().remaining_days(), 15)
func _key_event(keycode: Key) -> InputEventKey:
var event := InputEventKey.new()
event.keycode = keycode
event.physical_keycode = keycode
event.pressed = true
return event