Merge Θ-W1-T2: fix drag-out audio loss and FX-container drops, re-home ingest

This commit is contained in:
2026-07-30 08:44:49 -04:00
18 changed files with 293 additions and 55 deletions
+36
View File
@@ -221,6 +221,38 @@ static void testMixedTallies() {
CHECK(l.skippedDuplicate == 1);
}
// --- OS hand-off ordering -----------------------------------------------------
//
// The empty-payload teardown regression: the shell used to wind its internal drag down
// (release capture, clear drag state) BEFORE checking whether the payload had resolved to any
// on-disk file. For an unresolvable payload, initiateDragOut is never reached — no OS drop
// happens at all — but the teardown ran anyway, so the drag just silently stopped mid-gesture
// with no highlight and no drop. The user has to press and start an entirely new drag; retrying
// the SAME stale selection resolves to the same empty payload and fails identically. These pin
// the fix: the two side effects (teardown, hand-off) are one decision.
// Nothing draggable -> hand off nothing AND keep the internal drag alive.
static void testEmptyPathsHandsOffNothingAndKeepsInternalDrag() {
const OsHandoff h = decideOsHandoff({});
CHECK(!h.handOffToOs);
}
// A resolvable payload -> hand off (release the internal drag, then start the OS drag).
static void testResolvablePayloadHandsOff() {
const OsHandoff one = decideOsHandoff({"C:/proj/bank/a.wav"});
CHECK(one.handOffToOs);
const OsHandoff many = decideOsHandoff({"a.wav", "b.wav", "c.wav"});
CHECK(many.handOffToOs);
}
// End to end through the assembler: a selection whose every entry is stale/unresolvable
// yields the keep-the-drag verdict, which is exactly the case the shell used to mishandle.
static void testAllSkippedSelectionKeepsInternalDrag() {
const PathList l = assemblePathList({missing("g1.wav"), unresolved()});
const OsHandoff h = decideOsHandoff(l.paths);
CHECK(!h.handOffToOs);
}
int main() {
testInsidePanelStaysInternal();
testLeavingClientAreaIsOsDrag();
@@ -244,6 +276,10 @@ int main() {
testAllSkippedYieldsEmpty();
testMixedTallies();
testEmptyPathsHandsOffNothingAndKeepsInternalDrag();
testResolvablePayloadHandsOff();
testAllSkippedSelectionKeepsInternalDrag();
if (g_fail == 0) std::printf("All tests passed.\n");
return g_fail ? 1 : 0;
}
+49
View File
@@ -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;
}