Skip to content

Commit 4d238b3

Browse files
committed
Merge pull request #93780 from AThousandShips/unit_test_release
[CI] Run unit tests on desktop release templates
2 parents 6b5825a + a2d16c0 commit 4d238b3

10 files changed

+52
-19
lines changed

.github/workflows/linux_builds.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,18 @@ jobs:
7474
- name: Template w/ Mono (target=template_release)
7575
cache-name: linux-template-mono
7676
target: template_release
77-
sconsflags: module_mono_enabled=yes
77+
sconsflags: module_mono_enabled=yes tests=yes
78+
bin: "./bin/godot.linuxbsd.template_release.x86_64.mono"
7879
build-mono: false
79-
tests: false
80+
tests: true
8081
artifact: true
8182

8283
- name: Minimal template (target=template_release, everything disabled)
8384
cache-name: linux-template-minimal
8485
target: template_release
85-
sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
86-
tests: false
86+
sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no tests=yes
87+
bin: "./bin/godot.linuxbsd.template_release.x86_64"
88+
tests: true
8789
artifact: true
8890

8991
steps:
@@ -174,7 +176,6 @@ jobs:
174176
with:
175177
bin: ${{ matrix.bin }}
176178

177-
# Execute unit tests for the editor
178179
- name: Unit tests
179180
if: ${{ matrix.tests }}
180181
run: |

.github/workflows/macos_builds.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ jobs:
2929
- name: Template (target=template_release)
3030
cache-name: macos-template
3131
target: template_release
32-
tests: false
33-
sconsflags: debug_symbols=no
32+
tests: true
33+
sconsflags: debug_symbols=no tests=yes
34+
bin: "./bin/godot.macos.template_release.universal"
3435

3536
steps:
3637
- uses: actions/checkout@v4
@@ -84,7 +85,6 @@ jobs:
8485
with:
8586
name: ${{ matrix.cache-name }}
8687

87-
# Execute unit tests for the editor
8888
- name: Unit tests
8989
if: ${{ matrix.tests }}
9090
run: |

.github/workflows/windows_builds.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ jobs:
3434
- name: Template (target=template_release)
3535
cache-name: windows-template
3636
target: template_release
37-
tests: false
38-
sconsflags: debug_symbols=no
37+
tests: true
38+
sconsflags: debug_symbols=no tests=yes
39+
bin: "./bin/godot.windows.template_release.x86_64.console.exe"
3940

4041
steps:
4142
- uses: actions/checkout@v4
@@ -91,7 +92,6 @@ jobs:
9192
with:
9293
name: ${{ matrix.cache-name }}
9394

94-
# Execute unit tests for the editor
9595
- name: Unit tests
9696
if: ${{ matrix.tests }}
9797
run: |

scene/gui/line_edit.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -2589,7 +2589,10 @@ void LineEdit::_bind_methods() {
25892589
ClassDB::bind_method(D_METHOD("set_secret_character", "character"), &LineEdit::set_secret_character);
25902590
ClassDB::bind_method(D_METHOD("get_secret_character"), &LineEdit::get_secret_character);
25912591
ClassDB::bind_method(D_METHOD("menu_option", "option"), &LineEdit::menu_option);
2592+
// TODO: Properly handle popups when advanced GUI is disabled.
2593+
#ifndef ADVANCED_GUI_DISABLED
25922594
ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu);
2595+
#endif // ADVANCED_GUI_DISABLED
25932596
ClassDB::bind_method(D_METHOD("is_menu_visible"), &LineEdit::is_menu_visible);
25942597
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled);
25952598
ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &LineEdit::is_context_menu_enabled);

