blob: 51be7bad09fc729993bbf2579260f5344fc5d9c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
extends GutTest
const Scene = preload('res://Scenes/Terminal/OutputArea.tscn')
const GameOutput = preload('res://Scripts/Terminal/OutputArea.cs')
var _instance: GameOutput = null
func _get_line_container() -> VBoxContainer:
return _instance.get_node('%LineContainer') as VBoxContainer
func after_each():
await yield_frames(1).YIELD
func before_each():
var scene = Scene.instantiate()
scene.OutputBlockScene = preload('res://Scenes/Terminal/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().is_empty())
func test_TextBlocks_is_empty_after_instantiation():
assert_true(_instance.TextBlocks.is_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().is_empty())
func test_LineContainer_is_empty_after_calling_Push_with_an_empty_string_as_text():
_instance.Push('')
assert_true(_get_line_container().get_children().is_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.is_empty())
func test_TextBlocks_is_empty_after_calling_Push_with_an_empty_string_as_text():
_instance.Push('')
assert_true(_instance.TextBlocks.is_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)
|