-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SceneTree and signal testing - Code edit unit tests #50375
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Paulb23
force-pushed
the
code_edit_unit_tests
branch
from
August 6, 2021 18:58
1983661
to
6b9d943
Compare
Paulb23
force-pushed
the
code_edit_unit_tests
branch
3 times, most recently
from
August 15, 2021 13:30
3d30c77
to
2b6fd03
Compare
Paulb23
force-pushed
the
code_edit_unit_tests
branch
from
August 25, 2021 17:49
2b6fd03
to
c55436c
Compare
Reabsed following #51983 which removed the ability to call |
Paulb23
force-pushed
the
code_edit_unit_tests
branch
from
September 1, 2021 16:31
c55436c
to
ce06434
Compare
Fixed a crash after #51296 which assumed there would be an |
This was referenced Sep 2, 2021
akien-mga
approved these changes
Sep 13, 2021
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Builds on and used to test #50372
Related godotengine/godot-proposals/issues/1307
Support SceneTree and signal testing, opening up for feedback.
Test code changes can be added separately to #50372 but I figured it made sense to have an example with it, so included it here.
Added a doctest reporter
GodotTestCaseListener
. When doctest runs thetest_case_start
callback (not subcase) it will check if the case name contains,[SceneTree]
; if found will create all the required engine parts.It will then cleanup that code on the
test_case_end
callback.A key part of #50372 is user input and signals.
To handle this a macro
SEND_GUI_ACTION(object, action_name)
has been added, this will call the_gui_input
method on the object with a given action, i.eSEND_GUI_ACTION(code_edit, "ui_text_newline")
. This requires aMessageQueue
andInputMap
.For signals a test singleton
SignalWatcher
as been added, when a signal is connected, the SignalWatcher between checks, will capture every time it is emitted with it's args.The following macros can be use to check signals:
SIGNAL_WATCH(*object, "signal_name")
to start watching.SIGNAL_UNWATCH(*object, "signal_name")
to stop watching.SIGNAL_CHECK("signal_name"), Vector<Vector<Variant>>)
, to check the arguments of all fired signals.SIGNAL_CHECK_FALSE("signal_name")
to check if a signal was not fired.SIGNAL_DISCARD("signal_name")
to discard records all of the given signalFinally, two minor bugfixs where the input map and display server where not nulling it's singleton var, causing it to print a warning every time it was re-setup. In addition
rasterizer_dummy.h
was returningtrue
when it has not freed the memory causing a minor memory leak.