summaryrefslogtreecommitdiff
path: root/src/tests/test_effect_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_effect_base.cc')
-rw-r--r--src/tests/test_effect_base.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/tests/test_effect_base.cc b/src/tests/test_effect_base.cc
index 8180535..5dc2dcc 100644
--- a/src/tests/test_effect_base.cc
+++ b/src/tests/test_effect_base.cc
@@ -3,10 +3,10 @@
// Verifies effect initialization, activation, and basic rendering.
#include "effect_test_helpers.h"
-#include "offscreen_render_target.h"
-#include "webgpu_test_fixture.h"
#include "gpu/demo_effects.h"
#include "gpu/effect.h"
+#include "offscreen_render_target.h"
+#include "webgpu_test_fixture.h"
#include <cassert>
#include <cstdio>
#include <memory>
@@ -72,8 +72,7 @@ static void test_effect_construction() {
}
// Create FlashEffect (simple post-process effect)
- auto effect = std::make_shared<FlashEffect>(
- fixture.ctx());
+ auto effect = std::make_shared<FlashEffect>(fixture.ctx());
assert(!effect->is_initialized && "Effect should not be initialized yet");
@@ -95,8 +94,7 @@ static void test_effect_initialization() {
main_seq.init_test(fixture.ctx());
// Create FlashEffect
- auto effect = std::make_shared<FlashEffect>(
- fixture.ctx());
+ auto effect = std::make_shared<FlashEffect>(fixture.ctx());
assert(!effect->is_initialized && "Effect should not be initialized yet");
@@ -107,7 +105,8 @@ static void test_effect_initialization() {
// Initialize sequence (this sets effect->is_initialized)
seq->init(&main_seq);
- assert(effect->is_initialized && "Effect should be initialized after Sequence::init()");
+ assert(effect->is_initialized &&
+ "Effect should be initialized after Sequence::init()");
fprintf(stdout, " ✓ FlashEffect initialized via Sequence::init()\n");
}
@@ -129,10 +128,10 @@ static void test_sequence_add_effect() {
auto seq = std::make_shared<Sequence>();
// Create effect
- auto effect = std::make_shared<FlashEffect>(
- fixture.ctx());
+ auto effect = std::make_shared<FlashEffect>(fixture.ctx());
- assert(!effect->is_initialized && "Effect should not be initialized before Sequence::init()");
+ assert(!effect->is_initialized &&
+ "Effect should not be initialized before Sequence::init()");
// Add effect to sequence (time range: 0.0 - 10.0, priority 0)
seq->add_effect(effect, 0.0f, 10.0f, 0);
@@ -140,9 +139,12 @@ static void test_sequence_add_effect() {
// Initialize sequence (this should initialize the effect)
seq->init(&main_seq);
- assert(effect->is_initialized && "Effect should be initialized after Sequence::init()");
+ assert(effect->is_initialized &&
+ "Effect should be initialized after Sequence::init()");
- fprintf(stdout, " ✓ Effect added to sequence and initialized (time=0.0-10.0, priority=0)\n");
+ fprintf(stdout,
+ " ✓ Effect added to sequence and initialized (time=0.0-10.0, "
+ "priority=0)\n");
}
// Test 6: Sequence activation logic
@@ -159,8 +161,7 @@ static void test_sequence_activation() {
main_seq.init_test(fixture.ctx());
auto seq = std::make_shared<Sequence>();
- auto effect = std::make_shared<FlashEffect>(
- fixture.ctx());
+ auto effect = std::make_shared<FlashEffect>(fixture.ctx());
// Effect active from 5.0 to 10.0 seconds
seq->add_effect(effect, 5.0f, 10.0f, 0);
@@ -213,7 +214,7 @@ static void test_pixel_helpers() {
"Black frame should have no content");
std::vector<uint8_t> colored_frame(256 * 256 * 4, 0);
- colored_frame[0] = 255; // Set one red pixel
+ colored_frame[0] = 255; // Set one red pixel
assert(has_rendered_content(colored_frame, 256, 256) &&
"Colored frame should have content");
@@ -222,7 +223,7 @@ static void test_pixel_helpers() {
// Test all_pixels_match_color
std::vector<uint8_t> red_frame(256 * 256 * 4, 0);
for (size_t i = 0; i < 256 * 256; ++i) {
- red_frame[i * 4 + 2] = 255; // BGRA: Red in position 2
+ red_frame[i * 4 + 2] = 255; // BGRA: Red in position 2
}
assert(all_pixels_match_color(red_frame, 256, 256, 255, 0, 0, 5) &&
"Red frame should match red color");