summaryrefslogtreecommitdiff
path: root/Tests/Game/test_Output.gd
diff options
context:
space:
mode:
authorSophia Pearson <codergal89@gmail.com>2022-09-04 21:52:27 +0200
committerSophia Pearson <codergal89@gmail.com>2022-09-04 21:52:27 +0200
commitf711d55d465bd8838dc55bde1f4a25d582a6bb6b (patch)
treee2b5b2ac79adf23e5f2c475ce11ee1c3c6561f0b /Tests/Game/test_Output.gd
parent2f3abbb6f1141f15ef77ac27e431bc66bb0c7899 (diff)
downloadtexty-f711d55d465bd8838dc55bde1f4a25d582a6bb6b.tar.xz
texty-f711d55d465bd8838dc55bde1f4a25d582a6bb6b.zip
tests: adjust tests to new design
Diffstat (limited to 'Tests/Game/test_Output.gd')
-rw-r--r--Tests/Game/test_Output.gd51
1 files changed, 51 insertions, 0 deletions
diff --git a/Tests/Game/test_Output.gd b/Tests/Game/test_Output.gd
new file mode 100644
index 0000000..f3793de
--- /dev/null
+++ b/Tests/Game/test_Output.gd
@@ -0,0 +1,51 @@
+extends GutTest
+
+const Scene = preload('res://Scenes/Game/Output.tscn')
+const GameOutput = preload('res://Scripts/Game/Output.cs')
+
+var _instance: GameOutput = null
+
+func _get_line_container() -> VBoxContainer:
+ return _instance.get_node('%LineContainer') as VBoxContainer
+
+func after_each():
+ yield(yield_frames(1), YIELD)
+
+func before_each():
+ var scene = Scene.instance()
+ scene.OutputBlockScene = load('res://Scenes/Game/OutputBlock.tscn')
+ _instance = add_child_autofree(scene)
+
+func after_all():
+ assert_no_new_orphans()
+
+func test_can_be_instantiated():
+ assert_not_null(_instance)
+
+func test_LineContainer_is_empty_after_instantiation():
+ assert_true(_get_line_container().get_children().empty())
+
+func test_TextBlocks_is_empty_after_instantiation():
+ assert_true(_instance.TextBlocks.empty())
+
+func test_LineContainer_is_not_empty_after_calling_Push_with_a_non_empty_string_as_text():
+ _instance.Push('this is some test data')
+ assert_false(_get_line_container().get_children().empty())
+
+func test_LineContainer_is_empty_after_calling_Push_with_an_empty_string_as_text():
+ _instance.Push('')
+ assert_true(_get_line_container().get_children().empty())
+
+func test_TextBlocks_is_not_empty_after_calling_Push_with_a_non_empty_string_as_text():
+ _instance.Push('this is some test data')
+ assert_false(_instance.TextBlocks.empty())
+
+func test_TextBlocks_is_empty_after_calling_Push_with_an_empty_string_as_text():
+ _instance.Push('')
+ assert_true(_instance.TextBlocks.empty())
+
+func test_TextBlocks_contains_all_pushed_texts_in_the_push_order():
+ var texts = ['text block a', 'text block b']
+ for text in texts:
+ _instance.Push(text)
+ assert_eq(_instance.TextBlocks, texts)