Menu

How to simulate keyboard and mouse input in GUT and GdUnit4 (tested on Godot 4.7.2)
📰

How to simulate keyboard and mouse input in GUT and GdUnit4 (tested on Godot 4.7.2)

DEV Community: tutorial·Ziva·10 days ago
#XB1nobd8
#devtotutorial#devto#dev#gdunit4#input
Reading 0:00
15s threshold

In GUT, queue input on a GutInputSender aimed at Input and await its idle signal before you assert; in GdUnit4, call the scene runner's simulate_key_* , simulate_action_* and simulate_mouse_button_* methods, wait, and await runner.await_input_processed() .

Ziva.sh publishes this page and makes Ziva. We ran every test and command on this page on 7 November 2026 with Godot 4.7.2 on Linux, GUT 9.7.1 and GdUnit4 6.2.3, the latest releases that day, on the public Star Catcher sample , a 2D game where the arrow keys move a square into stars. Method names come from the installed addons' source code.

GUT

GUT's GutInputSender sends input events to receivers. With Input as the receiver, GUT 9.7.1 passes each event to Input.parse_input_event , so the game sees it like hardware input. Chained calls are queued and played back in real time, and await _sender.idle waits until the queue is empty.

# res://test/test_input.gd extends GutTest

var _sender : = GutInputSender .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.