diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-07-17 12:14:00 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-07-18 15:17:28 +0200 |
commit | 832695eb2c9efccf7844097d8b0254c2993b8392 (patch) | |
tree | ac4be2a7625d4d15f3adb0968267012fc575d886 /tests/core/io/test_image.h | |
parent | 6b5825a0cb13494d2d26a72f59a81399a7209461 (diff) | |
download | redot-engine-832695eb2c9efccf7844097d8b0254c2993b8392.tar.gz |
[Tests] Fix various unit tests on minimal builds
Diffstat (limited to 'tests/core/io/test_image.h')
-rw-r--r-- | tests/core/io/test_image.h | 10 |
1 files changed, 10 insertions, 0 deletions
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") { |