Skip to content
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

Timing Issues using Input with InputSender #642

Open
bitwes opened this issue Jul 19, 2024 · 0 comments
Open

Timing Issues using Input with InputSender #642

bitwes opened this issue Jul 19, 2024 · 0 comments

Comments

@bitwes
Copy link
Owner

bitwes commented Jul 19, 2024

Versions

  • Godot: 4.x
  • GUT: 9.x

Known Timing Issues:

  • Some amount of awaiting must occur before the first input test is run to ensure that tests pass. This can cause inconsistent results when running a single test, single script, or full run. In local testing waiting 10 frames before the first test is run gave consistent results. This delay appears to only be needed once per run, but that has not been confirmed.
func before_all():
	await wait_frames(10)
  • If you do not await after calling release_all in after_each, then the events do not have time to propagate.
func after_each():
	_sender.release_all()
	_sender.clear()
	# Wait for key release to be processed. Otherwise the key release is
	# leaked to the next test and it detects an extra key release.
	await wait_frames(1)

Approach(es?)

GutInputTest Subclass

Creating a GutInputTest that extends GutTest could perform these awaits automatically and could provide additional features that are helpful when writing input tests.

  • This class could provide specific InputSenders automatically. An InputSender using Input might be the only one.
  • It could automatically call clear and release_all at the appropriate times for instances of InputSender.
  • There wouldn't be reason you couldn't just use this new class for all your tests, but they will be a tiny bit slower, so this should warn if no input tests were created. How would it tell? There's probably a way. No warning should appear when running a single test.
  • Using InputSender in GutTest would be deprecated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant