37
37
#include " tests/test_utils.h"
38
38
#include " thirdparty/doctest/doctest.h"
39
39
40
+ #include " modules/modules_enabled.gen.h"
41
+
40
42
namespace TestImage {
41
43
42
44
TEST_CASE (" [Image] Instantiation" ) {
@@ -107,6 +109,7 @@ TEST_CASE("[Image] Saving and loading") {
107
109
image->get_data () == image_load->get_data (),
108
110
" The loaded image should have the same data as the one that got saved." );
109
111
112
+ #ifdef MODULE_BMP_ENABLED
110
113
// Load BMP
111
114
Ref<Image> image_bmp = memnew (Image ());
112
115
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") {
117
120
CHECK_MESSAGE (
118
121
image_bmp->load_bmp_from_buffer (data_bmp) == OK,
119
122
" The BMP image should load successfully." );
123
+ #endif // MODULE_BMP_ENABLED
120
124
125
+ #ifdef MODULE_JPG_ENABLED
121
126
// Load JPG
122
127
Ref<Image> image_jpg = memnew (Image ());
123
128
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") {
128
133
CHECK_MESSAGE (
129
134
image_jpg->load_jpg_from_buffer (data_jpg) == OK,
130
135
" The JPG image should load successfully." );
136
+ #endif // MODULE_JPG_ENABLED
131
137
138
+ #ifdef MODULE_WEBP_ENABLED
132
139
// Load WebP
133
140
Ref<Image> image_webp = memnew (Image ());
134
141
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") {
139
146
CHECK_MESSAGE (
140
147
image_webp->load_webp_from_buffer (data_webp) == OK,
141
148
" The WebP image should load successfully." );
149
+ #endif // MODULE_WEBP_ENABLED
142
150
143
151
// Load PNG
144
152
Ref<Image> image_png = memnew (Image ());
@@ -151,6 +159,7 @@ TEST_CASE("[Image] Saving and loading") {
151
159
image_png->load_png_from_buffer (data_png) == OK,
152
160
" The PNG image should load successfully." );
153
161
162
+ #ifdef MODULE_TGA_ENABLED
154
163
// Load TGA
155
164
Ref<Image> image_tga = memnew (Image ());
156
165
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") {
161
170
CHECK_MESSAGE (
162
171
image_tga->load_tga_from_buffer (data_tga) == OK,
163
172
" The TGA image should load successfully." );
173
+ #endif // MODULE_TGA_ENABLED
164
174
}
165
175
166
176
TEST_CASE (" [Image] Basic getters" ) {
0 commit comments