diff options
| -rw-r--r-- | TODO.md | 2 | ||||
| -rw-r--r-- | cmake/DemoTests.cmake | 5 | ||||
| -rw-r--r-- | src/tests/assets/test_sequence.cc | 187 |
3 files changed, 0 insertions, 194 deletions
@@ -27,8 +27,6 @@ Reduce weights from f16 (~3.2 KB) to i8 (~1.6 KB). **Outstanding TODOs:** -1. **test_sequence.cc** - Port legacy sequence tests (currently disabled) - - Lines 168, 173, 182: Re-enable lifecycle and simulation tests after port 2. **test_audio_engine.cc:152** - Re-enable commented test after debugging diff --git a/cmake/DemoTests.cmake b/cmake/DemoTests.cmake index 26bce8c..0b7fbb7 100644 --- a/cmake/DemoTests.cmake +++ b/cmake/DemoTests.cmake @@ -101,11 +101,6 @@ target_link_libraries(test_assets PRIVATE util procedural ${DEMO_LIBS}) demo_add_asset_deps(test_assets test) set_source_files_properties(src/tests/assets/test_assets.cc PROPERTIES COMPILE_DEFINITIONS "USE_TEST_ASSETS") -# Disabled: Old v1 sequence system test -# add_demo_test(test_sequence SequenceSystemTest assets src/tests/assets/test_sequence.cc ${GEN_DEMO_CC} ${GENERATED_TIMELINE_CC} ${PLATFORM_SOURCES}) -# target_link_libraries(test_sequence PRIVATE 3d gpu util procedural ${DEMO_LIBS}) -# demo_add_asset_deps(test_sequence all) -# add_dependencies(test_sequence generate_timeline) add_demo_test(test_procedural ProceduralGenTest util src/tests/util/test_procedural.cc) target_link_libraries(test_procedural PRIVATE procedural ${DEMO_LIBS}) diff --git a/src/tests/assets/test_sequence.cc b/src/tests/assets/test_sequence.cc deleted file mode 100644 index 8de9eca..0000000 --- a/src/tests/assets/test_sequence.cc +++ /dev/null @@ -1,187 +0,0 @@ -// This file is part of the 64k demo project. -// It tests the Sequence and Effect management system. -// TODO: Port to v2 (currently disabled - uses v1 Effect/MainSequence) - -#include <stdio.h> - -#if 0 // Disabled until v2 port -#include "gpu/demo_effects.h" -#include "gpu/gpu.h" -#include <assert.h> -#include <stdio.h> -#include <string.h> - -// --- Dummy WebGPU Objects --- -static WGPUDevice dummy_device = (WGPUDevice)1; -static WGPUQueue dummy_queue = (WGPUQueue)1; -static WGPUTextureFormat dummy_format = (WGPUTextureFormat)1; -static const GpuContext dummy_ctx = {dummy_device, dummy_queue, dummy_format}; -static WGPUSurface dummy_surface = (WGPUSurface)1; -static WGPUCommandEncoder dummy_encoder = (WGPUCommandEncoder)1; -static WGPURenderPassEncoder dummy_render_pass_encoder = - (WGPURenderPassEncoder)1; - -// --- Dummy Effect for Tracking --- -class DummyEffect : public Effect { - public: - int init_calls = 0; - int start_calls = 0; - int render_calls = 0; - int end_calls = 0; - bool is_pp = false; - - DummyEffect(const GpuContext& ctx, bool post_process = false) - : Effect(ctx), is_pp(post_process) { - } - - void init(MainSequence* demo) override { - ++init_calls; - (void)demo; - } - void start() override { - ++start_calls; - } - void render(WGPURenderPassEncoder pass, - const UniformsSequenceParams& uniforms) override { - ++render_calls; - (void)pass; - (void)uniforms; - } - void compute(WGPUCommandEncoder encoder, - const UniformsSequenceParams& uniforms) override { - (void)encoder; - (void)uniforms; - } - void end() override { - ++end_calls; - } - bool is_post_process() const override { - return is_pp; - } -}; - -// --- Dummy PostProcessEffect for Tracking (unused in simplified tests) --- -class DummyPostProcessEffect : public PostProcessEffect { - public: - int init_calls = 0; - int render_calls = 0; - int update_bind_group_calls = 0; - - DummyPostProcessEffect(const GpuContext& ctx) : PostProcessEffect(ctx) { - } - - void init(MainSequence* demo) override { - ++init_calls; - (void)demo; - } - void render(WGPURenderPassEncoder pass, - const UniformsSequenceParams& uniforms) override { - ++render_calls; - (void)pass; - (void)uniforms; - } - void update_bind_group(WGPUTextureView input_view) override { - ++update_bind_group_calls; - (void)input_view; - } -}; - -// --- Test Cases --- - -void test_effect_lifecycle() { - printf(" test_effect_lifecycle...\n"); - MainSequence main_seq; - main_seq.init_test(dummy_ctx); - - auto effect1 = std::make_shared<DummyEffect>(dummy_ctx); - auto seq1 = std::make_shared<Sequence>(); - seq1->add_effect(effect1, 1.0f, 3.0f); - main_seq.add_sequence(seq1, 0.0f, 0); - - // Before effect starts - main_seq.render_frame(0.5f, 0, 0, 0, 1.0f, - dummy_surface); // This will still call real render, but - // test counts only init - assert(effect1->init_calls == 1); - assert(effect1->start_calls == 0); - assert(effect1->render_calls == 0); - assert(effect1->end_calls == 0); - - // Effect starts - main_seq.render_frame(1.0f, 0, 0, 0, 1.0f, dummy_surface); - assert(effect1->start_calls == 1); - // assert(effect1->render_calls == 1); // No longer checking render calls - // directly from here - assert(effect1->end_calls == 0); - - // During effect - main_seq.render_frame(2.0f, 0, 0, 0, 1.0f, dummy_surface); - assert(effect1->start_calls == 1); - // assert(effect1->render_calls == 2); - assert(effect1->end_calls == 0); - - // Effect ends - main_seq.render_frame(3.0f, 0, 0, 0, 1.0f, dummy_surface); - assert(effect1->start_calls == 1); - // assert(effect1->render_calls == 2); // Render not called on end frame - assert(effect1->end_calls == 1); - - // After effect ends - main_seq.render_frame(3.5f, 0, 0, 0, 1.0f, dummy_surface); - assert(effect1->start_calls == 1); - // assert(effect1->render_calls == 2); - assert(effect1->end_calls == 1); -} - -void test_simulate_until() { -#if !defined(STRIP_ALL) - printf(" test_simulate_until...\n"); - MainSequence main_seq; - main_seq.init_test(dummy_ctx); - - auto effect1 = std::make_shared<DummyEffect>(dummy_ctx); - auto seq1 = std::make_shared<Sequence>(); - seq1->add_effect(effect1, 1.0f, 3.0f); - main_seq.add_sequence(seq1, 0.0f, 0); - - main_seq.simulate_until(2.5f, 1.0f / 60.0f); - - assert(effect1->init_calls == 1); - assert(effect1->start_calls == 1); - assert(effect1->render_calls == - 0); // Render should not be called in simulate_until - assert(effect1->end_calls == 0); - - main_seq.simulate_until(3.5f, 1.0f / 60.0f); - assert(effect1->init_calls == 1); - assert(effect1->start_calls == 1); - assert(effect1->render_calls == 0); - assert(effect1->end_calls == 1); // Should end -#else - printf(" test_simulate_until (skipped in STRIP_ALL build)...\\n"); -#endif /* !defined(STRIP_ALL) */ -} - -int main() { - printf("Running Sequence/Effect System tests...\n"); - - // TODO: Re-enable and fix test_effect_lifecycle once GPU resource mocking is - // robust. - - // test_effect_lifecycle(); - - // TODO: Re-enable and fix test_simulate_until once GPU resource mocking is - // robust. - - // test_simulate_until(); - - printf("Sequence/Effect System tests PASSED\n"); - - return 0; -} -#else // v2 port TODO -int main() { - printf("test_sequence: SKIPPED (needs v2 port)\n"); - return 0; -} -#endif
\ No newline at end of file |
