diff options
36 files changed, 615 insertions, 573 deletions
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index 490637374d..bf8567751e 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GraphEdit" inherits="Control" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> +<class name="GraphEdit" inherits="Control" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> GraphEdit is a control responsible for displaying and manipulating graph-like data using [GraphNode]s. It provides access to creation, removal, connection, and disconnection of nodes. </brief_description> <description> + [b]Note:[/b] Please be aware that this node will undergo extensive refactoring in a future 4.x version involving compatibility-breaking API changes. GraphEdit provides tools for creation, manipulation, and display of various graphs. Its main purpose in the engine is to power the visual programming systems, such as visual shaders, but it is also available for use in user projects. GraphEdit by itself is only an empty container, representing an infinite grid where [GraphNode]s can be placed. Each [GraphNode] represent a node in the graph, a single unit of data in the connected scheme. GraphEdit, in turn, helps to control various interactions with nodes and between nodes. When the user attempts to connect, disconnect, or close a [GraphNode], a signal is emitted in the GraphEdit, but no action is taken by default. It is the responsibility of the programmer utilizing this control to implement the necessary logic to determine how each request should be handled. [b]Performance:[/b] It is greatly advised to enable low-processor usage mode (see [member OS.low_processor_usage_mode]) when using GraphEdits. diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml index 3f0080ac15..8c0e8dc3c3 100644 --- a/doc/classes/GraphNode.xml +++ b/doc/classes/GraphNode.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GraphNode" inherits="Container" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> +<class name="GraphNode" inherits="Container" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> GraphNode is a [Container] control that represents a single data unit in a [GraphEdit] graph. You can customize the number, type, and color of left- and right-side connection ports. </brief_description> <description> + [b]Note:[/b] Please be aware that this node will undergo extensive refactoring in a future 4.x version involving compatibility-breaking API changes. GraphNode allows to create nodes for a [GraphEdit] graph with customizable content based on its child [Control]s. GraphNode is a [Container] and is responsible for placing its children on screen. This works similar to [VBoxContainer]. Children, in turn, provide GraphNode with so-called slots, each of which can have a connection port on either side. This is similar to how [TabContainer] uses children to create the tabs. Each GraphNode slot is defined by its index and can provide the node with up to two ports: one on the left, and one on the right. By convention the left port is also referred to as the input port and the right port is referred to as the output port. Each port can be enabled and configured individually, using different type and color. The type is an arbitrary value that you can define using your own considerations. The parent [GraphEdit] will receive this information on each connect and disconnect request. Slots can be configured in the Inspector dock once you add at least one child [Control]. The properties are grouped by each slot's index in the "Slot" section. diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index 09e4f48204..20cd8dd26c 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -43,17 +43,17 @@ extern int initialize_pulse(int verbose); } #endif -Error AudioDriverALSA::init_device() { +Error AudioDriverALSA::init_output_device() { mix_rate = GLOBAL_GET("audio/driver/mix_rate"); speaker_mode = SPEAKER_MODE_STEREO; channels = 2; - // If there is a specified device check that it is really present - if (device_name != "Default") { - PackedStringArray list = get_device_list(); - if (list.find(device_name) == -1) { - device_name = "Default"; - new_device = "Default"; + // If there is a specified output device check that it is really present + if (output_device_name != "Default") { + PackedStringArray list = get_output_device_list(); + if (list.find(output_device_name) == -1) { + output_device_name = "Default"; + new_output_device = "Default"; } } @@ -75,10 +75,10 @@ Error AudioDriverALSA::init_device() { //6 chans - "plug:surround51" //4 chans - "plug:surround40"; - if (device_name == "Default") { + if (output_device_name == "Default") { status = snd_pcm_open(&pcm_handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); } else { - String device = device_name; + String device = output_device_name; int pos = device.find(";"); if (pos != -1) { device = device.substr(0, pos); @@ -171,7 +171,7 @@ Error AudioDriverALSA::init() { active.clear(); exit_thread.clear(); - Error err = init_device(); + Error err = init_output_device(); if (err == OK) { thread.start(AudioDriverALSA::thread_func, this); } @@ -227,18 +227,18 @@ void AudioDriverALSA::thread_func(void *p_udata) { } } - // User selected a new device, finish the current one so we'll init the new device - if (ad->device_name != ad->new_device) { - ad->device_name = ad->new_device; - ad->finish_device(); + // User selected a new output device, finish the current one so we'll init the new device. + if (ad->output_device_name != ad->new_output_device) { + ad->output_device_name = ad->new_output_device; + ad->finish_output_device(); - Error err = ad->init_device(); + Error err = ad->init_output_device(); if (err != OK) { - ERR_PRINT("ALSA: init_device error"); - ad->device_name = "Default"; - ad->new_device = "Default"; + ERR_PRINT("ALSA: init_output_device error"); + ad->output_device_name = "Default"; + ad->new_output_device = "Default"; - err = ad->init_device(); + err = ad->init_output_device(); if (err != OK) { ad->active.clear(); ad->exit_thread.set(); @@ -263,7 +263,7 @@ AudioDriver::SpeakerMode AudioDriverALSA::get_speaker_mode() const { return speaker_mode; } -PackedStringArray AudioDriverALSA::get_device_list() { +PackedStringArray AudioDriverALSA::get_output_device_list() { PackedStringArray list; list.push_back("Default"); @@ -298,13 +298,13 @@ PackedStringArray AudioDriverALSA::get_device_list() { return list; } -String AudioDriverALSA::get_device() { - return device_name; +String AudioDriverALSA::get_output_device() { + return output_device_name; } -void AudioDriverALSA::set_device(String device) { +void AudioDriverALSA::set_output_device(const String &p_name) { lock(); - new_device = device; + new_output_device = p_name; unlock(); } @@ -316,7 +316,7 @@ void AudioDriverALSA::unlock() { mutex.unlock(); } -void AudioDriverALSA::finish_device() { +void AudioDriverALSA::finish_output_device() { if (pcm_handle) { snd_pcm_close(pcm_handle); pcm_handle = nullptr; @@ -327,7 +327,7 @@ void AudioDriverALSA::finish() { exit_thread.set(); thread.wait_to_finish(); - finish_device(); + finish_output_device(); } #endif // ALSA_ENABLED diff --git a/drivers/alsa/audio_driver_alsa.h b/drivers/alsa/audio_driver_alsa.h index 6e9cf4dba9..821ba1d145 100644 --- a/drivers/alsa/audio_driver_alsa.h +++ b/drivers/alsa/audio_driver_alsa.h @@ -46,14 +46,14 @@ class AudioDriverALSA : public AudioDriver { snd_pcm_t *pcm_handle = nullptr; - String device_name = "Default"; - String new_device = "Default"; + String output_device_name = "Default"; + String new_output_device = "Default"; Vector<int32_t> samples_in; Vector<int16_t> samples_out; - Error init_device(); - void finish_device(); + Error init_output_device(); + void finish_output_device(); static void thread_func(void *p_udata); @@ -69,20 +69,22 @@ class AudioDriverALSA : public AudioDriver { SafeFlag exit_thread; public: - const char *get_name() const { + virtual const char *get_name() const override { return "ALSA"; - }; - - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual PackedStringArray get_device_list(); - virtual String get_device(); - virtual void set_device(String device); - virtual void lock(); - virtual void unlock(); - virtual void finish(); + } + + virtual Error init() override; + virtual void start() override; + virtual int get_mix_rate() const override; + virtual SpeakerMode get_speaker_mode() const override; + + virtual void lock() override; + virtual void unlock() override; + virtual void finish() override; + + virtual PackedStringArray get_output_device_list() override; + virtual String get_output_device() override; + virtual void set_output_device(const String &p_name) override; AudioDriverALSA() {} ~AudioDriverALSA() {} diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index c454da8e23..2c959bb07b 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -158,7 +158,7 @@ Error AudioDriverCoreAudio::init() { ERR_FAIL_COND_V(result != noErr, FAILED); if (GLOBAL_GET("audio/driver/enable_input")) { - return capture_init(); + return init_input_device(); } return OK; } @@ -287,7 +287,7 @@ bool AudioDriverCoreAudio::try_lock() { } void AudioDriverCoreAudio::finish() { - capture_finish(); + finish_input_device(); if (audio_unit) { OSStatus result; @@ -337,7 +337,7 @@ void AudioDriverCoreAudio::finish() { } } -Error AudioDriverCoreAudio::capture_init() { +Error AudioDriverCoreAudio::init_input_device() { AudioComponentDescription desc; memset(&desc, 0, sizeof(desc)); desc.componentType = kAudioUnitType_Output; @@ -433,7 +433,7 @@ Error AudioDriverCoreAudio::capture_init() { return OK; } -void AudioDriverCoreAudio::capture_finish() { +void AudioDriverCoreAudio::finish_input_device() { if (input_unit) { lock(); @@ -471,7 +471,7 @@ void AudioDriverCoreAudio::capture_finish() { } } -Error AudioDriverCoreAudio::capture_start() { +Error AudioDriverCoreAudio::input_start() { input_buffer_init(buffer_frames); OSStatus result = AudioOutputUnitStart(input_unit); @@ -482,7 +482,7 @@ Error AudioDriverCoreAudio::capture_start() { return OK; } -Error AudioDriverCoreAudio::capture_stop() { +Error AudioDriverCoreAudio::input_stop() { if (input_unit) { OSStatus result = AudioOutputUnitStop(input_unit); if (result != noErr) { @@ -647,20 +647,13 @@ String AudioDriverCoreAudio::get_output_device() { return output_device_name; } -void AudioDriverCoreAudio::set_output_device(String output_device) { - output_device_name = output_device; +void AudioDriverCoreAudio::set_output_device(const String &p_name) { + output_device_name = p_name; if (active) { _set_device(output_device_name); } } -void AudioDriverCoreAudio::set_input_device(const String &p_name) { - input_device_name = p_name; - if (active) { - _set_device(input_device_name, true); - } -} - PackedStringArray AudioDriverCoreAudio::get_input_device_list() { return _get_device_list(true); } @@ -669,6 +662,13 @@ String AudioDriverCoreAudio::get_input_device() { return input_device_name; } +void AudioDriverCoreAudio::set_input_device(const String &p_name) { + input_device_name = p_name; + if (active) { + _set_device(input_device_name, true); + } +} + #endif AudioDriverCoreAudio::AudioDriverCoreAudio() { diff --git a/drivers/coreaudio/audio_driver_coreaudio.h b/drivers/coreaudio/audio_driver_coreaudio.h index 2b192e630e..67ff3f3efc 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.h +++ b/drivers/coreaudio/audio_driver_coreaudio.h @@ -83,39 +83,39 @@ class AudioDriverCoreAudio : public AudioDriver { UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); - Error capture_init(); - void capture_finish(); + Error init_input_device(); + void finish_input_device(); public: - const char *get_name() const { + virtual const char *get_name() const override { return "CoreAudio"; }; - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; + virtual Error init() override; + virtual void start() override; + virtual int get_mix_rate() const override; + virtual SpeakerMode get_speaker_mode() const override; - virtual void lock(); - virtual void unlock(); - virtual void finish(); - - virtual Error capture_start(); - virtual Error capture_stop(); - - bool try_lock(); - void stop(); + virtual void lock() override; + virtual void unlock() override; + virtual void finish() override; #ifdef MACOS_ENABLED - virtual PackedStringArray get_output_device_list(); - virtual String get_output_device(); - virtual void set_output_device(String output_device); + virtual PackedStringArray get_output_device_list() override; + virtual String get_output_device() override; + virtual void set_output_device(const String &p_name) override; - virtual PackedStringArray get_input_device_list(); - virtual void set_input_device(const String &p_name); - virtual String get_input_device(); + virtual PackedStringArray get_input_device_list() override; + virtual String get_input_device() override; + virtual void set_input_device(const String &p_name) override; #endif + virtual Error input_start() override; + virtual Error input_stop() override; + + bool try_lock(); + void stop(); + AudioDriverCoreAudio(); ~AudioDriverCoreAudio() {} }; diff --git a/drivers/gles3/shaders/stdlib_inc.glsl b/drivers/gles3/shaders/stdlib_inc.glsl index 8d4a24cc1f..0b76c4334a 100644 --- a/drivers/gles3/shaders/stdlib_inc.glsl +++ b/drivers/gles3/shaders/stdlib_inc.glsl @@ -2,13 +2,23 @@ #ifdef USE_GLES_OVER_GL // Floating point pack/unpack functions are part of the GLSL ES 300 specification used by web and mobile. uint float2half(uint f) { - return ((f >> uint(16)) & uint(0x8000)) | - ((((f & uint(0x7f800000)) - uint(0x38000000)) >> uint(13)) & uint(0x7c00)) | - ((f >> uint(13)) & uint(0x03ff)); + uint e = f & uint(0x7f800000); + if (e <= uint(0x38000000)) { + return uint(0); + } else { + return ((f >> uint(16)) & uint(0x8000)) | + (((e - uint(0x38000000)) >> uint(13)) & uint(0x7c00)) | + ((f >> uint(13)) & uint(0x03ff)); + } } uint half2float(uint h) { - return ((h & uint(0x8000)) << uint(16)) | (((h & uint(0x7c00)) + uint(0x1c000)) << uint(13)) | ((h & uint(0x03ff)) << uint(13)); + uint h_e = h & uint(0x7c00); + if (h_e == uint(0x0000)) { + return uint(0); + } else { + return ((h & uint(0x8000)) << uint(16)) | ((h_e + uint(0x1c000)) << uint(13)) | ((h & uint(0x03ff)) << uint(13)); + } } uint packHalf2x16(vec2 v) { diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index f96247a473..0246af4fea 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -631,9 +631,9 @@ String AudioDriverPulseAudio::get_output_device() { return output_device_name; } -void AudioDriverPulseAudio::set_output_device(String output_device) { +void AudioDriverPulseAudio::set_output_device(const String &p_name) { lock(); - new_output_device = output_device; + new_output_device = p_name; unlock(); } @@ -761,12 +761,6 @@ Error AudioDriverPulseAudio::input_stop() { return OK; } -void AudioDriverPulseAudio::set_input_device(const String &p_name) { - lock(); - new_input_device = p_name; - unlock(); -} - void AudioDriverPulseAudio::pa_sourcelist_cb(pa_context *c, const pa_source_info *l, int eol, void *userdata) { AudioDriverPulseAudio *ad = static_cast<AudioDriverPulseAudio *>(userdata); @@ -821,6 +815,12 @@ String AudioDriverPulseAudio::get_input_device() { return name; } +void AudioDriverPulseAudio::set_input_device(const String &p_name) { + lock(); + new_input_device = p_name; + unlock(); +} + AudioDriverPulseAudio::AudioDriverPulseAudio() { samples_in.clear(); samples_out.clear(); diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h index 68df03cb60..f4ff44d361 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.h +++ b/drivers/pulseaudio/audio_driver_pulseaudio.h @@ -94,31 +94,30 @@ class AudioDriverPulseAudio : public AudioDriver { static void thread_func(void *p_udata); public: - const char *get_name() const { + virtual const char *get_name() const override { return "PulseAudio"; }; - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; + virtual Error init() override; + virtual void start() override; + virtual int get_mix_rate() const override; + virtual SpeakerMode get_speaker_mode() const override; + virtual float get_latency() override; - virtual PackedStringArray get_output_device_list(); - virtual String get_output_device(); - virtual void set_output_device(String output_device); + virtual void lock() override; + virtual void unlock() override; + virtual void finish() override; - virtual PackedStringArray get_input_device_list(); - virtual void set_input_device(const String &p_name); - virtual String get_input_device(); + virtual PackedStringArray get_output_device_list() override; + virtual String get_output_device() override; + virtual void set_output_device(const String &p_name) override; - virtual void lock(); - virtual void unlock(); - virtual void finish(); + virtual Error input_start() override; + virtual Error input_stop() override; - virtual float get_latency(); - - virtual Error input_start(); - virtual Error input_stop(); + virtual PackedStringArray get_input_device_list() override; + virtual String get_input_device() override; + virtual void set_input_device(const String &p_name) override; AudioDriverPulseAudio(); ~AudioDriverPulseAudio() {} diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index 42a2b85200..72ec0c19ab 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -634,9 +634,9 @@ String AudioDriverWASAPI::get_output_device() { return name; } -void AudioDriverWASAPI::set_output_device(String output_device) { +void AudioDriverWASAPI::set_output_device(const String &p_name) { lock(); - audio_output.new_device = output_device; + audio_output.new_device = p_name; unlock(); } @@ -964,12 +964,6 @@ Error AudioDriverWASAPI::input_stop() { return FAILED; } -void AudioDriverWASAPI::set_input_device(const String &p_name) { - lock(); - audio_input.new_device = p_name; - unlock(); -} - PackedStringArray AudioDriverWASAPI::get_input_device_list() { return audio_device_get_list(true); } @@ -982,6 +976,12 @@ String AudioDriverWASAPI::get_input_device() { return name; } +void AudioDriverWASAPI::set_input_device(const String &p_name) { + lock(); + audio_input.new_device = p_name; + unlock(); +} + AudioDriverWASAPI::AudioDriverWASAPI() { samples_in.clear(); } diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h index bf18ba8c99..367c30607a 100644 --- a/drivers/wasapi/audio_driver_wasapi.h +++ b/drivers/wasapi/audio_driver_wasapi.h @@ -94,27 +94,30 @@ class AudioDriverWASAPI : public AudioDriver { PackedStringArray audio_device_get_list(bool p_input); public: - virtual const char *get_name() const { + virtual const char *get_name() const override { return "WASAPI"; } - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual float get_latency(); - virtual SpeakerMode get_speaker_mode() const; - virtual PackedStringArray get_output_device_list(); - virtual String get_output_device(); - virtual void set_output_device(String output_device); - virtual void lock(); - virtual void unlock(); - virtual void finish(); - - virtual Error input_start(); - virtual Error input_stop(); - virtual PackedStringArray get_input_device_list(); - virtual void set_input_device(const String &p_name); - virtual String get_input_device(); + virtual Error init() override; + virtual void start() override; + virtual int get_mix_rate() const override; + virtual SpeakerMode get_speaker_mode() const override; + virtual float get_latency() override; + + virtual void lock() override; + virtual void unlock() override; + virtual void finish() override; + + virtual PackedStringArray get_output_device_list() override; + virtual String get_output_device() override; + virtual void set_output_device(const String &p_name) override; + + virtual Error input_start() override; + virtual Error input_stop() override; + + virtual PackedStringArray get_input_device_list() override; + virtual String get_input_device() override; + virtual void set_input_device(const String &p_name) override; AudioDriverWASAPI(); }; diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index cd1b29e17d..44ce01d4d7 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -33,10 +33,6 @@ #include "core/config/project_settings.h" #include "core/os/os.h" -const char *AudioDriverXAudio2::get_name() const { - return "XAudio2"; -} - Error AudioDriverXAudio2::init() { active.clear(); exit_thread.clear(); diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h index df5ef52e88..c659b6ffdc 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.h +++ b/drivers/xaudio2/audio_driver_xaudio2.h @@ -91,16 +91,19 @@ class AudioDriverXAudio2 : public AudioDriver { XAudio2DriverVoiceCallback voice_callback; public: - const char *get_name() const; - - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual float get_latency(); - virtual void lock(); - virtual void unlock(); - virtual void finish(); + virtual const char *get_name() const override { + return "XAudio2"; + } + + virtual Error init() override; + virtual void start() override; + virtual int get_mix_rate() const override; + virtual SpeakerMode get_speaker_mode() const override; + virtual float get_latency() override; + + virtual void lock() override; + virtual void unlock() override; + virtual void finish() override; AudioDriverXAudio2(); ~AudioDriverXAudio2() {} diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index b99f5d2685..6c26e226a5 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -3427,7 +3427,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a String message_str; if (_code_ptr[ip + 2] != 0) { GET_VARIANT_PTR(message, 1); - message_str = *message; + Variant message_var = *message; + if (message->get_type() != Variant::NIL) { + message_str = message_var; + } } if (message_str.is_empty()) { err_text = "Assertion failed."; diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index 9dad0c9357..5fc32132e3 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -80,10 +80,6 @@ void AudioDriverOpenSL::_buffer_callbacks( ad->_buffer_callback(queueItf); } -const char *AudioDriverOpenSL::get_name() const { - return "Android"; -} - Error AudioDriverOpenSL::init() { SLresult res; SLEngineOption EngineOption[] = { @@ -204,7 +200,7 @@ void AudioDriverOpenSL::_record_buffer_callbacks(SLAndroidSimpleBufferQueueItf q ad->_record_buffer_callback(queueItf); } -Error AudioDriverOpenSL::capture_init_device() { +Error AudioDriverOpenSL::init_input_device() { SLDataLocator_IODevice loc_dev = { SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, @@ -271,15 +267,15 @@ Error AudioDriverOpenSL::capture_init_device() { return OK; } -Error AudioDriverOpenSL::capture_start() { +Error AudioDriverOpenSL::input_start() { if (OS::get_singleton()->request_permission("RECORD_AUDIO")) { - return capture_init_device(); + return init_input_device(); } return OK; } -Error AudioDriverOpenSL::capture_stop() { +Error AudioDriverOpenSL::input_stop() { SLuint32 state; SLresult res = (*recordItf)->GetRecordState(recordItf, &state); ERR_FAIL_COND_V(res != SL_RESULT_SUCCESS, ERR_CANT_OPEN); diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h index ae8c33fec0..6ea0f77def 100644 --- a/platform/android/audio_driver_opensl.h +++ b/platform/android/audio_driver_opensl.h @@ -84,23 +84,26 @@ class AudioDriverOpenSL : public AudioDriver { SLAndroidSimpleBufferQueueItf queueItf, void *pContext); - virtual Error capture_init_device(); + Error init_input_device(); public: - virtual const char *get_name() const; + virtual const char *get_name() const override { + return "Android"; + } - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual void lock(); - virtual void unlock(); - virtual void finish(); + virtual Error init() override; + virtual void start() override; + virtual int get_mix_rate() const override; + virtual SpeakerMode get_speaker_mode() const override; - virtual void set_pause(bool p_pause); + virtual void lock() override; + virtual void unlock() override; + virtual void finish() override; - virtual Error capture_start(); - virtual Error capture_stop(); + virtual Error input_start() override; + virtual Error input_stop() override; + + void set_pause(bool p_pause); AudioDriverOpenSL(); }; diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index 1ee1cccb82..e7abe580f1 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -488,7 +488,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv * JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result) { String permission = jstring_to_string(p_permission, env); if (permission == "android.permission.RECORD_AUDIO" && p_result) { - AudioDriver::get_singleton()->capture_start(); + AudioDriver::get_singleton()->input_start(); } if (os_android->get_main_loop()) { diff --git a/platform/web/audio_driver_web.cpp b/platform/web/audio_driver_web.cpp index a5234627d1..1d7b96d707 100644 --- a/platform/web/audio_driver_web.cpp +++ b/platform/web/audio_driver_web.cpp @@ -166,18 +166,18 @@ void AudioDriverWeb::finish() { } } -Error AudioDriverWeb::capture_start() { +Error AudioDriverWeb::input_start() { lock(); input_buffer_init(buffer_length); unlock(); - if (godot_audio_capture_start()) { + if (godot_audio_input_start()) { return FAILED; } return OK; } -Error AudioDriverWeb::capture_stop() { - godot_audio_capture_stop(); +Error AudioDriverWeb::input_stop() { + godot_audio_input_stop(); lock(); input_buffer.clear(); unlock(); diff --git a/platform/web/audio_driver_web.h b/platform/web/audio_driver_web.h index f3afbdbb92..be13935bd9 100644 --- a/platform/web/audio_driver_web.h +++ b/platform/web/audio_driver_web.h @@ -77,12 +77,12 @@ public: virtual void start() final; virtual void finish() final; - virtual float get_latency() override; virtual int get_mix_rate() const override; virtual SpeakerMode get_speaker_mode() const override; + virtual float get_latency() override; - virtual Error capture_start() override; - virtual Error capture_stop() override; + virtual Error input_start() override; + virtual Error input_stop() override; static void resume(); @@ -111,10 +111,12 @@ protected: virtual void finish_driver() override; public: - virtual const char *get_name() const override { return "AudioWorklet"; } + virtual const char *get_name() const override { + return "AudioWorklet"; + } - void lock() override; - void unlock() override; + virtual void lock() override; + virtual void unlock() override; }; #endif // AUDIO_DRIVER_WEB_H diff --git a/platform/web/godot_audio.h b/platform/web/godot_audio.h index d7bff078f8..c6f92161fa 100644 --- a/platform/web/godot_audio.h +++ b/platform/web/godot_audio.h @@ -43,8 +43,8 @@ extern int godot_audio_has_script_processor(); extern int godot_audio_init(int *p_mix_rate, int p_latency, void (*_state_cb)(int), void (*_latency_cb)(float)); extern void godot_audio_resume(); -extern int godot_audio_capture_start(); -extern void godot_audio_capture_stop(); +extern int godot_audio_input_start(); +extern void godot_audio_input_stop(); // Worklet typedef int32_t GodotAudioState[4]; diff --git a/platform/web/js/libs/library_godot_audio.js b/platform/web/js/libs/library_godot_audio.js index 68348a3962..1993d66310 100644 --- a/platform/web/js/libs/library_godot_audio.js +++ b/platform/web/js/libs/library_godot_audio.js @@ -186,17 +186,17 @@ const GodotAudio = { } }, - godot_audio_capture_start__proxy: 'sync', - godot_audio_capture_start__sig: 'i', - godot_audio_capture_start: function () { + godot_audio_input_start__proxy: 'sync', + godot_audio_input_start__sig: 'i', + godot_audio_input_start: function () { return GodotAudio.create_input(function (input) { input.connect(GodotAudio.driver.get_node()); }); }, - godot_audio_capture_stop__proxy: 'sync', - godot_audio_capture_stop__sig: 'v', - godot_audio_capture_stop: function () { + godot_audio_input_stop__proxy: 'sync', + godot_audio_input_stop__sig: 'v', + godot_audio_input_stop: function () { if (GodotAudio.input) { const tracks = GodotAudio.input['mediaStream']['getTracks'](); for (let i = 0; i < tracks.length; i++) { diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index 85f6840fde..6aa7779b09 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -108,7 +108,6 @@ void NavigationAgent2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_horizon", PROPERTY_HINT_RANGE, "0.1,10,0.01,suffix:s"), "set_time_horizon", "get_time_horizon"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "max_speed", PROPERTY_HINT_RANGE, "0.1,10000,0.01,suffix:px/s"), "set_max_speed", "get_max_speed"); -#ifdef DEBUG_ENABLED ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationAgent2D::set_debug_enabled); ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationAgent2D::get_debug_enabled); ClassDB::bind_method(D_METHOD("set_debug_use_custom", "enabled"), &NavigationAgent2D::set_debug_use_custom); @@ -126,7 +125,6 @@ void NavigationAgent2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_line_width", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_line_width", "get_debug_path_custom_line_width"); -#endif // DEBUG_ENABLED ADD_SIGNAL(MethodInfo("path_changed")); ADD_SIGNAL(MethodInfo("target_reached")); @@ -436,9 +434,8 @@ real_t NavigationAgent2D::get_path_max_distance() { } void NavigationAgent2D::set_target_position(Vector2 p_position) { - if (target_position.is_equal_approx(p_position)) { - return; - } + // Intentionally not checking for equality of the parameter, as we want to update the path even if the target position is the same in case the world changed. + // Revisit later when the navigation server can update the path without requesting a new path. target_position = p_position; target_position_submitted = true; @@ -491,9 +488,9 @@ Vector2 NavigationAgent2D::get_final_position() { } void NavigationAgent2D::set_velocity(Vector2 p_velocity) { - if (target_velocity.is_equal_approx(p_velocity)) { - return; - } + // Intentionally not checking for equality of the parameter. + // We need to always submit the velocity to the navigation server, even when it is the same, in order to run avoidance every frame. + // Revisit later when the navigation server can update avoidance without users resubmitting the velocity. target_velocity = p_velocity; velocity_submitted = true; @@ -670,14 +667,15 @@ void NavigationAgent2D::_check_distance_to_target() { ////////DEBUG//////////////////////////////////////////////////////////// -#ifdef DEBUG_ENABLED void NavigationAgent2D::set_debug_enabled(bool p_enabled) { +#ifdef DEBUG_ENABLED if (debug_enabled == p_enabled) { return; } debug_enabled = p_enabled; debug_path_dirty = true; +#endif // DEBUG_ENABLED } bool NavigationAgent2D::get_debug_enabled() const { @@ -685,12 +683,14 @@ bool NavigationAgent2D::get_debug_enabled() const { } void NavigationAgent2D::set_debug_use_custom(bool p_enabled) { +#ifdef DEBUG_ENABLED if (debug_use_custom == p_enabled) { return; } debug_use_custom = p_enabled; debug_path_dirty = true; +#endif // DEBUG_ENABLED } bool NavigationAgent2D::get_debug_use_custom() const { @@ -698,12 +698,14 @@ bool NavigationAgent2D::get_debug_use_custom() const { } void NavigationAgent2D::set_debug_path_custom_color(Color p_color) { +#ifdef DEBUG_ENABLED if (debug_path_custom_color == p_color) { return; } debug_path_custom_color = p_color; debug_path_dirty = true; +#endif // DEBUG_ENABLED } Color NavigationAgent2D::get_debug_path_custom_color() const { @@ -711,12 +713,14 @@ Color NavigationAgent2D::get_debug_path_custom_color() const { } void NavigationAgent2D::set_debug_path_custom_point_size(float p_point_size) { +#ifdef DEBUG_ENABLED if (Math::is_equal_approx(debug_path_custom_point_size, p_point_size)) { return; } debug_path_custom_point_size = MAX(0.1, p_point_size); debug_path_dirty = true; +#endif // DEBUG_ENABLED } float NavigationAgent2D::get_debug_path_custom_point_size() const { @@ -724,18 +728,21 @@ float NavigationAgent2D::get_debug_path_custom_point_size() const { } void NavigationAgent2D::set_debug_path_custom_line_width(float p_line_width) { +#ifdef DEBUG_ENABLED if (Math::is_equal_approx(debug_path_custom_line_width, p_line_width)) { return; } debug_path_custom_line_width = p_line_width; debug_path_dirty = true; +#endif // DEBUG_ENABLED } float NavigationAgent2D::get_debug_path_custom_line_width() const { return debug_path_custom_line_width; } +#ifdef DEBUG_ENABLED void NavigationAgent2D::_navigation_debug_changed() { debug_path_dirty = true; } diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h index 5278c81f66..1614c70229 100644 --- a/scene/2d/navigation_agent_2d.h +++ b/scene/2d/navigation_agent_2d.h @@ -73,14 +73,16 @@ class NavigationAgent2D : public Node { // No initialized on purpose uint32_t update_frame_id = 0; -#ifdef DEBUG_ENABLED + // Debug properties for exposed bindings bool debug_enabled = false; - bool debug_path_dirty = true; - RID debug_path_instance; float debug_path_custom_point_size = 4.0; float debug_path_custom_line_width = 1.0; bool debug_use_custom = false; Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0); +#ifdef DEBUG_ENABLED + // Debug properties internal only + bool debug_path_dirty = true; + RID debug_path_instance; private: void _navigation_debug_changed(); @@ -182,7 +184,6 @@ public: PackedStringArray get_configuration_warnings() const override; -#ifdef DEBUG_ENABLED void set_debug_enabled(bool p_enabled); bool get_debug_enabled() const; @@ -197,7 +198,6 @@ public: void set_debug_path_custom_line_width(float p_line_width); float get_debug_path_custom_line_width() const; -#endif // DEBUG_ENABLED private: void update_navigation(); diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index 524304425c..081e7505d0 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -121,7 +121,6 @@ void NavigationAgent3D::_bind_methods() { ADD_SIGNAL(MethodInfo("navigation_finished")); ADD_SIGNAL(MethodInfo("velocity_computed", PropertyInfo(Variant::VECTOR3, "safe_velocity"))); -#ifdef DEBUG_ENABLED ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationAgent3D::set_debug_enabled); ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationAgent3D::get_debug_enabled); ClassDB::bind_method(D_METHOD("set_debug_use_custom", "enabled"), &NavigationAgent3D::set_debug_use_custom); @@ -136,7 +135,6 @@ void NavigationAgent3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size"); -#endif // DEBUG_ENABLED } void NavigationAgent3D::_notification(int p_what) { @@ -461,9 +459,8 @@ real_t NavigationAgent3D::get_path_max_distance() { } void NavigationAgent3D::set_target_position(Vector3 p_position) { - if (target_position.is_equal_approx(p_position)) { - return; - } + // Intentionally not checking for equality of the parameter, as we want to update the path even if the target position is the same in case the world changed. + // Revisit later when the navigation server can update the path without requesting a new path. target_position = p_position; target_position_submitted = true; @@ -516,9 +513,9 @@ Vector3 NavigationAgent3D::get_final_position() { } void NavigationAgent3D::set_velocity(Vector3 p_velocity) { - if (target_velocity.is_equal_approx(p_velocity)) { - return; - } + // Intentionally not checking for equality of the parameter. + // We need to always submit the velocity to the navigation server, even when it is the same, in order to run avoidance every frame. + // Revisit later when the navigation server can update avoidance without users resubmitting the velocity. target_velocity = p_velocity; velocity_submitted = true; @@ -696,14 +693,15 @@ void NavigationAgent3D::_check_distance_to_target() { ////////DEBUG//////////////////////////////////////////////////////////// -#ifdef DEBUG_ENABLED void NavigationAgent3D::set_debug_enabled(bool p_enabled) { +#ifdef DEBUG_ENABLED if (debug_enabled == p_enabled) { return; } debug_enabled = p_enabled; debug_path_dirty = true; +#endif // DEBUG_ENABLED } bool NavigationAgent3D::get_debug_enabled() const { @@ -711,12 +709,14 @@ bool NavigationAgent3D::get_debug_enabled() const { } void NavigationAgent3D::set_debug_use_custom(bool p_enabled) { +#ifdef DEBUG_ENABLED if (debug_use_custom == p_enabled) { return; } debug_use_custom = p_enabled; debug_path_dirty = true; +#endif // DEBUG_ENABLED } bool NavigationAgent3D::get_debug_use_custom() const { @@ -724,12 +724,14 @@ bool NavigationAgent3D::get_debug_use_custom() const { } void NavigationAgent3D::set_debug_path_custom_color(Color p_color) { +#ifdef DEBUG_ENABLED if (debug_path_custom_color == p_color) { return; } debug_path_custom_color = p_color; debug_path_dirty = true; +#endif // DEBUG_ENABLED } Color NavigationAgent3D::get_debug_path_custom_color() const { @@ -737,18 +739,21 @@ Color NavigationAgent3D::get_debug_path_custom_color() const { } void NavigationAgent3D::set_debug_path_custom_point_size(float p_point_size) { +#ifdef DEBUG_ENABLED if (Math::is_equal_approx(debug_path_custom_point_size, p_point_size)) { return; } debug_path_custom_point_size = p_point_size; debug_path_dirty = true; +#endif // DEBUG_ENABLED } float NavigationAgent3D::get_debug_path_custom_point_size() const { return debug_path_custom_point_size; } +#ifdef DEBUG_ENABLED void NavigationAgent3D::_navigation_debug_changed() { debug_path_dirty = true; } diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h index 209b2a0989..072ca1d3e8 100644 --- a/scene/3d/navigation_agent_3d.h +++ b/scene/3d/navigation_agent_3d.h @@ -75,14 +75,16 @@ class NavigationAgent3D : public Node { // No initialized on purpose uint32_t update_frame_id = 0; -#ifdef DEBUG_ENABLED + // Debug properties for exposed bindings bool debug_enabled = false; - bool debug_path_dirty = true; - RID debug_path_instance; - Ref<ArrayMesh> debug_path_mesh; float debug_path_custom_point_size = 4.0; bool debug_use_custom = false; Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0); +#ifdef DEBUG_ENABLED + // Debug properties internal only + bool debug_path_dirty = true; + RID debug_path_instance; + Ref<ArrayMesh> debug_path_mesh; Ref<StandardMaterial3D> debug_agent_path_line_custom_material; Ref<StandardMaterial3D> debug_agent_path_point_custom_material; @@ -196,7 +198,6 @@ public: PackedStringArray get_configuration_warnings() const override; -#ifdef DEBUG_ENABLED void set_debug_enabled(bool p_enabled); bool get_debug_enabled() const; @@ -208,7 +209,6 @@ public: void set_debug_path_custom_point_size(float p_point_size); float get_debug_path_custom_point_size() const; -#endif // DEBUG_ENABLED private: void update_navigation(); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index fe2eed6755..a6a2fb8d7c 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -193,7 +193,7 @@ void GraphEditMinimap::_adjust_graph_scroll(const Vector2 &p_offset) { PackedStringArray GraphEdit::get_configuration_warnings() const { PackedStringArray warnings = Control::get_configuration_warnings(); - warnings.push_back(RTR("Please be aware that GraphEdit and GraphNode will undergo extensive refactoring in a future beta version involving compatibility-breaking API changes.")); + warnings.push_back(RTR("Please be aware that GraphEdit and GraphNode will undergo extensive refactoring in a future 4.x version involving compatibility-breaking API changes.")); return warnings; } diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index 0695492e7f..7550f598f8 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -3349,10 +3349,10 @@ String VisualShaderNodeUVFunc::generate_code(Shader::Mode p_mode, VisualShader:: switch (func) { case FUNC_PANNING: { - code += vformat(" %s = fma(%s, %s, %s);\n", p_output_vars[0], offset_pivot, scale, uv); + code += vformat(" %s = %s * %s + %s;\n", p_output_vars[0], offset_pivot, scale, uv); } break; case FUNC_SCALING: { - code += vformat(" %s = fma((%s - %s), %s, %s);\n", p_output_vars[0], uv, offset_pivot, scale, offset_pivot); + code += vformat(" %s = (%s - %s) * %s + %s;\n", p_output_vars[0], uv, offset_pivot, scale, offset_pivot); } break; default: break; @@ -7482,6 +7482,9 @@ String VisualShaderNodeMultiplyAdd::get_output_port_name(int p_port) const { } String VisualShaderNodeMultiplyAdd::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + return " " + p_output_vars[0] + " = (" + p_input_vars[0] + " * " + p_input_vars[1] + ") + " + p_input_vars[2] + ";\n"; + } return " " + p_output_vars[0] + " = fma(" + p_input_vars[0] + ", " + p_input_vars[1] + ", " + p_input_vars[2] + ");\n"; } diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp index ed140c2244..e6257d9260 100644 --- a/servers/audio/audio_driver_dummy.cpp +++ b/servers/audio/audio_driver_dummy.cpp @@ -52,7 +52,7 @@ Error AudioDriverDummy::init() { } return OK; -}; +} void AudioDriverDummy::thread_func(void *p_udata) { AudioDriverDummy *ad = static_cast<AudioDriverDummy *>(p_udata); @@ -68,31 +68,31 @@ void AudioDriverDummy::thread_func(void *p_udata) { ad->stop_counting_ticks(); ad->unlock(); - }; + } OS::get_singleton()->delay_usec(usdelay); - }; -}; + } +} void AudioDriverDummy::start() { active.set(); -}; +} int AudioDriverDummy::get_mix_rate() const { return mix_rate; -}; +} AudioDriver::SpeakerMode AudioDriverDummy::get_speaker_mode() const { return speaker_mode; -}; +} void AudioDriverDummy::lock() { mutex.lock(); -}; +} void AudioDriverDummy::unlock() { mutex.unlock(); -}; +} void AudioDriverDummy::set_use_threads(bool p_use_threads) { use_threads = p_use_threads; @@ -141,7 +141,7 @@ void AudioDriverDummy::finish() { if (samples_in) { memdelete_arr(samples_in); - }; + } } AudioDriverDummy::AudioDriverDummy() { diff --git a/servers/audio/audio_driver_dummy.h b/servers/audio/audio_driver_dummy.h index 8c858a2483..823bad1d2e 100644 --- a/servers/audio/audio_driver_dummy.h +++ b/servers/audio/audio_driver_dummy.h @@ -59,17 +59,18 @@ class AudioDriverDummy : public AudioDriver { static AudioDriverDummy *singleton; public: - const char *get_name() const { + virtual const char *get_name() const override { return "Dummy"; }; - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual void lock(); - virtual void unlock(); - virtual void finish(); + virtual Error init() override; + virtual void start() override; + virtual int get_mix_rate() const override; + virtual SpeakerMode get_speaker_mode() const override; + + virtual void lock() override; + virtual void unlock() override; + virtual void finish() override; void set_use_threads(bool p_use_threads); void set_speaker_mode(SpeakerMode p_mode); diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 90997ac16e..32ee650f8d 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -367,7 +367,7 @@ void AudioStreamPlaybackMicrophone::start(double p_from_pos) { input_ofs = 0; - if (AudioDriver::get_singleton()->capture_start() == OK) { + if (AudioDriver::get_singleton()->input_start() == OK) { active = true; begin_resample(); } @@ -375,7 +375,7 @@ void AudioStreamPlaybackMicrophone::start(double p_from_pos) { void AudioStreamPlaybackMicrophone::stop() { if (active) { - AudioDriver::get_singleton()->capture_stop(); + AudioDriver::get_singleton()->input_stop(); active = false; } } diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 8c877e4eed..0344bf322d 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -1640,8 +1640,8 @@ String AudioServer::get_output_device() { return AudioDriver::get_singleton()->get_output_device(); } -void AudioServer::set_output_device(String output_device) { - AudioDriver::get_singleton()->set_output_device(output_device); +void AudioServer::set_output_device(const String &p_name) { + AudioDriver::get_singleton()->set_output_device(p_name); } PackedStringArray AudioServer::get_input_device_list() { @@ -1711,9 +1711,10 @@ void AudioServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_speaker_mode"), &AudioServer::get_speaker_mode); ClassDB::bind_method(D_METHOD("get_mix_rate"), &AudioServer::get_mix_rate); + ClassDB::bind_method(D_METHOD("get_output_device_list"), &AudioServer::get_output_device_list); ClassDB::bind_method(D_METHOD("get_output_device"), &AudioServer::get_output_device); - ClassDB::bind_method(D_METHOD("set_output_device", "output_device"), &AudioServer::set_output_device); + ClassDB::bind_method(D_METHOD("set_output_device", "name"), &AudioServer::set_output_device); ClassDB::bind_method(D_METHOD("get_time_to_next_mix"), &AudioServer::get_time_to_next_mix); ClassDB::bind_method(D_METHOD("get_time_since_last_mix"), &AudioServer::get_time_since_last_mix); diff --git a/servers/audio_server.h b/servers/audio_server.h index d3d87a8400..155beb2000 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -88,26 +88,32 @@ public: static AudioDriver *get_singleton(); void set_singleton(); + // Virtual API to implement. + virtual const char *get_name() const = 0; virtual Error init() = 0; virtual void start() = 0; virtual int get_mix_rate() const = 0; virtual SpeakerMode get_speaker_mode() const = 0; - virtual PackedStringArray get_output_device_list(); - virtual String get_output_device(); - virtual void set_output_device(String output_device) {} + virtual float get_latency() { return 0; } + virtual void lock() = 0; virtual void unlock() = 0; virtual void finish() = 0; - virtual Error capture_start() { return FAILED; } - virtual Error capture_stop() { return FAILED; } - virtual void set_input_device(const String &p_name) {} - virtual String get_input_device() { return "Default"; } + virtual PackedStringArray get_output_device_list(); + virtual String get_output_device(); + virtual void set_output_device(const String &p_name) {} + + virtual Error input_start() { return FAILED; } + virtual Error input_stop() { return FAILED; } + virtual PackedStringArray get_input_device_list(); + virtual String get_input_device() { return "Default"; } + virtual void set_input_device(const String &p_name) {} - virtual float get_latency() { return 0; } + // SpeakerMode get_speaker_mode_by_total_channels(int p_channels) const; int get_total_channels_by_speaker_mode(SpeakerMode) const; @@ -421,7 +427,7 @@ public: PackedStringArray get_output_device_list(); String get_output_device(); - void set_output_device(String output_device); + void set_output_device(const String &p_name); PackedStringArray get_input_device_list(); String get_input_device(); diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 2dc1c70064..e9c13f88ca 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -2901,10 +2901,10 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { // Modern functions. // fma - { "fma", TYPE_FLOAT, { TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, false }, - { "fma", TYPE_VEC2, { TYPE_VEC2, TYPE_VEC2, TYPE_VEC2, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, false }, - { "fma", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, false }, - { "fma", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_VEC4, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, false }, + { "fma", TYPE_FLOAT, { TYPE_FLOAT, TYPE_FLOAT, TYPE_FLOAT, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, true }, + { "fma", TYPE_VEC2, { TYPE_VEC2, TYPE_VEC2, TYPE_VEC2, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, true }, + { "fma", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, true }, + { "fma", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_VEC4, TYPE_VOID }, { "a", "b", "c" }, TAG_GLOBAL, true }, // Packing/Unpacking functions. diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h index 828029dabe..c681c76846 100644 --- a/tests/scene/test_code_edit.h +++ b/tests/scene/test_code_edit.h @@ -189,7 +189,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { arg2.push_back(1); args.push_back(arg2); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line_count() == 2); CHECK_FALSE(code_edit->is_line_breakpointed(0)); CHECK(code_edit->is_line_breakpointed(1)); @@ -198,7 +198,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { /* Non-Breaking. */ ((Array)args[0])[0] = 1; ((Array)args[1])[0] = 2; - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line_count() == 3); CHECK_FALSE(code_edit->is_line_breakpointed(1)); CHECK(code_edit->is_line_breakpointed(2)); @@ -207,7 +207,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { /* Above. */ ((Array)args[0])[0] = 2; ((Array)args[1])[0] = 3; - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line_count() == 4); CHECK_FALSE(code_edit->is_line_breakpointed(2)); CHECK(code_edit->is_line_breakpointed(3)); @@ -227,7 +227,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { SIGNAL_CHECK("breakpoint_toggled", args); /* Normal. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line_count() == 2); CHECK(code_edit->is_line_breakpointed(0)); CHECK_FALSE(code_edit->is_line_breakpointed(1)); @@ -235,7 +235,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { /* Non-Breaking. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line_count() == 3); CHECK(code_edit->is_line_breakpointed(0)); CHECK_FALSE(code_edit->is_line_breakpointed(1)); @@ -248,7 +248,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { args.push_back(arg2); code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line_count() == 4); CHECK_FALSE(code_edit->is_line_breakpointed(0)); CHECK(code_edit->is_line_breakpointed(1)); @@ -269,12 +269,12 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { code_edit->set_caret_line(2); /* backspace onto line does not remove breakpoint */ - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(code_edit->is_line_breakpointed(1)); SIGNAL_CHECK_FALSE("breakpoint_toggled"); /* backspace on breakpointed line removes it */ - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK_FALSE(code_edit->is_line_breakpointed(0)); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_breakpointed(1)); @@ -294,7 +294,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { Array arg2; arg2.push_back(1); args.push_back(arg2); - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_breakpointed(2)); ERR_PRINT_ON; @@ -315,14 +315,14 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { code_edit->set_caret_line(1); /* Delete onto breakpointed lines does not remove it. */ - SEND_GUI_ACTION(code_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(code_edit->get_line_count() == 2); CHECK(code_edit->is_line_breakpointed(1)); SIGNAL_CHECK_FALSE("breakpoint_toggled"); /* Delete moving breakpointed line up removes it. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(code_edit->get_line_count() == 1); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_breakpointed(1)); @@ -342,7 +342,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { Array arg2; arg2.push_back(1); args.push_back(arg2); - SEND_GUI_ACTION(code_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_breakpointed(2)); ERR_PRINT_ON; @@ -380,7 +380,7 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { Array arg2; arg2.push_back(4); args.push_back(arg2); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_breakpointed(9)); ERR_PRINT_ON; @@ -524,19 +524,19 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { CHECK(code_edit->is_line_bookmarked(0)); /* Normal. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line_count() == 2); CHECK_FALSE(code_edit->is_line_bookmarked(0)); CHECK(code_edit->is_line_bookmarked(1)); /* Non-Breaking. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line_count() == 3); CHECK_FALSE(code_edit->is_line_bookmarked(1)); CHECK(code_edit->is_line_bookmarked(2)); /* Above. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line_count() == 4); CHECK_FALSE(code_edit->is_line_bookmarked(2)); CHECK(code_edit->is_line_bookmarked(3)); @@ -549,21 +549,21 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { CHECK(code_edit->is_line_bookmarked(0)); /* Normal. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line_count() == 2); CHECK(code_edit->is_line_bookmarked(0)); CHECK_FALSE(code_edit->is_line_bookmarked(1)); /* Non-Breaking. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line_count() == 3); CHECK(code_edit->is_line_bookmarked(0)); CHECK_FALSE(code_edit->is_line_bookmarked(1)); /* Above does move. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line_count() == 4); CHECK_FALSE(code_edit->is_line_bookmarked(0)); CHECK(code_edit->is_line_bookmarked(1)); @@ -577,11 +577,11 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { code_edit->set_caret_line(2); /* backspace onto line does not remove bookmark */ - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(code_edit->is_line_bookmarked(1)); /* backspace on bookmarked line removes it */ - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK_FALSE(code_edit->is_line_bookmarked(0)); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_bookmarked(1)); @@ -595,13 +595,13 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { code_edit->set_caret_line(1); /* Delete onto bookmarked lines does not remove it. */ - SEND_GUI_ACTION(code_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(code_edit->get_line_count() == 2); CHECK(code_edit->is_line_bookmarked(1)); /* Delete moving bookmarked line up removes it. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(code_edit->get_line_count() == 1); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_bookmarked(1)); @@ -730,19 +730,19 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { CHECK(code_edit->is_line_executing(0)); /* Normal. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line_count() == 2); CHECK_FALSE(code_edit->is_line_executing(0)); CHECK(code_edit->is_line_executing(1)); /* Non-Breaking. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line_count() == 3); CHECK_FALSE(code_edit->is_line_executing(1)); CHECK(code_edit->is_line_executing(2)); /* Above. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line_count() == 4); CHECK_FALSE(code_edit->is_line_executing(2)); CHECK(code_edit->is_line_executing(3)); @@ -755,21 +755,21 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { CHECK(code_edit->is_line_executing(0)); /* Normal. */ - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line_count() == 2); CHECK(code_edit->is_line_executing(0)); CHECK_FALSE(code_edit->is_line_executing(1)); /* Non-Breaking. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line_count() == 3); CHECK(code_edit->is_line_executing(0)); CHECK_FALSE(code_edit->is_line_executing(1)); /* Above does move. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line_count() == 4); CHECK_FALSE(code_edit->is_line_executing(0)); CHECK(code_edit->is_line_executing(1)); @@ -783,11 +783,11 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { code_edit->set_caret_line(2); /* backspace onto line does not remove executing lines. */ - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(code_edit->is_line_executing(1)); /* backspace on executing line removes it */ - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK_FALSE(code_edit->is_line_executing(0)); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_executing(1)); @@ -801,13 +801,13 @@ TEST_CASE("[SceneTree][CodeEdit] line gutters") { code_edit->set_caret_line(1); /* Delete onto executing lines does not remove it. */ - SEND_GUI_ACTION(code_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(code_edit->get_line_count() == 2); CHECK(code_edit->is_line_executing(1)); /* Delete moving executing line up removes it. */ code_edit->set_caret_line(0); - SEND_GUI_ACTION(code_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(code_edit->get_line_count() == 1); ERR_PRINT_OFF; CHECK_FALSE(code_edit->is_line_executing(1)); @@ -1814,7 +1814,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { CHECK(code_edit->get_line(0) == "\t"); /* Check input action. */ - SEND_GUI_ACTION(code_edit, "ui_text_indent"); + SEND_GUI_ACTION("ui_text_indent"); CHECK(code_edit->get_line(0) == "\t\t"); /* Insert in place. */ @@ -1887,7 +1887,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { CHECK(code_edit->get_line(0) == " "); /* Check input action. */ - SEND_GUI_ACTION(code_edit, "ui_text_indent"); + SEND_GUI_ACTION("ui_text_indent"); CHECK(code_edit->get_line(0) == " "); /* Insert in place. */ @@ -1985,7 +1985,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Check input action. */ code_edit->set_text("\t\ttest"); - SEND_GUI_ACTION(code_edit, "ui_text_dedent"); + SEND_GUI_ACTION("ui_text_dedent"); CHECK(code_edit->get_line(0) == "\ttest"); /* Selection does entire line. */ @@ -2076,7 +2076,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Check input action. */ code_edit->set_text(" test"); - SEND_GUI_ACTION(code_edit, "ui_text_dedent"); + SEND_GUI_ACTION("ui_text_dedent"); CHECK(code_edit->get_line(0) == " test"); /* Selection does entire line. */ @@ -2124,28 +2124,28 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Simple indent on new line. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test:"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test:"); CHECK(code_edit->get_line(1) == "\t"); /* new blank line should still indent. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test:"); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line(0) == "test:"); CHECK(code_edit->get_line(1) == "\t"); /* new line above should not indent. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test:"); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line(0) == ""); CHECK(code_edit->get_line(1) == "test:"); /* Whitespace between symbol and caret is okay. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test: "); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test: "); CHECK(code_edit->get_line(1) == "\t"); @@ -2153,7 +2153,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->add_comment_delimiter("#", ""); code_edit->set_text(""); code_edit->insert_text_at_caret("test: # comment"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test: # comment"); CHECK(code_edit->get_line(1) == "\t"); code_edit->remove_comment_delimiter("#"); @@ -2162,7 +2162,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->add_string_delimiter("#", ""); code_edit->set_text(""); code_edit->insert_text_at_caret("test: # string"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test: # string"); CHECK(code_edit->get_line(1) == ""); code_edit->remove_string_delimiter("#"); @@ -2171,7 +2171,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->add_comment_delimiter("#", ""); code_edit->set_text(""); code_edit->insert_text_at_caret("test := 0 # comment"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test := 0 # comment"); CHECK(code_edit->get_line(1) == ""); code_edit->remove_comment_delimiter("#"); @@ -2179,7 +2179,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Even when there's no comments. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test := 0"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test := 0"); CHECK(code_edit->get_line(1) == ""); @@ -2187,7 +2187,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_text(""); code_edit->insert_text_at_caret("test{}"); code_edit->set_caret_column(5); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test{"); CHECK(code_edit->get_line(1) == "\t"); CHECK(code_edit->get_line(2) == "}"); @@ -2196,7 +2196,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_text(""); code_edit->insert_text_at_caret("test{}"); code_edit->set_caret_column(5); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line(0) == ""); CHECK(code_edit->get_line(1) == "test{}"); @@ -2204,7 +2204,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_text(""); code_edit->insert_text_at_caret("test{}"); code_edit->set_caret_column(5); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line(0) == "test{}"); CHECK(code_edit->get_line(1) == ""); } @@ -2217,28 +2217,28 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Simple indent on new line. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test:"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test:"); CHECK(code_edit->get_line(1) == " "); /* new blank line should still indent. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test:"); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line(0) == "test:"); CHECK(code_edit->get_line(1) == " "); /* new line above should not indent. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test:"); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line(0) == ""); CHECK(code_edit->get_line(1) == "test:"); /* Whitespace between symbol and caret is okay. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test: "); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test: "); CHECK(code_edit->get_line(1) == " "); @@ -2246,7 +2246,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->add_comment_delimiter("#", ""); code_edit->set_text(""); code_edit->insert_text_at_caret("test: # comment"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test: # comment"); CHECK(code_edit->get_line(1) == " "); code_edit->remove_comment_delimiter("#"); @@ -2255,7 +2255,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->add_string_delimiter("#", ""); code_edit->set_text(""); code_edit->insert_text_at_caret("test: # string"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test: # string"); CHECK(code_edit->get_line(1) == ""); code_edit->remove_string_delimiter("#"); @@ -2264,7 +2264,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->add_comment_delimiter("#", ""); code_edit->set_text(""); code_edit->insert_text_at_caret("test := 0 # comment"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test := 0 # comment"); CHECK(code_edit->get_line(1) == ""); code_edit->remove_comment_delimiter("#"); @@ -2272,7 +2272,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Even when there's no comments. */ code_edit->set_text(""); code_edit->insert_text_at_caret("test := 0"); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test := 0"); CHECK(code_edit->get_line(1) == ""); @@ -2280,7 +2280,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_text(""); code_edit->insert_text_at_caret("test{}"); code_edit->set_caret_column(5); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test{"); CHECK(code_edit->get_line(1) == " "); CHECK(code_edit->get_line(2) == "}"); @@ -2289,7 +2289,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_text(""); code_edit->insert_text_at_caret("test{}"); code_edit->set_caret_column(5); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line(0) == ""); CHECK(code_edit->get_line(1) == "test{}"); @@ -2297,7 +2297,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_text(""); code_edit->insert_text_at_caret("test{}"); code_edit->set_caret_column(5); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line(0) == "test{}"); CHECK(code_edit->get_line(1) == ""); } @@ -2764,57 +2764,57 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { /* Check typing inserts closing pair. */ code_edit->clear(); - SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETLEFT); + SEND_GUI_KEY_EVENT(Key::BRACKETLEFT); CHECK(code_edit->get_line(0) == "[]"); /* Should first match and insert smaller key. */ code_edit->clear(); - SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE); + SEND_GUI_KEY_EVENT(Key::APOSTROPHE); CHECK(code_edit->get_line(0) == "''"); CHECK(code_edit->get_caret_column() == 1); /* Move out from center, Should match and insert larger key. */ - SEND_GUI_ACTION(code_edit, "ui_text_caret_right"); - SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE); + SEND_GUI_ACTION("ui_text_caret_right"); + SEND_GUI_KEY_EVENT(Key::APOSTROPHE); CHECK(code_edit->get_line(0) == "''''''"); CHECK(code_edit->get_caret_column() == 3); /* Backspace should remove all. */ - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(code_edit->get_line(0).is_empty()); /* If in between and typing close key should "skip". */ - SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETLEFT); + SEND_GUI_KEY_EVENT(Key::BRACKETLEFT); CHECK(code_edit->get_line(0) == "[]"); CHECK(code_edit->get_caret_column() == 1); - SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETRIGHT); + SEND_GUI_KEY_EVENT(Key::BRACKETRIGHT); CHECK(code_edit->get_line(0) == "[]"); CHECK(code_edit->get_caret_column() == 2); /* If current is char and inserting a string, do not autocomplete. */ code_edit->clear(); - SEND_GUI_KEY_EVENT(code_edit, Key::A); - SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE); + SEND_GUI_KEY_EVENT(Key::A); + SEND_GUI_KEY_EVENT(Key::APOSTROPHE); CHECK(code_edit->get_line(0) == "A'"); /* If in comment, do not complete. */ code_edit->add_comment_delimiter("#", ""); code_edit->clear(); - SEND_GUI_KEY_EVENT(code_edit, Key::NUMBERSIGN); - SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE); + SEND_GUI_KEY_EVENT(Key::NUMBERSIGN); + SEND_GUI_KEY_EVENT(Key::APOSTROPHE); CHECK(code_edit->get_line(0) == "#'"); /* If in string, and inserting string do not complete. */ code_edit->clear(); - SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE); - SEND_GUI_KEY_EVENT(code_edit, Key::QUOTEDBL); + SEND_GUI_KEY_EVENT(Key::APOSTROPHE); + SEND_GUI_KEY_EVENT(Key::QUOTEDBL); CHECK(code_edit->get_line(0) == "'\"'"); /* Wrap single line selection with brackets */ code_edit->clear(); code_edit->insert_text_at_caret("abc"); code_edit->select_all(); - SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETLEFT); + SEND_GUI_KEY_EVENT(Key::BRACKETLEFT); CHECK(code_edit->get_line(0) == "[abc]"); /* Caret should be after the last character of the single line selection */ @@ -2824,7 +2824,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->clear(); code_edit->insert_text_at_caret("abc\nabc"); code_edit->select_all(); - SEND_GUI_KEY_EVENT(code_edit, Key::BRACKETLEFT); + SEND_GUI_KEY_EVENT(Key::BRACKETLEFT); CHECK(code_edit->get_text() == "[abc\nabc]"); /* Caret should be after the last character of the multi line selection */ @@ -2835,14 +2835,14 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->clear(); code_edit->insert_text_at_caret("abc"); code_edit->select_all(); - SEND_GUI_KEY_EVENT(code_edit, Key::KEY_1); + SEND_GUI_KEY_EVENT(Key::KEY_1); CHECK(code_edit->get_text() == "1"); /* If potential multichar and single brace completion is matched, it should wrap the single. */ code_edit->clear(); code_edit->insert_text_at_caret("\'\'abc"); code_edit->select(0, 2, 0, 5); - SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE); + SEND_GUI_KEY_EVENT(Key::APOSTROPHE); CHECK(code_edit->get_text() == "\'\'\'abc\'"); /* If only the potential multichar brace completion is matched, it does not wrap or complete. */ @@ -2853,7 +2853,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->clear(); code_edit->insert_text_at_caret("\'\'abc"); code_edit->select(0, 2, 0, 5); - SEND_GUI_KEY_EVENT(code_edit, Key::APOSTROPHE); + SEND_GUI_KEY_EVENT(Key::APOSTROPHE); CHECK(code_edit->get_text() == "\'\'\'"); } @@ -2977,7 +2977,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { SIGNAL_CHECK("code_completion_requested", signal_args); /* Manual request should force. */ - SEND_GUI_ACTION(code_edit, "ui_text_completion_query"); + SEND_GUI_ACTION("ui_text_completion_query"); SIGNAL_CHECK("code_completion_requested", signal_args); /* Insert prefix. */ @@ -3042,7 +3042,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { CHECK(code_edit->get_code_completion_options().size() == 1); /* Check cancel closes completion. */ - SEND_GUI_ACTION(code_edit, "ui_cancel"); + SEND_GUI_ACTION("ui_cancel"); CHECK(code_edit->get_code_completion_selected_index() == -1); code_edit->update_code_completion_options(); @@ -3065,51 +3065,51 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_size(Size2(100, 100)); /* Check input. */ - SEND_GUI_ACTION(code_edit, "ui_end"); + SEND_GUI_ACTION("ui_end"); CHECK(code_edit->get_code_completion_selected_index() == 2); - SEND_GUI_ACTION(code_edit, "ui_home"); + SEND_GUI_ACTION("ui_home"); CHECK(code_edit->get_code_completion_selected_index() == 0); - SEND_GUI_ACTION(code_edit, "ui_page_down"); + SEND_GUI_ACTION("ui_page_down"); CHECK(code_edit->get_code_completion_selected_index() == 2); - SEND_GUI_ACTION(code_edit, "ui_page_up"); + SEND_GUI_ACTION("ui_page_up"); CHECK(code_edit->get_code_completion_selected_index() == 0); - SEND_GUI_ACTION(code_edit, "ui_up"); + SEND_GUI_ACTION("ui_up"); CHECK(code_edit->get_code_completion_selected_index() == 2); - SEND_GUI_ACTION(code_edit, "ui_down"); + SEND_GUI_ACTION("ui_down"); CHECK(code_edit->get_code_completion_selected_index() == 0); - SEND_GUI_KEY_EVENT(code_edit, Key::T); + SEND_GUI_KEY_EVENT(Key::T); CHECK(code_edit->get_code_completion_selected_index() == 0); - SEND_GUI_ACTION(code_edit, "ui_left"); + SEND_GUI_ACTION("ui_left"); CHECK(code_edit->get_code_completion_selected_index() == 0); - SEND_GUI_ACTION(code_edit, "ui_right"); + SEND_GUI_ACTION("ui_right"); CHECK(code_edit->get_code_completion_selected_index() == 0); - SEND_GUI_ACTION(code_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(code_edit->get_code_completion_selected_index() == 0); Point2 caret_pos = code_edit->get_caret_draw_pos(); caret_pos.y += code_edit->get_line_height(); - SEND_GUI_MOUSE_BUTTON_EVENT(code_edit, caret_pos, MouseButton::WHEEL_DOWN, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::WHEEL_DOWN, 0, Key::NONE); CHECK(code_edit->get_code_completion_selected_index() == 1); - SEND_GUI_MOUSE_BUTTON_EVENT(code_edit, caret_pos, MouseButton::WHEEL_UP, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::WHEEL_UP, 0, Key::NONE); CHECK(code_edit->get_code_completion_selected_index() == 0); /* Single click selects. */ caret_pos.y += code_edit->get_line_height() * 2; - SEND_GUI_MOUSE_BUTTON_EVENT(code_edit, caret_pos, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK(code_edit->get_code_completion_selected_index() == 2); /* Double click inserts. */ - SEND_GUI_DOUBLE_CLICK(code_edit, caret_pos, Key::NONE); + SEND_GUI_DOUBLE_CLICK(caret_pos, Key::NONE); CHECK(code_edit->get_code_completion_selected_index() == -1); CHECK(code_edit->get_line(0) == "item_2"); @@ -3130,7 +3130,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0 test"); /* Replace string. */ @@ -3139,7 +3139,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "\"item_0\""); /* Normal replace if no end is given. */ @@ -3148,7 +3148,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "\"item_0\" test"); /* Insert at completion. */ @@ -3157,7 +3157,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_accept"); + SEND_GUI_ACTION("ui_text_completion_accept"); CHECK(code_edit->get_line(0) == "item_01 test"); /* Insert at completion with string should have same output. */ @@ -3166,7 +3166,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0.", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_accept"); + SEND_GUI_ACTION("ui_text_completion_accept"); CHECK(code_edit->get_line(0) == "\"item_0\"1 test\""); /* Merge symbol at end on insert text. */ @@ -3176,7 +3176,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0( test"); CHECK(code_edit->get_caret_column() == 7); @@ -3186,7 +3186,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0( test"); CHECK(code_edit->get_caret_column() == 6); @@ -3196,7 +3196,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0( test"); CHECK(code_edit->get_caret_column() == 7); @@ -3207,7 +3207,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0() test"); CHECK(code_edit->get_caret_column() == 8); @@ -3217,7 +3217,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0() test"); CHECK(code_edit->get_caret_column() == 6); @@ -3227,7 +3227,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0() test"); CHECK(code_edit->get_caret_column() == 8); @@ -3240,7 +3240,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0() test"); CHECK(code_edit->get_caret_column() == 7); @@ -3250,7 +3250,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0( test"); CHECK(code_edit->get_caret_column() == 6); @@ -3260,7 +3260,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0(", "item_0("); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0( test"); CHECK(code_edit->get_caret_column() == 7); @@ -3271,7 +3271,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0() test"); CHECK(code_edit->get_caret_column() == 8); @@ -3281,7 +3281,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0", "item_0"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0() test"); CHECK(code_edit->get_caret_column() == 6); @@ -3291,7 +3291,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") { code_edit->set_caret_column(2); code_edit->add_code_completion_option(CodeEdit::CodeCompletionKind::KIND_CLASS, "item_0()", "item_0()"); code_edit->update_code_completion_options(); - SEND_GUI_ACTION(code_edit, "ui_text_completion_replace"); + SEND_GUI_ACTION("ui_text_completion_replace"); CHECK(code_edit->get_line(0) == "item_0() test"); CHECK(code_edit->get_caret_column() == 8); } @@ -3316,15 +3316,15 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") { Point2 caret_pos = code_edit->get_caret_draw_pos(); caret_pos.x += 60; - SEND_GUI_MOUSE_BUTTON_EVENT(code_edit, caret_pos, MouseButton::NONE, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::NONE, 0, Key::NONE); CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text"); SIGNAL_WATCH(code_edit, "symbol_validate"); #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(code_edit, Key::META); + SEND_GUI_KEY_EVENT(Key::META); #else - SEND_GUI_KEY_EVENT(code_edit, Key::CTRL); + SEND_GUI_KEY_EVENT(Key::CTRL); #endif Array signal_args; @@ -3418,7 +3418,7 @@ TEST_CASE("[SceneTree][CodeEdit] New Line") { code_edit->insert_text_at_caret("test new line"); code_edit->set_caret_line(0); code_edit->set_caret_column(13); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test new line"); CHECK(code_edit->get_line(1) == ""); @@ -3427,7 +3427,7 @@ TEST_CASE("[SceneTree][CodeEdit] New Line") { code_edit->insert_text_at_caret("test new line"); code_edit->set_caret_line(0); code_edit->set_caret_column(5); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == "test "); CHECK(code_edit->get_line(1) == "new line"); @@ -3435,7 +3435,7 @@ TEST_CASE("[SceneTree][CodeEdit] New Line") { code_edit->set_text(""); code_edit->insert_text_at_caret("test new line"); code_edit->select(0, 0, 0, 5); - SEND_GUI_ACTION(code_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(code_edit->get_line(0) == ""); CHECK(code_edit->get_line(1) == "new line"); @@ -3443,7 +3443,7 @@ TEST_CASE("[SceneTree][CodeEdit] New Line") { code_edit->set_text(""); code_edit->insert_text_at_caret("test new line"); code_edit->select(0, 0, 0, 5); - SEND_GUI_ACTION(code_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(code_edit->get_line(0) == "test new line"); CHECK(code_edit->get_line(1) == ""); @@ -3451,7 +3451,7 @@ TEST_CASE("[SceneTree][CodeEdit] New Line") { code_edit->set_text(""); code_edit->insert_text_at_caret("test new line"); code_edit->select(0, 0, 0, 5); - SEND_GUI_ACTION(code_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(code_edit->get_line(0) == ""); CHECK(code_edit->get_line(1) == "test new line"); diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h index a9730ce820..d42ef8859a 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.h @@ -607,7 +607,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ERR_PRINT_ON; text_edit->set_text("test\nselection"); - SEND_GUI_ACTION(text_edit, "ui_text_select_all"); + SEND_GUI_ACTION("ui_text_select_all"); CHECK(text_edit->get_viewport()->is_input_handled()); MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_selected_text() == "test\nselection"); @@ -678,7 +678,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == ""); - SEND_GUI_ACTION(text_edit, "ui_text_select_word_under_caret"); + SEND_GUI_ACTION("ui_text_select_word_under_caret"); CHECK(text_edit->get_viewport()->is_input_handled()); MessageQueue::get_singleton()->flush(); CHECK(text_edit->has_selection(0)); @@ -836,48 +836,48 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->set_text("test"); text_edit->grab_focus(); - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT) + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::SHIFT) CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "t"); #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT | KeyModifierMask::ALT) + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::SHIFT | KeyModifierMask::ALT) #else - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT | KeyModifierMask::CMD_OR_CTRL) + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::SHIFT | KeyModifierMask::CMD_OR_CTRL) #endif CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "test"); - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::SHIFT) + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::SHIFT) CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "tes"); #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::SHIFT | KeyModifierMask::ALT) + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::SHIFT | KeyModifierMask::ALT) #else - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::SHIFT | KeyModifierMask::CMD_OR_CTRL) + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::SHIFT | KeyModifierMask::CMD_OR_CTRL) #endif CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == ""); - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT) + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::SHIFT) CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "t"); - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT) + SEND_GUI_KEY_EVENT(Key::RIGHT) CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == ""); - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::SHIFT) + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::SHIFT) CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "t"); - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT) + SEND_GUI_KEY_EVENT(Key::LEFT) CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == ""); text_edit->set_selecting_enabled(false); - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT) + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::SHIFT) CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == ""); text_edit->set_selecting_enabled(true); @@ -891,8 +891,8 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->grab_focus(); MessageQueue::get_singleton()->flush(); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 1), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); - SEND_GUI_MOUSE_MOTION_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 1), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_MOTION_EVENT(text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "for s"); CHECK(text_edit->get_selection_mode() == TextEdit::SELECTION_MODE_POINTER); @@ -903,12 +903,12 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 5); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 9), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 9), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK_FALSE(text_edit->has_selection()); text_edit->set_selecting_enabled(false); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 1), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); - SEND_GUI_MOUSE_MOTION_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 1), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_MOTION_EVENT(text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 5); @@ -923,7 +923,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { MessageQueue::get_singleton()->flush(); SIGNAL_DISCARD("caret_changed"); - SEND_GUI_DOUBLE_CLICK(text_edit, text_edit->get_pos_at_line_column(0, 2), Key::NONE); + SEND_GUI_DOUBLE_CLICK(text_edit->get_pos_at_line_column(0, 2), Key::NONE); CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "for"); CHECK(text_edit->get_selection_mode() == TextEdit::SELECTION_MODE_WORD); @@ -935,7 +935,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { CHECK(text_edit->get_caret_column() == 3); SIGNAL_CHECK("caret_changed", empty_signal_args); - SEND_GUI_MOUSE_MOTION_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_MOTION_EVENT(text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "for selection"); CHECK(text_edit->get_selection_mode() == TextEdit::SELECTION_MODE_WORD); @@ -949,11 +949,11 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { Point2i line_0 = text_edit->get_pos_at_line_column(0, 0); line_0.y /= 2; - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, line_0, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(line_0, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK_FALSE(text_edit->has_selection()); text_edit->set_selecting_enabled(false); - SEND_GUI_DOUBLE_CLICK(text_edit, text_edit->get_pos_at_line_column(0, 2), Key::NONE); + SEND_GUI_DOUBLE_CLICK(text_edit->get_pos_at_line_column(0, 2), Key::NONE); CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 3); @@ -967,8 +967,8 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->set_text("this is some text\nfor selection"); MessageQueue::get_singleton()->flush(); - SEND_GUI_DOUBLE_CLICK(text_edit, text_edit->get_pos_at_line_column(0, 2), Key::NONE); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 2), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_DOUBLE_CLICK(text_edit->get_pos_at_line_column(0, 2), Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 2), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "for selection"); CHECK(text_edit->get_selection_mode() == TextEdit::SELECTION_MODE_LINE); @@ -981,12 +981,12 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { Point2i line_0 = text_edit->get_pos_at_line_column(0, 0); line_0.y /= 2; - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, line_0, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(line_0, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK_FALSE(text_edit->has_selection()); text_edit->set_selecting_enabled(false); - SEND_GUI_DOUBLE_CLICK(text_edit, text_edit->get_pos_at_line_column(0, 2), Key::NONE); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 2), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_DOUBLE_CLICK(text_edit->get_pos_at_line_column(0, 2), Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 2), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 0); @@ -1000,8 +1000,8 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->set_text("this is some text\nfor selection"); MessageQueue::get_singleton()->flush(); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 0), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 7), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE | KeyModifierMask::SHIFT); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 0), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 7), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE | KeyModifierMask::SHIFT); CHECK(text_edit->has_selection()); CHECK(text_edit->get_selected_text() == "for s"); CHECK(text_edit->get_selection_mode() == TextEdit::SELECTION_MODE_POINTER); @@ -1012,12 +1012,12 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 5); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 9), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 9), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK_FALSE(text_edit->has_selection()); text_edit->set_selecting_enabled(false); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 0), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 7), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE | KeyModifierMask::SHIFT); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 0), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(text_edit->get_pos_at_line_column(0, 7), MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE | KeyModifierMask::SHIFT); CHECK_FALSE(text_edit->has_selection()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 5); @@ -1061,7 +1061,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->select(0, 8, 0, 4); CHECK(text_edit->has_selection()); - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK_FALSE(text_edit->has_selection()); text_edit->delete_selection(); @@ -1071,7 +1071,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->select(0, 8, 0, 4); CHECK(text_edit->has_selection()); - SEND_GUI_ACTION(text_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(text_edit->get_text() == "thissome text\nfor selection"); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 4); @@ -1149,19 +1149,19 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { Point2i line_0 = text_edit->get_pos_at_line_column(0, 0); line_0.y /= 2; - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, line_0, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(line_0, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE); CHECK(text_edit->is_mouse_over_selection()); - SEND_GUI_MOUSE_MOTION_EVENT(text_edit, text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_MOTION_EVENT(text_edit->get_pos_at_line_column(0, 7), MouseButtonMask::LEFT, Key::NONE); CHECK(text_edit->get_viewport()->gui_is_dragging()); CHECK(text_edit->get_viewport()->gui_get_drag_data() == "drag me"); line_0 = target_text_edit->get_pos_at_line_column(0, 0); line_0.y /= 2; line_0.x += 401; // As empty add one. - SEND_GUI_MOUSE_MOTION_EVENT(target_text_edit, line_0, MouseButtonMask::LEFT, Key::NONE); + SEND_GUI_MOUSE_MOTION_EVENT(line_0, MouseButtonMask::LEFT, Key::NONE); CHECK(text_edit->get_viewport()->gui_is_dragging()); - SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(target_text_edit, line_0, MouseButton::LEFT, MouseButtonMask::NONE, Key::NONE); + SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(line_0, MouseButton::LEFT, MouseButtonMask::NONE, Key::NONE); CHECK_FALSE(text_edit->get_viewport()->gui_is_dragging()); CHECK(text_edit->get_text() == ""); @@ -1324,7 +1324,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[0])[0] = 0; text_edit->select(0, 5, 0, 7); ERR_PRINT_OFF; - SEND_GUI_ACTION(text_edit, "ui_cut"); + SEND_GUI_ACTION("ui_cut"); CHECK(text_edit->get_viewport()->is_input_handled()); MessageQueue::get_singleton()->flush(); ERR_PRINT_ON; // Can't check display server content. @@ -1401,7 +1401,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { lines_edited_args.push_front(args2); ((Array)lines_edited_args[1])[1] = 1; - SEND_GUI_ACTION(text_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\nthis is some test text.\n\nthis is some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -1424,7 +1424,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\nthis is some test text.\n\nthis is some test text."); CHECK(text_edit->get_caret_line() == 1); @@ -1442,7 +1442,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[0])[0] = 2; ((Array)lines_edited_args[0])[1] = 3; - SEND_GUI_ACTION(text_edit, "ui_text_newline_above"); + SEND_GUI_ACTION("ui_text_newline_above"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n\nthis is some test text.\n\n\nthis is some test text."); CHECK(text_edit->get_caret_line() == 1); @@ -1480,7 +1480,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { lines_edited_args.push_front(args2); ((Array)lines_edited_args[1])[1] = 1; - SEND_GUI_ACTION(text_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "this is some test text.\n\nthis is some test text.\n"); CHECK(text_edit->get_caret_line() == 1); @@ -1495,7 +1495,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK("lines_edited_from", lines_edited_args); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_newline_blank"); + SEND_GUI_ACTION("ui_text_newline_blank"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "this is some test text.\n\nthis is some test text.\n"); CHECK(text_edit->get_caret_line() == 1); @@ -1538,7 +1538,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { lines_edited_args.push_back(lines_edited_args[2].duplicate()); ((Array)lines_edited_args[3])[1] = 1; - SEND_GUI_ACTION(text_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n is some test text.\n\n is some test text."); CHECK(text_edit->get_caret_line() == 1); @@ -1553,7 +1553,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK("lines_edited_from", lines_edited_args); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_newline"); + SEND_GUI_ACTION("ui_text_newline"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n is some test text.\n\n is some test text."); CHECK(text_edit->get_caret_line() == 1); @@ -1599,7 +1599,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[1])[0] = 1; ((Array)lines_edited_args[1])[1] = 1; - SEND_GUI_ACTION(text_edit, "ui_text_backspace_all_to_left"); + SEND_GUI_ACTION("ui_text_backspace_all_to_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n is some test text.\n\n is some test text."); CHECK(text_edit->get_caret_line() == 1); @@ -1617,7 +1617,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[1])[1] = 0; // Start of line should also be a normal backspace. - SEND_GUI_ACTION(text_edit, "ui_text_backspace_all_to_left"); + SEND_GUI_ACTION("ui_text_backspace_all_to_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -1641,7 +1641,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_backspace_all_to_left"); + SEND_GUI_ACTION("ui_text_backspace_all_to_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -1660,7 +1660,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[0])[1] = 1; ((Array)lines_edited_args[1])[0] = 0; - SEND_GUI_ACTION(text_edit, "ui_text_backspace_all_to_left"); + SEND_GUI_ACTION("ui_text_backspace_all_to_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n"); CHECK(text_edit->get_caret_line() == 0); @@ -1703,7 +1703,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[1])[0] = 1; ((Array)lines_edited_args[1])[1] = 1; - SEND_GUI_ACTION(text_edit, "ui_text_backspace_word"); + SEND_GUI_ACTION("ui_text_backspace_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n is some test text.\n\n is some test text."); CHECK(text_edit->get_caret_line() == 1); @@ -1722,7 +1722,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[1])[1] = 0; // Start of line should also be a normal backspace. - SEND_GUI_ACTION(text_edit, "ui_text_backspace_word"); + SEND_GUI_ACTION("ui_text_backspace_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -1737,7 +1737,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK("lines_edited_from", lines_edited_args); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_backspace_word"); + SEND_GUI_ACTION("ui_text_backspace_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -1765,7 +1765,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[0])[1] = 1; ((Array)lines_edited_args[1])[0] = 0; - SEND_GUI_ACTION(text_edit, "ui_text_backspace_word"); + SEND_GUI_ACTION("ui_text_backspace_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test \n is some test "); CHECK(text_edit->get_caret_line() == 0); @@ -1807,7 +1807,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[1])[0] = 1; ((Array)lines_edited_args[1])[1] = 1; - SEND_GUI_ACTION(text_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n is some test text.\n\n is some test text."); CHECK(text_edit->get_caret_line() == 1); @@ -1825,7 +1825,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[1])[1] = 0; // Start of line should also be a normal backspace. - SEND_GUI_ACTION(text_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -1849,7 +1849,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -1868,7 +1868,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { ((Array)lines_edited_args[0])[1] = 1; ((Array)lines_edited_args[1])[0] = 0; - SEND_GUI_ACTION(text_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text\n is some test text"); CHECK(text_edit->get_caret_line() == 0); @@ -1897,7 +1897,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("lines_edited_from"); SIGNAL_DISCARD("caret_changed"); - SEND_GUI_ACTION(text_edit, "ui_text_backspace"); + SEND_GUI_ACTION("ui_text_backspace"); CHECK(text_edit->get_text() == "\n"); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 0); @@ -1935,7 +1935,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { lines_edited_args.push_front(args2); // With selection should be a normal delete. - SEND_GUI_ACTION(text_edit, "ui_text_delete_all_to_right"); + SEND_GUI_ACTION("ui_text_delete_all_to_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text.\n"); CHECK(text_edit->get_caret_line() == 0); @@ -1959,7 +1959,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("lines_edited_from"); SIGNAL_DISCARD("caret_changed"); - SEND_GUI_ACTION(text_edit, "ui_text_delete_all_to_right"); + SEND_GUI_ACTION("ui_text_delete_all_to_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text.\n"); CHECK(text_edit->get_caret_line() == 0); @@ -1983,7 +1983,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_delete_all_to_right"); + SEND_GUI_ACTION("ui_text_delete_all_to_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " is some test text.\n is some test text.\n"); CHECK(text_edit->get_caret_line() == 0); @@ -1998,7 +1998,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); text_edit->set_editable(true); - SEND_GUI_ACTION(text_edit, "ui_text_delete_all_to_right"); + SEND_GUI_ACTION("ui_text_delete_all_to_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "\n\n"); CHECK(text_edit->get_caret_line() == 0); @@ -2042,7 +2042,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { lines_edited_args.push_front(args2); // With selection should be a normal delete. - SEND_GUI_ACTION(text_edit, "ui_text_delete_word"); + SEND_GUI_ACTION("ui_text_delete_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " ffi some test text.\n\n ffi some test text.\n"); CHECK(text_edit->get_caret_line() == 0); @@ -2068,7 +2068,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("lines_edited_from"); SIGNAL_DISCARD("caret_changed"); - SEND_GUI_ACTION(text_edit, "ui_text_delete_word"); + SEND_GUI_ACTION("ui_text_delete_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " ffi some test text.\n ffi some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2095,7 +2095,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_delete_word"); + SEND_GUI_ACTION("ui_text_delete_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " ffi some test text.\n ffi some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2110,7 +2110,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); text_edit->set_editable(true); - SEND_GUI_ACTION(text_edit, "ui_text_delete_word"); + SEND_GUI_ACTION("ui_text_delete_word"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " some test text.\n some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2152,7 +2152,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { lines_edited_args.push_front(args2); // With selection should be a normal delete. - SEND_GUI_ACTION(text_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " ffi some test text.\n ffi some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2178,7 +2178,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("lines_edited_from"); SIGNAL_DISCARD("caret_changed"); - SEND_GUI_ACTION(text_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " ffi some test text. ffi some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2207,7 +2207,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); text_edit->set_editable(false); - SEND_GUI_ACTION(text_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " ffi some test text. ffi some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2224,7 +2224,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->start_action(TextEdit::EditAction::ACTION_NONE); - SEND_GUI_ACTION(text_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "ffi some test text.ffi some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2240,7 +2240,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->start_action(TextEdit::EditAction::ACTION_NONE); - SEND_GUI_ACTION(text_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "fi some test text.fi some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2268,7 +2268,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("lines_edited_from"); SIGNAL_DISCARD("caret_changed"); - SEND_GUI_ACTION(text_edit, "ui_text_delete"); + SEND_GUI_ACTION("ui_text_delete"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == " some test text. some test text."); CHECK(text_edit->get_caret_line() == 0); @@ -2299,9 +2299,9 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { // Shift should select. #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::ALT | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::ALT | KeyModifierMask::SHIFT); #else - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #endif CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); @@ -2319,7 +2319,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Should still move caret with selection. - SEND_GUI_ACTION(text_edit, "ui_text_caret_word_left"); + SEND_GUI_ACTION("ui_text_caret_word_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 0); @@ -2334,7 +2334,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Normal word left. - SEND_GUI_ACTION(text_edit, "ui_text_caret_word_left"); + SEND_GUI_ACTION("ui_text_caret_word_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 0); @@ -2366,7 +2366,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); // Normal left should deselect and place at selection start. - SEND_GUI_ACTION(text_edit, "ui_text_caret_left"); + SEND_GUI_ACTION("ui_text_caret_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); @@ -2382,7 +2382,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // With shift should select. - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::SHIFT); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 1); @@ -2399,7 +2399,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // All ready at select left, should only deselect. - SEND_GUI_ACTION(text_edit, "ui_text_caret_left"); + SEND_GUI_ACTION("ui_text_caret_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 1); @@ -2414,7 +2414,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Normal left. - SEND_GUI_ACTION(text_edit, "ui_text_caret_left"); + SEND_GUI_ACTION("ui_text_caret_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 0); @@ -2428,7 +2428,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Left at col 0 should go up a line. - SEND_GUI_ACTION(text_edit, "ui_text_caret_left"); + SEND_GUI_ACTION("ui_text_caret_left"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 0); @@ -2459,9 +2459,9 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { // Shift should select. #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::ALT | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::ALT | KeyModifierMask::SHIFT); #else - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #endif CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); @@ -2479,7 +2479,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Should still move caret with selection. - SEND_GUI_ACTION(text_edit, "ui_text_caret_word_right"); + SEND_GUI_ACTION("ui_text_caret_word_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 22); @@ -2494,7 +2494,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Normal word right. - SEND_GUI_ACTION(text_edit, "ui_text_caret_word_right"); + SEND_GUI_ACTION("ui_text_caret_word_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 0); @@ -2526,7 +2526,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); // Normal right should deselect and place at selection start. - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 20); @@ -2541,7 +2541,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // With shift should select. - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::SHIFT); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 21); @@ -2558,7 +2558,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // All ready at select right, should only deselect. - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 21); @@ -2572,7 +2572,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Normal right. - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 22); @@ -2586,7 +2586,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Right at end col should go down a line. - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 0); @@ -2620,7 +2620,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); // Select + up should select everything to the left on that line. - SEND_GUI_KEY_EVENT(text_edit, Key::UP | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::UP | KeyModifierMask::SHIFT); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_caret_column() == 5); @@ -2636,7 +2636,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Should deselect and move up. - SEND_GUI_ACTION(text_edit, "ui_text_caret_up"); + SEND_GUI_ACTION("ui_text_caret_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 8); @@ -2650,7 +2650,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Normal up over wrapped line. - SEND_GUI_ACTION(text_edit, "ui_text_caret_up"); + SEND_GUI_ACTION("ui_text_caret_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 12); @@ -2665,7 +2665,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->set_caret_column(12, false); // Normal up over wrapped line to line 0. - SEND_GUI_ACTION(text_edit, "ui_text_caret_up"); + SEND_GUI_ACTION("ui_text_caret_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 7); @@ -2699,7 +2699,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); // Select + down should select everything to the right on that line. - SEND_GUI_KEY_EVENT(text_edit, Key::DOWN | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::DOWN | KeyModifierMask::SHIFT); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_caret_column() == 5); @@ -2715,7 +2715,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Should deselect and move down. - SEND_GUI_ACTION(text_edit, "ui_text_caret_down"); + SEND_GUI_ACTION("ui_text_caret_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_caret_column() == 8); @@ -2729,7 +2729,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); // Normal down over wrapped line. - SEND_GUI_ACTION(text_edit, "ui_text_caret_down"); + SEND_GUI_ACTION("ui_text_caret_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 3); CHECK(text_edit->get_caret_column() == 7); @@ -2744,7 +2744,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->set_caret_column(7, false); // Normal down over wrapped line to last wrapped line. - SEND_GUI_ACTION(text_edit, "ui_text_caret_down"); + SEND_GUI_ACTION("ui_text_caret_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 3); CHECK(text_edit->get_caret_column() == 12); @@ -2778,9 +2778,9 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::UP | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::UP | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #else - SEND_GUI_KEY_EVENT(text_edit, Key::HOME | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::HOME | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #endif CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "this is some\nother test\nlines\ngo here"); @@ -2793,7 +2793,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); CHECK(text_edit->get_caret_count() == 1); - SEND_GUI_ACTION(text_edit, "ui_text_caret_document_start"); + SEND_GUI_ACTION("ui_text_caret_document_start"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "this is some\nother test\nlines\ngo here"); CHECK(text_edit->get_caret_line() == 0); @@ -2823,9 +2823,9 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::DOWN | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::DOWN | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #else - SEND_GUI_KEY_EVENT(text_edit, Key::END | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::END | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #endif CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "go here\nlines\nother test\nthis is some"); @@ -2838,7 +2838,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("lines_edited_from"); CHECK(text_edit->get_caret_count() == 1); - SEND_GUI_ACTION(text_edit, "ui_text_caret_document_end"); + SEND_GUI_ACTION("ui_text_caret_document_end"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "go here\nlines\nother test\nthis is some"); CHECK(text_edit->get_caret_line() == 3); @@ -2868,9 +2868,9 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::LEFT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::LEFT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #else - SEND_GUI_KEY_EVENT(text_edit, Key::HOME | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::HOME | KeyModifierMask::SHIFT); #endif CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); @@ -2886,7 +2886,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("text_changed"); SIGNAL_CHECK_FALSE("lines_edited_from"); - SEND_GUI_ACTION(text_edit, "ui_text_caret_line_start"); + SEND_GUI_ACTION("ui_text_caret_line_start"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 2); @@ -2899,7 +2899,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("text_changed"); SIGNAL_CHECK_FALSE("lines_edited_from"); - SEND_GUI_ACTION(text_edit, "ui_text_caret_line_start"); + SEND_GUI_ACTION("ui_text_caret_line_start"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 0); @@ -2912,7 +2912,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("text_changed"); SIGNAL_CHECK_FALSE("lines_edited_from"); - SEND_GUI_ACTION(text_edit, "ui_text_caret_line_start"); + SEND_GUI_ACTION("ui_text_caret_line_start"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == 2); @@ -2945,9 +2945,9 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_DISCARD("caret_changed"); #ifdef MACOS_ENABLED - SEND_GUI_KEY_EVENT(text_edit, Key::RIGHT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::RIGHT | KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT); #else - SEND_GUI_KEY_EVENT(text_edit, Key::END | KeyModifierMask::SHIFT); + SEND_GUI_KEY_EVENT(Key::END | KeyModifierMask::SHIFT); #endif CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); @@ -2963,7 +2963,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK_FALSE("text_changed"); SIGNAL_CHECK_FALSE("lines_edited_from"); - SEND_GUI_ACTION(text_edit, "ui_text_caret_line_end"); + SEND_GUI_ACTION("ui_text_caret_line_end"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 0); CHECK(text_edit->get_caret_column() == text_edit->get_line(0).length()); @@ -2999,7 +2999,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { args2.push_back(1); lines_edited_args.push_front(args2); - SEND_GUI_KEY_EVENT(text_edit, Key::A); + SEND_GUI_KEY_EVENT(Key::A); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "aA\naA"); CHECK(text_edit->get_caret_column() == 2); @@ -3009,7 +3009,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK("lines_edited_from", lines_edited_args); text_edit->set_editable(false); - SEND_GUI_KEY_EVENT(text_edit, Key::A); + SEND_GUI_KEY_EVENT(Key::A); CHECK_FALSE(text_edit->get_viewport()->is_input_handled()); // Should this be handled? CHECK(text_edit->get_text() == "aA\naA"); CHECK(text_edit->get_caret_column() == 2); @@ -3024,7 +3024,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->select(0, 0, 0, 1); text_edit->select(1, 0, 1, 1, 1); - SEND_GUI_KEY_EVENT(text_edit, Key::B); + SEND_GUI_KEY_EVENT(Key::B); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "BA\nBA"); CHECK(text_edit->get_caret_column() == 1); @@ -3033,10 +3033,10 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK("text_changed", empty_signal_args); SIGNAL_CHECK("lines_edited_from", lines_edited_args); - SEND_GUI_ACTION(text_edit, "ui_text_toggle_insert_mode"); + SEND_GUI_ACTION("ui_text_toggle_insert_mode"); CHECK(text_edit->is_overtype_mode_enabled()); - SEND_GUI_KEY_EVENT(text_edit, Key::B); + SEND_GUI_KEY_EVENT(Key::B); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "BB\nBB"); CHECK(text_edit->get_caret_column() == 2); @@ -3046,7 +3046,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { text_edit->select(0, 0, 0, 1); text_edit->select(1, 0, 1, 1, 1); - SEND_GUI_KEY_EVENT(text_edit, Key::A); + SEND_GUI_KEY_EVENT(Key::A); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "AB\nAB"); CHECK(text_edit->get_caret_column() == 1); @@ -3060,7 +3060,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { lines_edited_args.remove_at(0); lines_edited_args.remove_at(1); - SEND_GUI_KEY_EVENT(text_edit, Key::TAB); + SEND_GUI_KEY_EVENT(Key::TAB); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_text() == "A\tB\nA\tB"); CHECK(text_edit->get_caret_column() == 2); @@ -3093,14 +3093,14 @@ TEST_CASE("[SceneTree][TextEdit] context menu") { CHECK_FALSE(text_edit->is_context_menu_enabled()); CHECK_FALSE(text_edit->is_menu_visible()); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(600, 10), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(600, 10), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); CHECK_FALSE(text_edit->is_menu_visible()); text_edit->set_context_menu_enabled(true); CHECK(text_edit->is_context_menu_enabled()); CHECK_FALSE(text_edit->is_menu_visible()); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(700, 10), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(700, 10), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); CHECK(text_edit->is_menu_visible()); memdelete(text_edit); @@ -3281,28 +3281,28 @@ TEST_CASE("[SceneTree][TextEdit] caret") { text_edit->set_caret_mid_grapheme_enabled(true); CHECK(text_edit->is_caret_mid_grapheme_enabled()); - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_caret_column() == 1); - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_caret_column() == 2); - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_caret_column() == 3); - SEND_GUI_ACTION(text_edit, "ui_text_caret_left"); + SEND_GUI_ACTION("ui_text_caret_left"); CHECK(text_edit->get_caret_column() == 2); text_edit->set_caret_mid_grapheme_enabled(false); CHECK_FALSE(text_edit->is_caret_mid_grapheme_enabled()); - SEND_GUI_ACTION(text_edit, "ui_text_caret_left"); + SEND_GUI_ACTION("ui_text_caret_left"); CHECK(text_edit->get_caret_column() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_caret_right"); + SEND_GUI_ACTION("ui_text_caret_right"); CHECK(text_edit->get_caret_column() == 3); - SEND_GUI_ACTION(text_edit, "ui_text_caret_left"); + SEND_GUI_ACTION("ui_text_caret_left"); CHECK(text_edit->get_caret_column() == 0); text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque."); @@ -3341,13 +3341,13 @@ TEST_CASE("[SceneTree][TextEdit] caret") { text_edit->set_move_caret_on_right_click_enabled(false); CHECK_FALSE(text_edit->is_move_caret_on_right_click_enabled()); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(100, 1), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(100, 1), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); CHECK(text_edit->get_caret_column() == caret_col); text_edit->set_move_caret_on_right_click_enabled(true); CHECK(text_edit->is_move_caret_on_right_click_enabled()); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(100, 1), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(100, 1), MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE); CHECK(text_edit->get_caret_column() != caret_col); text_edit->set_move_caret_on_right_click_enabled(false); @@ -3861,28 +3861,28 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { // Scroll. int v_scroll = text_edit->get_v_scroll(); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE); CHECK(text_edit->get_v_scroll() > v_scroll); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE); CHECK(text_edit->get_v_scroll() == v_scroll); // smooth scroll speed. text_edit->set_smooth_scroll_enabled(true); v_scroll = text_edit->get_v_scroll(); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE); text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); CHECK(text_edit->get_v_scroll() >= v_scroll); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE); text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); CHECK(text_edit->get_v_scroll() == v_scroll); v_scroll = text_edit->get_v_scroll(); text_edit->set_v_scroll_speed(10000); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE); text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); CHECK(text_edit->get_v_scroll() >= v_scroll); - SEND_GUI_MOUSE_BUTTON_EVENT(text_edit, Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE); + SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE); text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS); CHECK(text_edit->get_v_scroll() == v_scroll); @@ -3910,7 +3910,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); text_edit->grab_focus(); - SEND_GUI_ACTION(text_edit, "ui_text_scroll_down"); + SEND_GUI_ACTION("ui_text_scroll_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_first_visible_line() == 1); @@ -3919,7 +3919,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_scroll_up"); + SEND_GUI_ACTION("ui_text_scroll_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_first_visible_line() == 0); @@ -3929,7 +3929,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_caret_wrap_index() == 0); // Page down, similar to VSCode, to end of page then scroll. - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_down"); + SEND_GUI_ACTION("ui_text_caret_page_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 21); CHECK(text_edit->get_first_visible_line() == 0); @@ -3938,7 +3938,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_down"); + SEND_GUI_ACTION("ui_text_caret_page_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 41); CHECK(text_edit->get_first_visible_line() == 20); @@ -3947,7 +3947,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_up"); + SEND_GUI_ACTION("ui_text_caret_page_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 21); CHECK(text_edit->get_first_visible_line() == 20); @@ -3956,7 +3956,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_up"); + SEND_GUI_ACTION("ui_text_caret_page_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 1); CHECK(text_edit->get_first_visible_line() == 1); @@ -3969,7 +3969,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); text_edit->grab_focus(); - SEND_GUI_ACTION(text_edit, "ui_text_scroll_down"); + SEND_GUI_ACTION("ui_text_scroll_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_first_visible_line() == 2); @@ -3978,7 +3978,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_scroll_up"); + SEND_GUI_ACTION("ui_text_scroll_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_first_visible_line() == 1); @@ -3988,7 +3988,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_caret_wrap_index() == 0); // Page down, similar to VSCode, to end of page then scroll. - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_down"); + SEND_GUI_ACTION("ui_text_caret_page_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 22); CHECK(text_edit->get_first_visible_line() == 1); @@ -3997,7 +3997,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_down"); + SEND_GUI_ACTION("ui_text_caret_page_down"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 42); CHECK(text_edit->get_first_visible_line() == 21); @@ -4006,7 +4006,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_up"); + SEND_GUI_ACTION("ui_text_caret_page_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 22); CHECK(text_edit->get_first_visible_line() == 21); @@ -4015,7 +4015,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { CHECK(text_edit->get_last_full_visible_line_wrap_index() == 0); CHECK(text_edit->get_caret_wrap_index() == 0); - SEND_GUI_ACTION(text_edit, "ui_text_caret_page_up"); + SEND_GUI_ACTION("ui_text_caret_page_up"); CHECK(text_edit->get_viewport()->is_input_handled()); CHECK(text_edit->get_caret_line() == 2); CHECK(text_edit->get_first_visible_line() == 2); @@ -4031,7 +4031,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") { MessageQueue::get_singleton()->flush(); CHECK(text_edit->get_first_visible_line() == 5); - SEND_GUI_KEY_EVENT(text_edit, Key::A); + SEND_GUI_KEY_EVENT(Key::A); CHECK(text_edit->get_first_visible_line() == 0); text_edit->set_line_as_first_visible(5); diff --git a/tests/test_macros.h b/tests/test_macros.h index 80a93c8327..9fd95465f6 100644 --- a/tests/test_macros.h +++ b/tests/test_macros.h @@ -134,16 +134,16 @@ int register_test_command(String p_command, TestFunc p_function); // Utility macros to send an event actions to a given object // Requires Message Queue and InputMap to be setup. -// SEND_GUI_ACTION - takes an object and a input map key. e.g SEND_GUI_ACTION(code_edit, "ui_text_newline"). -// SEND_GUI_KEY_EVENT - takes an object and a keycode set. e.g SEND_GUI_KEY_EVENT(code_edit, Key::A | KeyModifierMask::META). -// SEND_GUI_MOUSE_BUTTON_EVENT - takes an object, position, mouse button, mouse mask and modifiers e.g SEND_GUI_MOUSE_BUTTON_EVENT(code_edit, Vector2(50, 50), MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE, Key::None); -// SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT - takes an object, position, mouse button, mouse mask and modifiers e.g SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(code_edit, Vector2(50, 50), MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE, Key::None); -// SEND_GUI_MOUSE_MOTION_EVENT - takes an object, position, mouse mask and modifiers e.g SEND_GUI_MOUSE_MOTION_EVENT(code_edit, Vector2(50, 50), MouseButtonMask::LEFT, KeyModifierMask::META); -// SEND_GUI_DOUBLE_CLICK - takes an object, position and modifiers. e.g SEND_GUI_DOUBLE_CLICK(code_edit, Vector2(50, 50), KeyModifierMask::META); +// SEND_GUI_ACTION - takes an input map key. e.g SEND_GUI_ACTION("ui_text_newline"). +// SEND_GUI_KEY_EVENT - takes a keycode set. e.g SEND_GUI_KEY_EVENT(Key::A | KeyModifierMask::META). +// SEND_GUI_MOUSE_BUTTON_EVENT - takes a position, mouse button, mouse mask and modifiers e.g SEND_GUI_MOUSE_BUTTON_EVENT(Vector2(50, 50), MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE, Key::None); +// SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT - takes a position, mouse button, mouse mask and modifiers e.g SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(Vector2(50, 50), MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE, Key::None); +// SEND_GUI_MOUSE_MOTION_EVENT - takes a position, mouse mask and modifiers e.g SEND_GUI_MOUSE_MOTION_EVENT(Vector2(50, 50), MouseButtonMask::LEFT, KeyModifierMask::META); +// SEND_GUI_DOUBLE_CLICK - takes a position and modifiers. e.g SEND_GUI_DOUBLE_CLICK(Vector2(50, 50), KeyModifierMask::META); #define _SEND_DISPLAYSERVER_EVENT(m_event) ((DisplayServerMock *)(DisplayServer::get_singleton()))->simulate_event(m_event); -#define SEND_GUI_ACTION(m_object, m_action) \ +#define SEND_GUI_ACTION(m_action) \ { \ const List<Ref<InputEvent>> *events = InputMap::get_singleton()->action_get_events(m_action); \ const List<Ref<InputEvent>>::Element *first_event = events->front(); \ @@ -153,7 +153,7 @@ int register_test_command(String p_command, TestFunc p_function); MessageQueue::get_singleton()->flush(); \ } -#define SEND_GUI_KEY_EVENT(m_object, m_input) \ +#define SEND_GUI_KEY_EVENT(m_input) \ { \ Ref<InputEventKey> event = InputEventKey::create_reference(m_input); \ event->set_pressed(true); \ @@ -167,53 +167,53 @@ int register_test_command(String p_command, TestFunc p_function); m_event->set_ctrl_pressed(((m_modifers)&KeyModifierMask::CTRL) != Key::NONE); \ m_event->set_meta_pressed(((m_modifers)&KeyModifierMask::META) != Key::NONE); -#define _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask, m_modifers) \ - Ref<InputEventMouseButton> event; \ - event.instantiate(); \ - event->set_position(m_local_pos); \ - event->set_button_index(m_input); \ - event->set_button_mask(m_mask); \ - event->set_factor(1); \ - _UPDATE_EVENT_MODIFERS(event, m_modifers); \ +#define _CREATE_GUI_MOUSE_EVENT(m_screen_pos, m_input, m_mask, m_modifers) \ + Ref<InputEventMouseButton> event; \ + event.instantiate(); \ + event->set_position(m_screen_pos); \ + event->set_button_index(m_input); \ + event->set_button_mask(m_mask); \ + event->set_factor(1); \ + _UPDATE_EVENT_MODIFERS(event, m_modifers); \ event->set_pressed(true); -#define SEND_GUI_MOUSE_BUTTON_EVENT(m_object, m_local_pos, m_input, m_mask, m_modifers) \ +#define SEND_GUI_MOUSE_BUTTON_EVENT(m_screen_pos, m_input, m_mask, m_modifers) \ + { \ + _CREATE_GUI_MOUSE_EVENT(m_screen_pos, m_input, m_mask, m_modifers); \ + _SEND_DISPLAYSERVER_EVENT(event); \ + MessageQueue::get_singleton()->flush(); \ + } + +#define SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(m_screen_pos, m_input, m_mask, m_modifers) \ { \ - _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask, m_modifers); \ + _CREATE_GUI_MOUSE_EVENT(m_screen_pos, m_input, m_mask, m_modifers); \ + event->set_pressed(false); \ _SEND_DISPLAYSERVER_EVENT(event); \ MessageQueue::get_singleton()->flush(); \ } -#define SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(m_object, m_local_pos, m_input, m_mask, m_modifers) \ - { \ - _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, m_input, m_mask, m_modifers); \ - event->set_pressed(false); \ - _SEND_DISPLAYSERVER_EVENT(event); \ - MessageQueue::get_singleton()->flush(); \ - } - -#define SEND_GUI_DOUBLE_CLICK(m_object, m_local_pos, m_modifers) \ - { \ - _CREATE_GUI_MOUSE_EVENT(m_object, m_local_pos, MouseButton::LEFT, 0, m_modifers); \ - event->set_double_click(true); \ - _SEND_DISPLAYSERVER_EVENT(event); \ - MessageQueue::get_singleton()->flush(); \ +#define SEND_GUI_DOUBLE_CLICK(m_screen_pos, m_modifers) \ + { \ + _CREATE_GUI_MOUSE_EVENT(m_screen_pos, MouseButton::LEFT, 0, m_modifers); \ + event->set_double_click(true); \ + _SEND_DISPLAYSERVER_EVENT(event); \ + MessageQueue::get_singleton()->flush(); \ } // We toggle _print_error_enabled to prevent display server not supported warnings. -#define SEND_GUI_MOUSE_MOTION_EVENT(m_object, m_local_pos, m_mask, m_modifers) \ - { \ - bool errors_enabled = CoreGlobals::print_error_enabled; \ - CoreGlobals::print_error_enabled = false; \ - Ref<InputEventMouseMotion> event; \ - event.instantiate(); \ - event->set_position(m_local_pos); \ - event->set_button_mask(m_mask); \ - event->set_relative(Vector2(10, 10)); \ - _UPDATE_EVENT_MODIFERS(event, m_modifers); \ - _SEND_DISPLAYSERVER_EVENT(event); \ - MessageQueue::get_singleton()->flush(); \ - CoreGlobals::print_error_enabled = errors_enabled; \ +#define SEND_GUI_MOUSE_MOTION_EVENT(m_screen_pos, m_mask, m_modifers) \ + { \ + bool errors_enabled = CoreGlobals::print_error_enabled; \ + CoreGlobals::print_error_enabled = false; \ + Ref<InputEventMouseMotion> event; \ + event.instantiate(); \ + event->set_position(m_screen_pos); \ + event->set_button_mask(m_mask); \ + event->set_relative(Vector2(10, 10)); \ + _UPDATE_EVENT_MODIFERS(event, m_modifers); \ + _SEND_DISPLAYSERVER_EVENT(event); \ + MessageQueue::get_singleton()->flush(); \ + CoreGlobals::print_error_enabled = errors_enabled; \ } // Utility class / macros for testing signals |