feat: add deterministic run state and events
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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_real_game_action_records_the_same_event_in_run_log_and_hud() -> void:
|
||||
var results := game.submit_test_action(Vector2i.RIGHT)
|
||||
var events := game.get_run_state().recent_events(results.size())
|
||||
var event_log := game.get_node("HUD/EventLog") as RichTextLabel
|
||||
|
||||
assert_eq(results[0].kind, &"moved")
|
||||
assert_eq(events.size(), results.size())
|
||||
assert_eq(events[0].kind, results[0].kind)
|
||||
assert_eq(events[0].message, results[0].message)
|
||||
assert_string_contains(event_log.get_parsed_text(), events[0].message)
|
||||
@@ -0,0 +1 @@
|
||||
uid://mhgnlm476x2d
|
||||
Reference in New Issue
Block a user