summaryrefslogtreecommitdiff
path: root/src/tests/test_texture_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_texture_manager.cc')
-rw-r--r--src/tests/test_texture_manager.cc34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/tests/test_texture_manager.cc b/src/tests/test_texture_manager.cc
index aa994cb..c25c07c 100644
--- a/src/tests/test_texture_manager.cc
+++ b/src/tests/test_texture_manager.cc
@@ -2,8 +2,6 @@
// It tests the TextureManager for procedural texture generation and management.
// Tests all public methods with both success and failure cases.
-#if !defined(STRIP_ALL) // Test code only - zero size impact on final binary
-
#include "gpu/texture_manager.h"
#include "procedural/generator.h"
#include "webgpu_test_fixture.h"
@@ -48,12 +46,12 @@ static void test_create_texture_from_data() {
// Create 4x4 red texture (RGBA8)
const int width = 4;
const int height = 4;
- uint8_t pixels[4 * 4 * 4]; // 4x4 RGBA
+ uint8_t pixels[4 * 4 * 4]; // 4x4 RGBA
for (int i = 0; i < width * height; ++i) {
- pixels[i * 4 + 0] = 255; // R
- pixels[i * 4 + 1] = 0; // G
- pixels[i * 4 + 2] = 0; // B
- pixels[i * 4 + 3] = 255; // A
+ pixels[i * 4 + 0] = 255; // R
+ pixels[i * 4 + 1] = 0; // G
+ pixels[i * 4 + 2] = 0; // B
+ pixels[i * 4 + 3] = 255; // A
}
tm.create_texture("red_texture", width, height, pixels);
@@ -84,7 +82,7 @@ static void test_create_procedural_texture() {
noise_def.width = 64;
noise_def.height = 64;
noise_def.gen_func = procedural::gen_noise;
- noise_def.params = {1234.0f, 1.0f}; // seed, frequency
+ noise_def.params = {1234.0f, 1.0f}; // seed, frequency
tm.create_procedural_texture("noise", noise_def);
@@ -137,18 +135,18 @@ static void test_multiple_textures() {
// Fill green texture
for (int i = 0; i < size * size; ++i) {
- green_pixels[i * 4 + 0] = 0; // R
- green_pixels[i * 4 + 1] = 255; // G
- green_pixels[i * 4 + 2] = 0; // B
- green_pixels[i * 4 + 3] = 255; // A
+ green_pixels[i * 4 + 0] = 0; // R
+ green_pixels[i * 4 + 1] = 255; // G
+ green_pixels[i * 4 + 2] = 0; // B
+ green_pixels[i * 4 + 3] = 255; // A
}
// Fill blue texture
for (int i = 0; i < size * size; ++i) {
- blue_pixels[i * 4 + 0] = 0; // R
- blue_pixels[i * 4 + 1] = 0; // G
- blue_pixels[i * 4 + 2] = 255; // B
- blue_pixels[i * 4 + 3] = 255; // A
+ blue_pixels[i * 4 + 0] = 0; // R
+ blue_pixels[i * 4 + 1] = 0; // G
+ blue_pixels[i * 4 + 2] = 255; // B
+ blue_pixels[i * 4 + 3] = 255; // A
}
tm.create_texture("green", size, size, green_pixels);
@@ -187,7 +185,7 @@ static void test_procedural_generation_failure() {
(void)h;
(void)params;
(void)num_params;
- return false; // Simulate failure
+ return false; // Simulate failure
};
ProceduralTextureDef failing_def;
@@ -257,5 +255,3 @@ int main() {
fprintf(stdout, "=== All TextureManager Tests Passed ===\n");
return 0;
}
-
-#endif /* !defined(STRIP_ALL) */