// This file is part of the 64k demo project. // It tests all v2 demo effect classes for basic construction. // Validates that every v2 effect can be instantiated without crashes. // // MAINTENANCE REQUIREMENT: When adding a new v2 effect to demo_effects.h: // 1. Add it to the test list below // 2. Run test to verify: ./build/test_demo_effects #include "../common/webgpu_test_fixture.h" #include "gpu/demo_effects.h" #include #include #include #include // Helper: Test v2 effect construction static int test_effect(const char* name, std::shared_ptr effect) { fprintf(stdout, " Testing %s...\n", name); if (!effect) { fprintf(stderr, " ✗ Construction failed\n"); return 0; } fprintf(stdout, " ✓ %s OK\n", name); return 1; } // Test all available v2 effects static void test_effects() { fprintf(stdout, "Testing V2 effects...\n"); WebGPUTestFixture fixture; if (!fixture.init()) { fprintf(stdout, " ⚠ WebGPU unavailable - skipping test\n"); return; } std::vector>> effects = { {"Passthrough", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"GaussianBlur", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"Placeholder", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"Heptagon", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"Particles", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"RotatingCube", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"Hybrid3D", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"Flash", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, {"PeakMeter", std::make_shared( fixture.ctx(), std::vector{"source"}, std::vector{"sink"})}, }; int passed = 0; for (const auto& [name, effect] : effects) { passed += test_effect(name, effect); } fprintf(stdout, " ✓ %d/%zu V2 effects tested\n", passed, effects.size()); } int main() { fprintf(stdout, "=== Demo Effects Tests ===\n"); extern void InitShaderComposer(); InitShaderComposer(); test_effects(); fprintf(stdout, "=== All Tests Passed ===\n"); return 0; }