From 2fd58be11246772dd50ede6188a4ab960e6ffc0e Mon Sep 17 00:00:00 2001 From: skal Date: Fri, 13 Feb 2026 13:28:02 +0100 Subject: Add test asset support with STRIP_ALL guards Fixes test_assets.cc compilation by adding missing test asset IDs and procedural generators. Test-specific code is protected with DEMO_STRIP_ALL to exclude from release builds. Co-Authored-By: Claude Sonnet 4.5 --- src/procedural/generator.cc | 14 ++++++++++++++ src/procedural/generator.h | 10 ++++++++++ src/util/asset_manager.cc | 4 ++++ 3 files changed, 28 insertions(+) (limited to 'src') diff --git a/src/procedural/generator.cc b/src/procedural/generator.cc index 18ad133..7c165db 100644 --- a/src/procedural/generator.cc +++ b/src/procedural/generator.cc @@ -191,4 +191,18 @@ bool make_periodic(uint8_t* buffer, int w, int h, const float* params, return true; } +#if !defined(DEMO_STRIP_ALL) +// Test-only: 256x256 noise generator +bool gen_noise_256(uint8_t* buffer, int w, int h, const float* params, + int num_params) { + return gen_noise(buffer, w, h, params, num_params); +} + +// Test-only: Failing generator +bool gen_fail(uint8_t* buffer, int w, int h, const float* params, + int num_params) { + return false; +} +#endif + } // namespace procedural diff --git a/src/procedural/generator.h b/src/procedural/generator.h index e57ef61..96d7651 100644 --- a/src/procedural/generator.h +++ b/src/procedural/generator.h @@ -38,4 +38,14 @@ bool gen_grid(uint8_t* buffer, int w, int h, const float* params, bool make_periodic(uint8_t* buffer, int w, int h, const float* params, int num_params); +#if !defined(DEMO_STRIP_ALL) +// Test-only: 256x256 noise generator +bool gen_noise_256(uint8_t* buffer, int w, int h, const float* params, + int num_params); + +// Test-only: Failing generator +bool gen_fail(uint8_t* buffer, int w, int h, const float* params, + int num_params); +#endif + } // namespace procedural diff --git a/src/util/asset_manager.cc b/src/util/asset_manager.cc index 5067ebe..274f0f9 100644 --- a/src/util/asset_manager.cc +++ b/src/util/asset_manager.cc @@ -28,6 +28,10 @@ static const ProcGenEntry kAssetManagerProcGenFuncs[] = { {"gen_perlin", procedural::gen_perlin}, {"gen_grid", procedural::gen_grid}, {"make_periodic", procedural::make_periodic}, +#if !defined(DEMO_STRIP_ALL) + {"gen_noise_256", procedural::gen_noise_256}, + {"gen_fail", procedural::gen_fail}, +#endif }; static const size_t kNumProcGenFuncs = sizeof(kAssetManagerProcGenFuncs) / sizeof(kAssetManagerProcGenFuncs[0]); -- cgit v1.2.3