diff options
| author | Sophia Pearson <codergal89@gmail.com> | 2022-09-05 20:35:53 +0200 |
|---|---|---|
| committer | Sophia Pearson <codergal89@gmail.com> | 2022-09-05 20:35:53 +0200 |
| commit | f20bd89dc4a7bf14a88b1effcaa1887b29314525 (patch) | |
| tree | d114787f68efd2a7d61d95fa9c84e8e5d69a7c11 /Tests/Game/test_Game.gd | |
| parent | 1b477b62f8be8c546a35dbd1d2688ebf623c496f (diff) | |
| download | texty-f20bd89dc4a7bf14a88b1effcaa1887b29314525.tar.xz texty-f20bd89dc4a7bf14a88b1effcaa1887b29314525.zip | |
gui: split GUI into Terminal components
Diffstat (limited to 'Tests/Game/test_Game.gd')
| -rw-r--r-- | Tests/Game/test_Game.gd | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Tests/Game/test_Game.gd b/Tests/Game/test_Game.gd new file mode 100644 index 0000000..427d28c --- /dev/null +++ b/Tests/Game/test_Game.gd @@ -0,0 +1,50 @@ +extends GutTest + +const Scene = preload('res://Scenes/Game/Game.tscn') +const Game = preload('res://Scripts/Game/Game.cs') + +const InputArea = preload('res://Scripts/Game/CommandInputArea.cs') +const OutputArea = preload('res://Scripts/Terminal/OutputArea.cs') + +var _instance: Game = null +var _sender = InputSender.new(Input) + +func _get_output_area() -> OutputArea: + return _instance.get_node('%OutputArea') as OutputArea + +func _get_input_area() -> InputArea: + return _instance.get_node('%InputArea') as InputArea + +func before_each(): + _instance = add_child_autofree(Scene.instance()) + +func after_each(): + _sender.release_all() + _sender.clear() + +func before_all(): + _sender.set_auto_flush_input(true) + +func after_all(): + assert_no_new_orphans() + +func test_can_instantiate(): + assert_not_null(_instance) + +func test_has_OutputArea(): + assert_not_null(_get_output_area()) + +func test_OutputArea_is_empty_after_instantiation(): + assert_true(_get_output_area().TextBlocks.empty()) + +func test_has_InputArea(): + assert_not_null(_get_input_area()) + +func test_InputArea_has_focus_after_instantiation(): + assert_true(_get_input_area().HasFocus) + +func test_after_submitting_some_text_via_InputArea_OutputArea_is_not_empty(): + var textInput = _get_input_area().get_node('%TextInput') + textInput.text = 'this is a test' + UiHelpers.press_key(_sender, KEY_ENTER) + assert_false(_get_output_area().TextBlocks.empty()) |
