// Standalone tests for reasampler::render_settings — no REAPER, no framework. // Covers the pure pieces behind the capture family: the source-mode -> // RENDER_SETTINGS bit mapping, the TailMode -> RENDER_* (tail/normalize/trim-end) // mapping + the -72 dB derived ratio + the 8 s manual clamp, P_RAZOREDITS parsing // -> ranges + union, scope -> source mode, range inference (razor-else-time), the // FX-bypass plan (corrects the "items captured through parent FX" defect), and the // capture-action taxonomy table (stable ids, scope x tail-variant matrix). #include "../src/core/capture/render_settings.h" #include #include #include #include #include using namespace reasampler; using namespace reasampler::capture; static int g_fail = 0; #define CHECK(cond) do { if(!(cond)) { \ std::printf("FAIL line %d: %s\n", __LINE__, #cond); ++g_fail; } } while(0) // --- renderSettingsFor: wet-only bit mapping --------------------------------- static void testMasterMixWet() { // Master mix -> value 0 (no source bits), supported. RenderSettingsChoice c = renderSettingsFor(SourceMode::MasterMix, 1.0); CHECK(c.settings == kRenderMasterMix); CHECK(c.supported); // TimeSelection aliases master mix — same result. CHECK(renderSettingsFor(SourceMode::TimeSelection, 1.0).settings == kRenderMasterMix); // wetDry argument is irrelevant (all three-scope capture actions are wet); passing 0.0 // must still yield the same wet master-mix bits. CHECK(renderSettingsFor(SourceMode::MasterMix, 0.0).settings == kRenderMasterMix); } static void testSelectedTracksWet() { // Selected tracks -> via master (&128), header-confirmed. RenderSettingsChoice c = renderSettingsFor(SourceMode::SelectedTracks, 1.0); CHECK(c.settings == kRenderSelTracksViaMaster); CHECK(c.supported); } static void testSelectedItemsSingleFile() { // Items render to ONE file (single-file bit set) so N items -> 1 bank entry. RenderSettingsChoice c = renderSettingsFor(SourceMode::SelectedItems, 1.0); CHECK((c.settings & kRenderSelItems) != 0); CHECK((c.settings & kRenderSingleFile) != 0); CHECK(c.supported); } static void testRazorSingleFile() { // Razor edits render to ONE file (same single-file rationale as items). RenderSettingsChoice c = renderSettingsFor(SourceMode::RazorArea, 1.0); CHECK((c.settings & kRenderRazorEdits) != 0); CHECK((c.settings & kRenderSingleFile) != 0); CHECK(c.supported); } static void testRealtimeIsUnsupportedOffline() { // The realtime mode is not an offline-render source — must report unsupported // so the offline backend refuses it rather than rendering the master mix. CHECK(!renderSettingsFor(SourceMode::Realtime, 1.0).supported); } static void testEveryRenderSourceLabelIsPinnedVerbatim() { // docs/VERIFICATION.md's short-render bullet asks Daniel to report the refusal // line back verbatim, and that line always carries the render source // (render_bounds_gate.cpp appends "Render source: