forked from derkork/godot-test-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: set global input state, synchronize methods #1
Closed
wlsnmrk
wants to merge
22
commits into
chickensoft-games:refactor/cleanup
from
wlsnmrk:synchronicity
Closed
feat: set global input state, synchronize methods #1
wlsnmrk
wants to merge
22
commits into
chickensoft-games:refactor/cleanup
from
wlsnmrk:synchronicity
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
Added new test input action, test scene and script with (currently failing) tests for changes to simulation of global input state in Godot 4.2, in which Input::ParseInputEvent() no longer sets Input::IsActionPressed().
Updated action-input simulation extension methods to simulate global input state in addition to events. Fixes behavior of StartAction() and EndAction() to correctly set Input::IsActionPressed() in Godot 4.2.
Added new (currently failing) tests for Input::IsActionJustPressed/Released(), which should be true immediately after starting or ending an action, respectively.
To enable testing global input state immediately following inputs, made action-input extensions synchronous, excepting HoldActionFor(). Tests for Input::IsActionJustPressed/Released() now pass. BREAKING CHANGE: where possible, action-input methods are no longer async, are void instead of returning Task, and have no frame delay.
BREAKING CHANGE: where possible, keyboard-input methods are no longer async, are void instead of returning Task, and have no frame delay.
To make tests relying on mouse input more frame-accurate, made mouse- input extensions synchronous. Set Relative property on simulated mouse-motion events, since relative motion will no longer accumulate in input buffer with immediate event flushing. Propagated synchronicity to dependent driver methods and tests. BREAKING CHANGE: mouse-input methods and many driver methods are no longer async, are void instead of returning Task, and have no frame delay.
To make tests relying on Control behavior more frame-accurate, made control driver's GrabFocus() and ReleaseFocus() methods synchronous. BREAKING CHANGE: Control driver's Grab/ReleaseFocus() methods are no longer async, are void instead of returning Task, and have no frame delay.
Make BaseButtonDriver::Press() synchronous and update dependent tests. BREAKING CHANGE: BaseButtonDriver::Press() is no longer async, is void instead of returning Task, and has no frame delay.
Verified the return value of the Camera2DDriver::MoveIntoView() method to ensure the camera stabilizes in its new position. Fixed comment to reflect truth/falsity of sprite visibility.
BREAKING CHANGE: ItemList driver methods are no longer async, are void instead of returning Task, and have no frame delay.
BREAKING CHANGE: LineEdit driver methods are no longer async, are void instead of returning Task, and have no frame delay.
BREAKING CHANGE: OptionButtuon driver methods are no longer async, are void instead of returning Task, and have no frame delay.
BREAKING CHANGE: PopupMenu driver methods are no longer async, are void instead of returning Task, and have no frame delay.
BREAKING CHANGE: TextEdit driver methods are no longer async, are void instead of returning Task, and have no frame delay.
BREAKING CHANGE: Window driver methods are no longer async, are void instead of returning Task, and have no frame delay.
Updated description of WindowDriver::Close() to reflect that it doesn't operate by clicking.
Also updated docs to reflect that Godot requires a frame after a tab is selected before updating visibility of tab contents. Also updated TabContainerDriver test to wait a frame after selecting a tab, before checking content visibility, since the driver method no longer has a frame delay. BREAKING CHANGE: TabContainer driver methods are no longer async, are void instead of returning Task, and have no frame delay.
* Changed code examples in README that no longer require async/await * Updated description of input simulation to reflect synchrony * Changed FAQ on asynchrony to describe it as a requirement only in some cases * Pointed users toward the waiting extension examples from multiple other parts of README in case they need to pump frames in tests * Removed guidance to limit state modification to the engine's process notifications * Removed guidance to include frame delays in driver code, in favor of precise frame pumping in tests as needed
BREAKING CHANGE: Fixture::LoadScene() methods are no longer async, return T instead of Task<T>, and have no frame delay.
Changed Fixture::AddToRoot() to wait 1 frame intead of 2 for a new node's _Ready() to be called.
To provide a synchronous option to users, added a method to the Camera2D driver to start moving a target position into view without waiting for the camera's motion to finish.
Closing in favor of chickensoft-games/GodotTestDriver#1 |
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.
To enable users to test that operations happen at the time they're requested, rather than at an indeterminate point in the next couple frames, this PR removes
async
/await
from as many driver functions as practicable. This is especially useful for operations that require same-frame checks, such asInput::IsActionJustPressed/Released()
. This change also speeds up many tests, since there is less waiting on the engine to process frames. Users can continue to support multi-frame tests by using the waiting extension methods themselves.Additionally, this PR adds support/workaround for the separation of input action events and input action state in Godot 4.2, so that
StartAction()
andEndAction()
extension methods continue to set global input state (e.g.,Input::IsActionPressed()
).Exceptions to synchronization
ActionsControlExtensions::HoldActionFor()
- requires anawait
to hold the actionKeyboardControlExtensions::HoldKeyFor()
- requires anawait
to hold the key pressCamera2DDriver::MoveIntoView()
andCamera2DDriver::WaitUntilSteady()
- becauseCamera2D
incorporates its own motion-easing model, it's not straightforward to eliminate asynchrony in waiting for its motion to finish. I've added a method that starts moving the camera and returns immediately, but users who want to have the camera at its new position afterwards will need to useWaitUntilSteady()
themselves.Fixture::AddToRoot()
and dependent methods - requires waiting a frame for a newNode
's_Ready()
method to be calledFixture
cleanup actions - may require asynchronous operations (e.g., deleting a file)Other notes
I've made
TabContainerDriver
methods for selecting a tab synchronous, even though Godot takes an extra frame to update content visibility. In lieu of waiting for contents to become visible, I've added a note to the documentation for tab-selection methods about this, and updated the content-visibility test to manually wait a frame after selecting a tab and before checking visibility.BREAKING CHANGES
Most driver methods are no longer
async
, arevoid
instead of returningTask
(or returnT
instead ofTask<T>
), and do not have a frame delay.