diff options
| author | Sophia Pearson <codergal89@gmail.com> | 2022-10-03 22:22:50 +0200 |
|---|---|---|
| committer | Sophia Pearson <codergal89@gmail.com> | 2022-10-04 22:18:18 +0200 |
| commit | e127ad39e742396030352240d829bc903b1d4464 (patch) | |
| tree | 10cc21d70bf13181aef7c8ad0344077ff63579a3 /Tests | |
| parent | ddbb045f6387a8ba23b1210b27a745516a387a52 (diff) | |
| download | texty-e127ad39e742396030352240d829bc903b1d4464.tar.xz texty-e127ad39e742396030352240d829bc903b1d4464.zip | |
godot: inital Godot 4 migration
Diffstat (limited to 'Tests')
| -rw-r--r-- | Tests/Game/Commands/test_LookCommand.gd | 2 | ||||
| -rw-r--r-- | Tests/Game/test_CommandInputArea.gd | 6 | ||||
| -rw-r--r-- | Tests/Game/test_Game.gd | 6 | ||||
| -rw-r--r-- | Tests/Terminal/test_OutputArea.gd | 16 | ||||
| -rw-r--r-- | Tests/Terminal/test_OutputBlock.gd | 6 | ||||
| -rw-r--r-- | Tests/Terminal/test_StatusArea.gd | 10 | ||||
| -rw-r--r-- | Tests/ui_helpers.gd | 6 |
7 files changed, 26 insertions, 26 deletions
diff --git a/Tests/Game/Commands/test_LookCommand.gd b/Tests/Game/Commands/test_LookCommand.gd index 558efc1..debeeed 100644 --- a/Tests/Game/Commands/test_LookCommand.gd +++ b/Tests/Game/Commands/test_LookCommand.gd @@ -34,7 +34,7 @@ func test_parsing_look_at_command_without_further_arguments_returns_look_command assert_eq('At', parse('look at').ModifierAsString) func test_parsing_look_at_command_with_more_arguments_returns_look_command_with_non_empty_target(): - assert_ne('', parse('look at door on the left').Target) + assert_ne('', parse('look at door checked the left').Target) func test_parsing_look_at_command_with_an_additional_argument_returns_look_command_with_the_additional_argument_as_the_target(): assert_eq('window', parse('look at window').Target) diff --git a/Tests/Game/test_CommandInputArea.gd b/Tests/Game/test_CommandInputArea.gd index c233ec4..9d67927 100644 --- a/Tests/Game/test_CommandInputArea.gd +++ b/Tests/Game/test_CommandInputArea.gd @@ -20,7 +20,7 @@ func _set_input_text(text): textInputNode.emit_signal('text_changed', textInputNode.text) func before_each(): - _instance = add_child_autofree(Scene.instance()) + _instance = add_child_autofree(Scene.instantiate()) func after_each(): _sender.release_all() @@ -81,9 +81,9 @@ func test_UnknownInputSubmitted_signal_is_emitted_when_enter_is_pressed_with_a_v func test_TextInput_is_empty_after_submitting_a_valid_command(): _set_input_text(_valid_input) UiHelpers.press_key(_sender, KEY_ENTER) - assert_true(_get_input_node().text.empty()) + assert_true(_get_input_node().text.is_empty()) func test_TextInput_is_empty_after_submitting_an_invalid_command(): _set_input_text(_invalid_input) UiHelpers.press_key(_sender, KEY_ENTER) - assert_true(_get_input_node().text.empty()) + assert_true(_get_input_node().text.is_empty()) diff --git a/Tests/Game/test_Game.gd b/Tests/Game/test_Game.gd index 427d28c..d619b21 100644 --- a/Tests/Game/test_Game.gd +++ b/Tests/Game/test_Game.gd @@ -16,7 +16,7 @@ func _get_input_area() -> InputArea: return _instance.get_node('%InputArea') as InputArea func before_each(): - _instance = add_child_autofree(Scene.instance()) + _instance = add_child_autofree(Scene.instantiate()) func after_each(): _sender.release_all() @@ -35,7 +35,7 @@ func test_has_OutputArea(): assert_not_null(_get_output_area()) func test_OutputArea_is_empty_after_instantiation(): - assert_true(_get_output_area().TextBlocks.empty()) + assert_true(_get_output_area().TextBlocks.is_empty()) func test_has_InputArea(): assert_not_null(_get_input_area()) @@ -47,4 +47,4 @@ 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()) + assert_false(_get_output_area().TextBlocks.is_empty()) diff --git a/Tests/Terminal/test_OutputArea.gd b/Tests/Terminal/test_OutputArea.gd index 88beddb..51be7ba 100644 --- a/Tests/Terminal/test_OutputArea.gd +++ b/Tests/Terminal/test_OutputArea.gd @@ -9,10 +9,10 @@ func _get_line_container() -> VBoxContainer: return _instance.get_node('%LineContainer') as VBoxContainer func after_each(): - yield(yield_frames(1), YIELD) + await yield_frames(1).YIELD func before_each(): - var scene = Scene.instance() + var scene = Scene.instantiate() scene.OutputBlockScene = preload('res://Scenes/Terminal/OutputBlock.tscn') _instance = add_child_autofree(scene) @@ -23,26 +23,26 @@ func test_can_be_instantiated(): assert_not_null(_instance) func test_LineContainer_is_empty_after_instantiation(): - assert_true(_get_line_container().get_children().empty()) + assert_true(_get_line_container().get_children().is_empty()) func test_TextBlocks_is_empty_after_instantiation(): - assert_true(_instance.TextBlocks.empty()) + 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().empty()) + 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().empty()) + 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.empty()) + 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.empty()) + 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'] diff --git a/Tests/Terminal/test_OutputBlock.gd b/Tests/Terminal/test_OutputBlock.gd index f586c55..f0c2b29 100644 --- a/Tests/Terminal/test_OutputBlock.gd +++ b/Tests/Terminal/test_OutputBlock.gd @@ -10,7 +10,7 @@ var _instance: OutputBlock = null func before_each(): - _instance = add_child_autofree(Scene.instance()) + _instance = add_child_autofree(Scene.instantiate()) func after_all(): assert_no_new_orphans() @@ -25,8 +25,8 @@ func test_ContentLabel_bbcode_enabled_is_enabled_after_instantiation(): assert_true(_instance.get_node('ContentLabel').bbcode_enabled) func test_ContentLabel_is_empty_after_instantiation(): - assert_eq(_instance.get_node('ContentLabel').bbcode_text, '') + assert_eq(_instance.get_node('ContentLabel').text, '') func test_setting_Content_sets_ContentLabel_bbcode_text(): _instance.Content = 'test' - assert_eq(_instance.get_node('ContentLabel').bbcode_text, 'test') + assert_eq(_instance.get_node('ContentLabel').text, 'test') diff --git a/Tests/Terminal/test_StatusArea.gd b/Tests/Terminal/test_StatusArea.gd index 8277210..752b5c8 100644 --- a/Tests/Terminal/test_StatusArea.gd +++ b/Tests/Terminal/test_StatusArea.gd @@ -9,7 +9,7 @@ func _get_title_label() -> RichTextLabel: return _instance.get_node('%TitleLabel') as RichTextLabel func before_each(): - _instance = add_child_autofree(Scene.instance()) + _instance = add_child_autofree(Scene.instantiate()) func after_all(): assert_no_new_orphans() @@ -18,15 +18,15 @@ func test_can_be_instantiated(): assert_not_null(_instance) func test_Title_is_empty_after_instantiation(): - assert_true(_instance.Title.empty()) + assert_true(_instance.Title.is_empty()) func test_TitleLabel_is_empty_after_instantiation(): - assert_true(_get_title_label().text.empty()) + assert_true(_get_title_label().text.is_empty()) func test_setting_Title_to_a_non_empty_string_makes_TitleLable_non_empty(): _instance.Title = 'this is a test title' - assert_false(_get_title_label().text.empty()) + assert_false(_get_title_label().text.is_empty()) func test_setting_Title_sets_the_bbcode_text_property_on_TitleLabel(): _instance.Title = '[wave]this is a test title[/wave]' - assert_false(_get_title_label().bbcode_text.empty()) + assert_false(_get_title_label().text.is_empty()) diff --git a/Tests/ui_helpers.gd b/Tests/ui_helpers.gd index 96806b6..ecb1553 100644 --- a/Tests/ui_helpers.gd +++ b/Tests/ui_helpers.gd @@ -6,11 +6,11 @@ static func click_control(sender, control: Control): var rect = control.get_global_rect() var center = (rect.end - rect.size / 2) sender.mouse_left_button_down(center, center) \ - .hold_for('1f') \ - .wait('1f') + super.hold_for('1f') \ + super.wait('1f') return sender static func press_key(sender, key): sender.key_down(key) \ - .hold_for('1f') + super.hold_for('1f') return sender |
