Merge pS-w1-t5-drop: fix drop-to-FX hotspot classifier, narrowed to tcp.fx/mcp.fx (S-VIEW-BUG-1)

This commit is contained in:
2026-07-27 13:37:58 -04:00
5 changed files with 93 additions and 23 deletions
+48
View File
@@ -105,6 +105,50 @@ static void testBase64DecodeRejectsMalformed() {
CHECK(decodeBase64("Zg==Zg==").empty()); // interior padding (pad before the final quad)
}
// --- FX-hotspot classification (S-VIEW-BUG-1) ---------------------------------
//
// THE BUG: dropping a capture onto a track's FX button (in the TCP) never armed the
// instrument drop, because the old predicate matched only "fx_" — which the SDK reserves for
// the FX CHAIN / FLOATING-FX windows. A track-panel FX-button hit reports "tcp.fx"/"mcp.fx"
// (SDK §GetThingFromPoint: "string will begin with 'tcp' or 'mcp' or 'tcp.mute' etc").
//
// THE FIX: narrow to two documented FX-bearing surfaces:
// * "tcp.fx" / "mcp.fx" — the TCP/MCP FX button (exact token, NOT bare tcp/mcp)
// * "fx_*" — the FX-chain / floating-FX windows (prefix, as before)
// Bare "tcp"/"mcp" and any other "tcp.*"/"mcp.*" sub-element (e.g. "tcp.mute", "tcp.vol")
// are non-FX track-panel regions — an instrument drop must NOT fire there.
// The TCP/MCP FX button specifically — the surface that arms an instrument drop (S-VIEW-BUG-1
// fix). Under the old "fx_"-only predicate these returned false — the exact miss that produced
// the "drops as audio to arrange" symptom on the FX button.
static void testTcpMcpFxButtonIsHotspot() {
CHECK(infoNamesFxHotspot("tcp.fx")); // TCP FX button (SDK token)
CHECK(infoNamesFxHotspot("mcp.fx")); // MCP FX area (SDK token)
}
// The FX chain / floating-FX windows (the surfaces the ORIGINAL predicate matched) still
// classify as hotspots — the fix does not regress the "fx_" surface.
static void testFxWindowStillHotspot() {
CHECK(infoNamesFxHotspot("fx_chain")); // FX chain window
CHECK(infoNamesFxHotspot("fx_0")); // first FX, floating
CHECK(infoNamesFxHotspot("fx_12")); // arbitrary floating-FX index
}
// Non-FX surfaces are NOT hotspots — a drop here is not an instrument drop (it would fall
// through to the OS drag / no-op). This includes the bare TCP/MCP tokens and all non-FX
// "tcp.*"/"mcp.*" sub-elements (e.g. mute button, volume fader, track name, meter).
static void testNonFxSurfacesAreNotHotspot() {
CHECK(!infoNamesFxHotspot("tcp")); // bare track control panel — NOT an FX hotspot
CHECK(!infoNamesFxHotspot("mcp")); // bare mixer control panel — NOT an FX hotspot
CHECK(!infoNamesFxHotspot("tcp.mute")); // mute button — track panel, not FX
CHECK(!infoNamesFxHotspot("tcp.vol")); // volume fader — track panel, not FX
CHECK(!infoNamesFxHotspot("arrange"));
CHECK(!infoNamesFxHotspot("spacer_0"));
CHECK(!infoNamesFxHotspot("")); // pointer over nothing REAPER classifies
CHECK(!infoNamesFxHotspot("trans")); // transport
CHECK(!infoNamesFxHotspot("envcp")); // envelope control panel — a track thing, not FX
}
int main() {
testBlobRoundTripsThroughInstrumentReader();
testGuidLikeIdRoundTrips();
@@ -114,6 +158,10 @@ int main() {
testBase64RoundTripAllBytes();
testBase64DecodeRejectsMalformed();
testTcpMcpFxButtonIsHotspot();
testFxWindowStillHotspot();
testNonFxSurfacesAreNotHotspot();
if (g_fail == 0) std::printf("All tests passed.\n");
return g_fail ? 1 : 0;
}