scene/gui/menu_bar.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,10 @@ void MenuBar::_bind_methods() {
679679
ClassDB::bind_method(D_METHOD("set_menu_hidden", "menu", "hidden"), &MenuBar::set_menu_hidden);
680680
ClassDB::bind_method(D_METHOD("is_menu_hidden", "menu"), &MenuBar::is_menu_hidden);
681681

682+
// TODO: Properly handle popups when advanced GUI is disabled.
683+
#ifndef ADVANCED_GUI_DISABLED
682684
ClassDB::bind_method(D_METHOD("get_menu_popup", "menu"), &MenuBar::get_menu_popup);
685+
#endif // ADVANCED_GUI_DISABLED
683686

684687
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
685688
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_index"), "set_start_index", "get_start_index");

scene/gui/menu_button.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ bool MenuButton::_get(const StringName &p_name, Variant &r_ret) const {
173173
}
174174

175175
void MenuButton::_bind_methods() {
176+
// TODO: Properly handle popups when advanced GUI is disabled.
177+
#ifndef ADVANCED_GUI_DISABLED
176178
ClassDB::bind_method(D_METHOD("get_popup"), &MenuButton::get_popup);
179+
#endif // ADVANCED_GUI_DISABLED
177180
ClassDB::bind_method(D_METHOD("show_popup"), &MenuButton::show_popup);
178181
ClassDB::bind_method(D_METHOD("set_switch_on_hover", "enable"), &MenuButton::set_switch_on_hover);
179182
ClassDB::bind_method(D_METHOD("is_switch_on_hover"), &MenuButton::is_switch_on_hover);

tests/core/io/test_http_client.h

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
#include "tests/test_macros.h"
3737

38+
#include "modules/modules_enabled.gen.h"
39+
3840
namespace TestHTTPClient {
3941

4042
TEST_CASE("[HTTPClient] Instantiation") {
@@ -90,6 +92,7 @@ TEST_CASE("[HTTPClient] verify_headers") {
9092
ERR_PRINT_ON;
9193
}
9294

95+
#if defined(MODULE_MBEDTLS_ENABLED) || defined(WEB_ENABLED)
9396
TEST_CASE("[HTTPClient] connect_to_host") {
9497
Ref<HTTPClient> client = HTTPClient::create();
9598
String host = "https://www.example.com";
@@ -100,6 +103,7 @@ TEST_CASE("[HTTPClient] connect_to_host") {
100103
Error err = client->connect_to_host(host, port, tls_options);
101104
CHECK_MESSAGE(err == OK, "Expected OK for successful connection");
102105
}
106+
#endif // MODULE_MBEDTLS_ENABLED || WEB_ENABLED
103107

104108
} // namespace TestHTTPClient
105109

tests/core/io/test_image.h

+10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#include "tests/test_utils.h"
3838
#include "thirdparty/doctest/doctest.h"
3939

40+
#include "modules/modules_enabled.gen.h"
41+
4042
namespace TestImage {
4143

4244
TEST_CASE("[Image] Instantiation") {
@@ -107,6 +109,7 @@ TEST_CASE("[Image] Saving and loading") {
107109
image->get_data() == image_load->get_data(),
108110
"The loaded image should have the same data as the one that got saved.");
109111

112+
#ifdef MODULE_BMP_ENABLED
110113
// Load BMP
111114
Ref<Image> image_bmp = memnew(Image());
112115
Ref<FileAccess> f_bmp = FileAccess::open(TestUtils::get_data_path("images/icon.bmp"), FileAccess::READ, &err);
@@ -117,7 +120,9 @@ TEST_CASE("[Image] Saving and loading") {
117120
CHECK_MESSAGE(
118121
image_bmp->load_bmp_from_buffer(data_bmp) == OK,
119122
"The BMP image should load successfully.");
123+
#endif // MODULE_BMP_ENABLED
120124

125+
#ifdef MODULE_JPG_ENABLED
121126
// Load JPG
122127
Ref<Image> image_jpg = memnew(Image());
123128
Ref<FileAccess> f_jpg = FileAccess::open(TestUtils::get_data_path("images/icon.jpg"), FileAccess::READ, &err);
@@ -128,7 +133,9 @@ TEST_CASE("[Image] Saving and loading") {
128133
CHECK_MESSAGE(
129134
image_jpg->load_jpg_from_buffer(data_jpg) == OK,
130135
"The JPG image should load successfully.");
136+
#endif // MODULE_JPG_ENABLED
131137

138+
#ifdef MODULE_WEBP_ENABLED
132139
// Load WebP
133140
Ref<Image> image_webp = memnew(Image());
134141
Ref<FileAccess> f_webp = FileAccess::open(TestUtils::get_data_path("images/icon.webp"), FileAccess::READ, &err);
@@ -139,6 +146,7 @@ TEST_CASE("[Image] Saving and loading") {
139146
CHECK_MESSAGE(
140147
image_webp->load_webp_from_buffer(data_webp) == OK,
141148
"The WebP image should load successfully.");
149+
#endif // MODULE_WEBP_ENABLED
142150

143151
// Load PNG
144152
Ref<Image> image_png = memnew(Image());
@@ -151,6 +159,7 @@ TEST_CASE("[Image] Saving and loading") {
151159
image_png->load_png_from_buffer(data_png) == OK,
152160
"The PNG image should load successfully.");
153161

162+
#ifdef MODULE_TGA_ENABLED
154163
// Load TGA
155164
Ref<Image> image_tga = memnew(Image());
156165
Ref<FileAccess> f_tga = FileAccess::open(TestUtils::get_data_path("images/icon.tga"), FileAccess::READ, &err);
@@ -161,6 +170,7 @@ TEST_CASE("[Image] Saving and loading") {
161170
CHECK_MESSAGE(
162171
image_tga->load_tga_from_buffer(data_tga) == OK,
163172
"The TGA image should load successfully.");
173+
#endif // MODULE_TGA_ENABLED
164174
}
165175

166176
TEST_CASE("[Image] Basic getters") {

tests/scene/test_graph_node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TEST_CASE("[GraphNode][SceneTree]") {
4242
SUBCASE("[GraphNode] Graph Node only child on delete should not cause error.") {
4343
// Setup.
4444
GraphNode *test_node = memnew(GraphNode);
45-
test_child->set_name("Graph Node");
45+
test_node->set_name("Graph Node");
4646
Control *test_child = memnew(Control);
4747
test_child->set_name("child");
4848
test_node->add_child(test_child);

tests/test_main.cpp

+16-7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "test_main.h"
3232

33+
#include "modules/modules_enabled.gen.h"
34+
3335
#ifdef TOOLS_ENABLED
3436
#include "editor/editor_paths.h"
3537
#include "editor/editor_settings.h"
@@ -103,8 +105,6 @@
103105
#include "tests/scene/test_audio_stream_wav.h"
104106
#include "tests/scene/test_bit_map.h"
105107
#include "tests/scene/test_camera_2d.h"
106-
#include "tests/scene/test_code_edit.h"
107-
#include "tests/scene/test_color_picker.h"
108108
#include "tests/scene/test_control.h"
109109
#include "tests/scene/test_curve.h"
110110
#include "tests/scene/test_curve_2d.h"
@@ -118,7 +118,6 @@
118118
#include "tests/scene/test_packed_scene.h"
119119
#include "tests/scene/test_path_2d.h"
120120
#include "tests/scene/test_sprite_frames.h"
121-
#include "tests/scene/test_text_edit.h"
122121
#include "tests/scene/test_theme.h"
123122
#include "tests/scene/test_timer.h"
124123
#include "tests/scene/test_viewport.h"
@@ -128,19 +127,29 @@
128127
#include "tests/servers/test_text_server.h"
129128
#include "tests/test_validate_testing.h"
130129

130+
#ifndef ADVANCED_GUI_DISABLED
131+
#include "tests/scene/test_code_edit.h"
132+
#include "tests/scene/test_color_picker.h"
133+
#include "tests/scene/test_graph_node.h"
134+
#include "tests/scene/test_text_edit.h"
135+
#endif // ADVANCED_GUI_DISABLED
136+
131137
#ifndef _3D_DISABLED
132-
#include "tests/scene/test_arraymesh.h"
133-
#include "tests/scene/test_camera_3d.h"
138+
#ifdef MODULE_NAVIGATION_ENABLED
134139
#include "tests/scene/test_navigation_agent_2d.h"
135140
#include "tests/scene/test_navigation_agent_3d.h"
136141
#include "tests/scene/test_navigation_obstacle_2d.h"
137142
#include "tests/scene/test_navigation_obstacle_3d.h"
138143
#include "tests/scene/test_navigation_region_2d.h"
139144
#include "tests/scene/test_navigation_region_3d.h"
140-
#include "tests/scene/test_path_3d.h"
141-
#include "tests/scene/test_primitives.h"
142145
#include "tests/servers/test_navigation_server_2d.h"
143146
#include "tests/servers/test_navigation_server_3d.h"
147+
#endif // MODULE_NAVIGATION_ENABLED
148+
149+
#include "tests/scene/test_arraymesh.h"
150+
#include "tests/scene/test_camera_3d.h"
151+
#include "tests/scene/test_path_3d.h"
152+
#include "tests/scene/test_primitives.h"
144153
#endif // _3D_DISABLED
145154

146155
#include "modules/modules_tests.gen.h"

0 commit comments

Comments
 (0)