Merge Θ-W1-T2: fix drag-out audio loss and FX-container drops, re-home ingest
This commit is contained in:
@@ -235,6 +235,50 @@ static void testEmbedStripIsNotHotspot() {
|
||||
CHECK(!infoNamesFxHotspot("mcp.fxembed extra"));
|
||||
}
|
||||
|
||||
// Do not reintroduce a per-surface "capture carries" loop test: buildInstrumentDropPreset takes
|
||||
// only sampleId (proven by testPresetRoundTripsThroughInstrumentReader), and per-surface hotspot
|
||||
// coverage already exists (testTcpMcpFxFamilyIsHotspot / testFxWindowStillHotspot) — a loop with
|
||||
// an identical body per surface string can't distinguish them.
|
||||
|
||||
// --- All-or-nothing rollback --------------------------------------------------
|
||||
|
||||
// The add failed: nothing was created, so there is nothing to delete and nothing loaded.
|
||||
static void testAddFailureLeavesNothingToRollBack() {
|
||||
const DropOutcome out = decideDropOutcome(DropAttempt{-1, false});
|
||||
CHECK(!out.loaded);
|
||||
CHECK(out.rollbackFxIndex < 0);
|
||||
}
|
||||
|
||||
// The instance was created but the preset did not apply: the caller MUST delete that exact
|
||||
// index — an instance without its capture is the orphan the contract forbids.
|
||||
static void testPresetFailureRollsBackTheCreatedIndex() {
|
||||
const DropOutcome zero = decideDropOutcome(DropAttempt{0, false});
|
||||
CHECK(!zero.loaded);
|
||||
CHECK(zero.rollbackFxIndex == 0);
|
||||
const DropOutcome later = decideDropOutcome(DropAttempt{4, false});
|
||||
CHECK(!later.loaded);
|
||||
CHECK(later.rollbackFxIndex == 4);
|
||||
// Container-addressed indices (0x2000000-flagged) roll back by the same rule — the
|
||||
// obligation follows the index REAPER handed back, whatever space it names.
|
||||
const DropOutcome inContainer = decideDropOutcome(DropAttempt{0x2000000 + 5, false});
|
||||
CHECK(!inContainer.loaded);
|
||||
CHECK(inContainer.rollbackFxIndex == 0x2000000 + 5);
|
||||
}
|
||||
|
||||
// Both halves succeeded: loaded, and nothing to undo.
|
||||
static void testSuccessKeepsTheInstance() {
|
||||
const DropOutcome out = decideDropOutcome(DropAttempt{2, true});
|
||||
CHECK(out.loaded);
|
||||
CHECK(out.rollbackFxIndex < 0);
|
||||
}
|
||||
|
||||
// A "preset applied" report with no instance behind it can never read as loaded.
|
||||
static void testNoInstanceIsNeverLoaded() {
|
||||
const DropOutcome out = decideDropOutcome(DropAttempt{-1, true});
|
||||
CHECK(!out.loaded);
|
||||
CHECK(out.rollbackFxIndex < 0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
testClassIdHexPinnedPerChannel();
|
||||
testPresetRoundTripsThroughInstrumentReader();
|
||||
@@ -249,6 +293,11 @@ int main() {
|
||||
testNonFxSurfacesAreNotHotspot();
|
||||
testEmbedStripIsNotHotspot();
|
||||
|
||||
testAddFailureLeavesNothingToRollBack();
|
||||
testPresetFailureRollsBackTheCreatedIndex();
|
||||
testSuccessKeepsTheInstance();
|
||||
testNoInstanceIsNeverLoaded();
|
||||
|
||||
if (g_fail == 0) std::printf("All tests passed.\n");
|
||||
return g_fail ? 1 : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user