Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix `tests/core/io/test_image.cpp` tests failing when the `exr` module is disabled

Synzorasized8ee8aa346fc
diff --git a/tests/core/io/test_image.cpp b/tests/core/io/test_image.cpp
index ec074758aee..78d42af4c0a 100644
--- a/tests/core/io/test_image.cpp
+++ b/tests/core/io/test_image.cpp
@@ -36,7 +36,7 @@ TEST_FORCE_LINK(test_image)
#include "core/io/image.h"
#include "tests/test_utils.h"
-#include "modules/modules_enabled.gen.h" // For bmp, jpg, svg, webp, tga.
+#include "modules/modules_enabled.gen.h" // For bmp, jpg, svg, webp, tga, exr.
namespace TestImage {
@@ -80,9 +80,9 @@ TEST_CASE("[Image] Instantiation") {
TEST_CASE("[Image] Saving and loading") {
Ref<Image> image = memnew(Image(4, 4, false, Image::FORMAT_RGBA8));
const String save_path_png = TestUtils::get_temp_path("image.png");
-#ifdef TOOLS_ENABLED
+#ifdef MODULE_TINYEXR_ENABLED
const String save_path_exr = TestUtils::get_temp_path("image.exr");
-#endif // TOOLS_ENABLED
+#endif // MODULE_TINYEXR_ENABLED
// Save PNG
Error err;
@@ -92,13 +92,13 @@ TEST_CASE("[Image] Saving and loading") {
"The image should be saved successfully as a .png file.");
// Only available on editor builds.
-#ifdef TOOLS_ENABLED
+#ifdef MODULE_TINYEXR_ENABLED
// Save EXR
err = image->save_exr(save_path_exr, false);
CHECK_MESSAGE(
err == OK,
"The image should be saved successfully as an .exr file.");
-#endif // TOOLS_ENABLED
+#endif // MODULE_TINYEXR_ENABLED
// Load using load()
Ref<Image> image_load = memnew(Image());
@@ -123,7 +123,7 @@ TEST_CASE("[Image] Saving and loading") {
"The BMP image should load successfully.");
#endif // MODULE_BMP_ENABLED
-#ifdef MODULE_EXR_ENABLED
+#ifdef MODULE_TINYEXR_ENABLED
// Load EXR
Ref<Image> image_exr;
image_exr.instantiate();
@@ -135,7 +135,7 @@ TEST_CASE("[Image] Saving and loading") {
CHECK_MESSAGE(
image_exr->load_exr_from_buffer(data_exr) == OK,
"The EXR image should load successfully.");
-#endif // MODULE_EXR_ENABLED
+#endif // MODULE_TINYEXR_ENABLED
#ifdef MODULE_JPG_ENABLED
// Load JPG
diff --git a/tests/data/images/icon.exr b/tests/data/images/icon.exr
index 980a5454f6b..6c0be455f90 100644
Binary files a/tests/data/images/icon.exr and b/tests/data/images/icon.exr differ