summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-07-17 12:14:00 +0200
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-07-18 15:17:28 +0200
commit832695eb2c9efccf7844097d8b0254c2993b8392 (patch)
treeac4be2a7625d4d15f3adb0968267012fc575d886 /tests
parent6b5825a0cb13494d2d26a72f59a81399a7209461 (diff)
downloadredot-engine-832695eb2c9efccf7844097d8b0254c2993b8392.tar.gz
[Tests] Fix various unit tests on minimal builds
Diffstat (limited to 'tests')
-rw-r--r--tests/core/io/test_http_client.h4
-rw-r--r--tests/core/io/test_image.h10
-rw-r--r--tests/scene/test_graph_node.h2
-rw-r--r--tests/test_main.cpp23
4 files changed, 31 insertions, 8 deletions
diff --git a/tests/core/io/test_http_client.h b/tests/core/io/test_http_client.h
index 96a7735d03..961c653a0a 100644
--- a/tests/core/io/test_http_client.h
+++ b/tests/core/io/test_http_client.h
@@ -35,6 +35,8 @@
#include "tests/test_macros.h"
+#include "modules/modules_enabled.gen.h"
+
namespace TestHTTPClient {
TEST_CASE("[HTTPClient] Instantiation") {
@@ -90,6 +92,7 @@ TEST_CASE("[HTTPClient] verify_headers") {
ERR_PRINT_ON;
}
+#if defined(MODULE_MBEDTLS_ENABLED) || defined(WEB_ENABLED)
TEST_CASE("[HTTPClient] connect_to_host") {
Ref<HTTPClient> client = HTTPClient::create();
String host = "https://www.example.com";
@@ -100,6 +103,7 @@ TEST_CASE("[HTTPClient] connect_to_host") {
Error err = client->connect_to_host(host, port, tls_options);
CHECK_MESSAGE(err == OK, "Expected OK for successful connection");
}
+#endif // MODULE_MBEDTLS_ENABLED || WEB_ENABLED
} // namespace TestHTTPClient
diff --git a/tests/core/io/test_image.h b/tests/core/io/test_image.h
index 1b51286a9f..09b2e8cf29 100644
--- a/tests/core/io/test_image.h
+++ b/tests/core/io/test_image.h
@@ -37,6 +37,8 @@
#include "tests/test_utils.h"
#include "thirdparty/doctest/doctest.h"
+#include "modules/modules_enabled.gen.h"
+
namespace TestImage {
TEST_CASE("[Image] Instantiation") {
@@ -107,6 +109,7 @@ TEST_CASE("[Image] Saving and loading") {
image->get_data() == image_load->get_data(),
"The loaded image should have the same data as the one that got saved.");
+#ifdef MODULE_BMP_ENABLED
// Load BMP
Ref<Image> image_bmp = memnew(Image());
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") {
CHECK_MESSAGE(
image_bmp->load_bmp_from_buffer(data_bmp) == OK,
"The BMP image should load successfully.");
+#endif // MODULE_BMP_ENABLED
+#ifdef MODULE_JPG_ENABLED
// Load JPG
Ref<Image> image_jpg = memnew(Image());
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") {
CHECK_MESSAGE(
image_jpg->load_jpg_from_buffer(data_jpg) == OK,
"The JPG image should load successfully.");
+#endif // MODULE_JPG_ENABLED
+#ifdef MODULE_WEBP_ENABLED
// Load WebP
Ref<Image> image_webp = memnew(Image());
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") {
CHECK_MESSAGE(
image_webp->load_webp_from_buffer(data_webp) == OK,
"The WebP image should load successfully.");
+#endif // MODULE_WEBP_ENABLED
// Load PNG
Ref<Image> image_png = memnew(Image());
@@ -151,6 +159,7 @@ TEST_CASE("[Image] Saving and loading") {
image_png->load_png_from_buffer(data_png) == OK,
"The PNG image should load successfully.");
+#ifdef MODULE_TGA_ENABLED
// Load TGA
Ref<Image> image_tga = memnew(Image());
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") {
CHECK_MESSAGE(
image_tga->load_tga_from_buffer(data_tga) == OK,
"The TGA image should load successfully.");
+#endif // MODULE_TGA_ENABLED
}
TEST_CASE("[Image] Basic getters") {
diff --git a/tests/scene/test_graph_node.h b/tests/scene/test_graph_node.h
index 72b8b682c9..bf6cc9be09 100644
--- a/tests/scene/test_graph_node.h
+++ b/tests/scene/test_graph_node.h
@@ -42,7 +42,7 @@ TEST_CASE("[GraphNode][SceneTree]") {
SUBCASE("[GraphNode] Graph Node only child on delete should not cause error.") {
// Setup.
GraphNode *test_node = memnew(GraphNode);
- test_child->set_name("Graph Node");
+ test_node->set_name("Graph Node");
Control *test_child = memnew(Control);
test_child->set_name("child");
test_node->add_child(test_child);
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 3c875797a4..ddbf2f50e4 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -30,6 +30,8 @@
#include "test_main.h"
+#include "modules/modules_enabled.gen.h"
+
#ifdef TOOLS_ENABLED
#include "editor/editor_paths.h"
#include "editor/editor_settings.h"
@@ -103,8 +105,6 @@
#include "tests/scene/test_audio_stream_wav.h"
#include "tests/scene/test_bit_map.h"
#include "tests/scene/test_camera_2d.h"
-#include "tests/scene/test_code_edit.h"
-#include "tests/scene/test_color_picker.h"
#include "tests/scene/test_control.h"
#include "tests/scene/test_curve.h"
#include "tests/scene/test_curve_2d.h"
@@ -118,7 +118,6 @@
#include "tests/scene/test_packed_scene.h"
#include "tests/scene/test_path_2d.h"
#include "tests/scene/test_sprite_frames.h"
-#include "tests/scene/test_text_edit.h"
#include "tests/scene/test_theme.h"
#include "tests/scene/test_timer.h"
#include "tests/scene/test_viewport.h"
@@ -128,19 +127,29 @@
#include "tests/servers/test_text_server.h"
#include "tests/test_validate_testing.h"
+#ifndef ADVANCED_GUI_DISABLED
+#include "tests/scene/test_code_edit.h"
+#include "tests/scene/test_color_picker.h"
+#include "tests/scene/test_graph_node.h"
+#include "tests/scene/test_text_edit.h"
+#endif // ADVANCED_GUI_DISABLED
+
#ifndef _3D_DISABLED
-#include "tests/scene/test_arraymesh.h"
-#include "tests/scene/test_camera_3d.h"
+#ifdef MODULE_NAVIGATION_ENABLED
#include "tests/scene/test_navigation_agent_2d.h"
#include "tests/scene/test_navigation_agent_3d.h"
#include "tests/scene/test_navigation_obstacle_2d.h"
#include "tests/scene/test_navigation_obstacle_3d.h"
#include "tests/scene/test_navigation_region_2d.h"
#include "tests/scene/test_navigation_region_3d.h"
-#include "tests/scene/test_path_3d.h"
-#include "tests/scene/test_primitives.h"
#include "tests/servers/test_navigation_server_2d.h"
#include "tests/servers/test_navigation_server_3d.h"
+#endif // MODULE_NAVIGATION_ENABLED
+
+#include "tests/scene/test_arraymesh.h"
+#include "tests/scene/test_camera_3d.h"
+#include "tests/scene/test_path_3d.h"
+#include "tests/scene/test_primitives.h"
#endif // _3D_DISABLED
#include "modules/modules_tests.gen.h"