You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think you could put these informations in the [DOCS](https://gut.readthedocs.io/en/latest/Mocking-Input.html).
It would help a lot beginners, I was searching these information for three days already.
Thank you you put here!
Information 1
There is some stuff in the InputSender that makes this a little cleaner, but the "waits" are necessary. You can string all your commands together and there is wait_frames and wait_secs built into the sender. There's also hold_for which can save you a "button up". You can then wait for the idle signal on the sender.
Some waits can be skipped in different scenarios (such as no wait between your button down/up). But if you want something like just_pressed you have to use waits (I'm pretty sure).
Here's another way to write that test without using any direct calls to wait_frames.
functest_open_settings_menu() ->void:
varsettings_button_pos=button_settings.get_global_position()
_sender.mouse_set_position(settings_button_pos, settings_button_pos)\
.wait_frames(1)\
.mouse_left_button_down(settings_button_pos, settings_button_pos)\
.hold_for('1f')\ # holds the button down for one frame, for illustration purposes, no button up needed
.wait_frames(1)
await_sender.idleassert_eq(main_menu.visible,false)
assert_eq(settings_menu.visible,true)
Information 2
I absolutely love seeing people using InputSender, but if you are only checking that you are handling the button pressed correctly then the following is a better test.
If all of your buttons are standard buttons then it is overkill to test whether or not they work with the mouse (a minor case of "testing the framework"). Getting a reference to
I believe the second information is more simple to use, and draw attention that also exists button_up and button_down could help more people.
It would help a lot beginners, I was searching these information for three days already.
Thank you you put here!
Information 1
Information 2
I believe the second information is more simple to use, and draw attention that also exists button_up and button_down could help more people.
Originally posted by @hugarty in #511 (comment)
The text was updated successfully, but these errors were encountered: