AutoworkSignalWatcher๏ƒ

Experimental: Some methods may not be implemented and may be changed in future versions.

Inherits: RefCounted < Object

Tracks and records signal emissions during tests.

Description๏ƒ

The AutoworkSignalWatcher is used to observe signals emitted by objects during test execution.

It allows registering specific signals (or all signals from an object) and keeps a record of their emissions, including how many times they were triggered and with what arguments.

This makes it possible to assert that signals were emitted as expected.

Methods๏ƒ

void

clear()

bool

did_emit(object: Object, signal: StringName)

Array

get_emissions(object: Object, signal: StringName)

void

watch_signal(object: Object, signal: StringName)

void

watch_signals(object: Object)


Method Descriptions๏ƒ

void clear() ๐Ÿ”—

Clears all recorded signal emissions and watched signals.

After calling this method, the watcher returns to an empty state.


bool did_emit(object: Object, signal: StringName) ๐Ÿ”—

Returns true if the specified signal was emitted by object.

This checks whether at least one emission has been recorded since the last clear() call.


Array get_emissions(object: Object, signal: StringName) ๐Ÿ”—

Returns an Array of recorded emissions for the given object and signal.

Each entry typically contains the arguments passed when the signal was emitted.

The exact structure may depend on the implementation.


void watch_signal(object: Object, signal: StringName) ๐Ÿ”—

Starts watching a specific signal on the given object.

All future emissions of the specified signal will be recorded until clear() is called or the watcher is reset.


void watch_signals(object: Object) ๐Ÿ”—

Starts watching all signals emitted by the given object.

This is useful when the exact signal names are not known in advance or when multiple signals need to be tracked simultaneously.