Ψ-W1-T4: resolve drop targets per move, not once — every surface gets a defined outcome, a cue, and no silent no-op
This commit is contained in:
+261
-111
@@ -1,13 +1,14 @@
|
||||
// Standalone tests for reasampler::drag_out — no REAPER, no test framework. Same fast loop
|
||||
// as the sibling pure tests (mode_switch et al.): assert the gesture-
|
||||
// boundary decision and the path-list assembly directly.
|
||||
// Standalone tests for reasampler::ui::drag_out — no REAPER, no test framework. Same fast loop
|
||||
// as the sibling pure tests: assert the gesture law and the path-list assembly directly.
|
||||
//
|
||||
// Covers (M11 drag-out brief §test cases):
|
||||
// * Gesture boundary: inside-panel drag stays Internal; leaving the client area with
|
||||
// armed samples -> OsDrag; no armed samples (or not dragging) -> None; half-open edge
|
||||
// behavior; re-entry back inside returns to Internal (position-only decision).
|
||||
// * Path-list assembly: single, multi, dedupe (cross-bank copy case), skip-missing,
|
||||
// skip-unresolved, empty selection, order preservation, mixed tallies.
|
||||
// Covers:
|
||||
// * The full class matrix: every ReaperSurface x {single, multi} x {track, no track}, inside
|
||||
// and outside the client rect, plus the half-open edge and a non-zero panel origin.
|
||||
// * Reversibility and speed-independence, stated as properties: a class transition sequence
|
||||
// resolves the same forwards and backwards, and one unresolvable evaluation cannot change
|
||||
// any later evaluation's outcome.
|
||||
// * Exhaustiveness: no surface resolves to a do-nothing class, and every class has a cue.
|
||||
// * Path-list assembly + OS hand-off ordering (unchanged from before this law).
|
||||
|
||||
#include "../src/core/ui/drag_out.h"
|
||||
|
||||
@@ -22,115 +23,253 @@ static int g_fail = 0;
|
||||
#define CHECK(cond) do { if(!(cond)) { \
|
||||
std::printf("FAIL line %d: %s\n", __LINE__, #cond); ++g_fail; } } while(0)
|
||||
|
||||
// --- Gesture boundary ---------------------------------------------------------
|
||||
// --- Fixtures -----------------------------------------------------------------
|
||||
|
||||
static const PanelClientRect kPanel{0, 0, 400, 300};
|
||||
|
||||
// A drag with samples, pointer well inside the client rect -> the existing internal drag
|
||||
// (invariant #4: inside-panel drag stays internal, unchanged).
|
||||
static void testInsidePanelStaysInternal() {
|
||||
DragState s{/*dragging=*/true, /*hasArmedSamples=*/true};
|
||||
CHECK(decideGesture(200, 150, kPanel, s) == DragGesture::Internal);
|
||||
CHECK(decideGesture(0, 0, kPanel, s) == DragGesture::Internal); // top-left corner
|
||||
CHECK(decideGesture(399, 299, kPanel, s) == DragGesture::Internal); // last inside px
|
||||
// A live single-card drag over `surface`, with a track resolved unless stated otherwise.
|
||||
static DropContext ctx(ReaperSurface surface, bool single = true, bool haveTrack = true) {
|
||||
DropContext c;
|
||||
c.drag = DragState{/*dragging=*/true, /*hasArmedSamples=*/true};
|
||||
c.singlePayload = single;
|
||||
c.surface = surface;
|
||||
c.haveTrack = haveTrack;
|
||||
return c;
|
||||
}
|
||||
|
||||
// A drag with samples whose pointer has left the client rect (any edge) -> OS drag.
|
||||
static void testLeavingClientAreaIsOsDrag() {
|
||||
DragState s{/*dragging=*/true, /*hasArmedSamples=*/true};
|
||||
CHECK(decideGesture(-1, 150, kPanel, s) == DragGesture::OsDrag); // left of panel
|
||||
CHECK(decideGesture(400, 150, kPanel, s) == DragGesture::OsDrag); // right edge (x+w)
|
||||
CHECK(decideGesture(200, -5, kPanel, s) == DragGesture::OsDrag); // above
|
||||
CHECK(decideGesture(200, 300, kPanel, s) == DragGesture::OsDrag); // below (y+h)
|
||||
CHECK(decideGesture(1000, 1000, kPanel, s) == DragGesture::OsDrag);// far outside
|
||||
// Every surface the law enumerates, so the matrix tests iterate rather than list.
|
||||
static const ReaperSurface kAllSurfaces[] = {
|
||||
ReaperSurface::OffReaper, ReaperSurface::TrackPanel, ReaperSurface::FxSurface,
|
||||
ReaperSurface::FxEmbed, ReaperSurface::Arrange, ReaperSurface::Other,
|
||||
};
|
||||
|
||||
// A point comfortably outside the panel client rect.
|
||||
static const int kOutX = 500, kOutY = 150;
|
||||
|
||||
// --- Matrix: inside the client -------------------------------------------------
|
||||
|
||||
// Inside the client the drag is the bank-to-bank drag, whatever REAPER reports underneath and
|
||||
// whatever the payload size — the internal path must never be reinterpreted as an FX add or a
|
||||
// timeline insert. This is the bank-to-bank regression floor.
|
||||
static void testInsideClientIsAlwaysInternal() {
|
||||
for (ReaperSurface s : kAllSurfaces) {
|
||||
for (bool single : {true, false}) {
|
||||
CHECK(decideDropClass(200, 150, kPanel, ctx(s, single)) == DropClass::Internal);
|
||||
CHECK(decideDropClass(0, 0, kPanel, ctx(s, single)) == DropClass::Internal);
|
||||
CHECK(decideDropClass(399, 299, kPanel, ctx(s, single)) == DropClass::Internal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The half-open boundary: x+width and y+height are OUTSIDE (OsDrag), the pixel just inside
|
||||
// is Internal — matches the panel's other hit-tests so the edge is claimed consistently.
|
||||
// The half-open boundary: x+width and y+height are OUTSIDE, the pixel just inside is Internal —
|
||||
// matches the panel's other hit-tests so the edge is claimed consistently.
|
||||
static void testBoundaryHalfOpen() {
|
||||
DragState s{true, true};
|
||||
CHECK(decideGesture(399, 150, kPanel, s) == DragGesture::Internal);
|
||||
CHECK(decideGesture(400, 150, kPanel, s) == DragGesture::OsDrag);
|
||||
CHECK(decideGesture(200, 299, kPanel, s) == DragGesture::Internal);
|
||||
CHECK(decideGesture(200, 300, kPanel, s) == DragGesture::OsDrag);
|
||||
const DropContext off = ctx(ReaperSurface::OffReaper);
|
||||
CHECK(decideDropClass(399, 150, kPanel, off) == DropClass::Internal);
|
||||
CHECK(decideDropClass(400, 150, kPanel, off) == DropClass::OsHandoff);
|
||||
CHECK(decideDropClass(200, 299, kPanel, off) == DropClass::Internal);
|
||||
CHECK(decideDropClass(200, 300, kPanel, off) == DropClass::OsHandoff);
|
||||
}
|
||||
|
||||
// No armed samples -> None regardless of position (an empty-payload drag never goes to the
|
||||
// OS). Not dragging -> None even with samples (the shell asks only mid-drag, but the guard
|
||||
// is explicit).
|
||||
static void testNoDragOrNoSamplesIsNone() {
|
||||
CHECK(decideGesture(1000, 1000, kPanel, DragState{true, false}) == DragGesture::None);
|
||||
CHECK(decideGesture(200, 150, kPanel, DragState{true, false}) == DragGesture::None);
|
||||
CHECK(decideGesture(1000, 1000, kPanel, DragState{false, true}) == DragGesture::None);
|
||||
CHECK(decideGesture(200, 150, kPanel, DragState{false, false}) == DragGesture::None);
|
||||
}
|
||||
|
||||
// Re-entry: the decision is position-only, so a pointer that left (OsDrag) and came back
|
||||
// inside reads Internal again. (The shell, having handed off to the modal OS loop, simply
|
||||
// stops asking — but the pure function must not be stateful.)
|
||||
static void testReentryReturnsInternal() {
|
||||
DragState s{true, true};
|
||||
CHECK(decideGesture(500, 150, kPanel, s) == DragGesture::OsDrag); // left
|
||||
CHECK(decideGesture(200, 150, kPanel, s) == DragGesture::Internal); // re-entered
|
||||
}
|
||||
|
||||
// A non-zero panel origin (the client rect need not sit at 0,0) — the boundary tracks the
|
||||
// rect, not the absolute axes.
|
||||
// A non-zero panel origin — the boundary tracks the rect, not the absolute axes.
|
||||
static void testOffsetPanelRect() {
|
||||
PanelClientRect p{50, 20, 100, 80}; // spans x[50,150) y[20,100)
|
||||
DragState s{true, true};
|
||||
CHECK(decideGesture(100, 60, p, s) == DragGesture::Internal);
|
||||
CHECK(decideGesture(49, 60, p, s) == DragGesture::OsDrag); // just left of origin
|
||||
CHECK(decideGesture(150, 60, p, s) == DragGesture::OsDrag); // x+width
|
||||
CHECK(decideGesture(100, 19, p, s) == DragGesture::OsDrag); // just above origin
|
||||
const PanelClientRect p{50, 20, 100, 80}; // spans x[50,150) y[20,100)
|
||||
const DropContext off = ctx(ReaperSurface::OffReaper);
|
||||
CHECK(decideDropClass(100, 60, p, off) == DropClass::Internal);
|
||||
CHECK(decideDropClass(49, 60, p, off) == DropClass::OsHandoff);
|
||||
CHECK(decideDropClass(150, 60, p, off) == DropClass::OsHandoff);
|
||||
CHECK(decideDropClass(100, 19, p, off) == DropClass::OsHandoff);
|
||||
}
|
||||
|
||||
// --- S17 InstrumentDrop gesture (single-capture over REAPER UI) ---------------
|
||||
//
|
||||
// M11 REGRESSION GUARD (load-bearing): every M11 case above uses DragState{true, true},
|
||||
// which leaves singleCapture=overReaperUi=false — so an M11-era payload outside the client
|
||||
// rect still decides OsDrag exactly as before. The tests above ARE the M11 non-regression
|
||||
// proof; these add the new middle case.
|
||||
// --- Matrix: outside the client, single card -----------------------------------
|
||||
|
||||
// A SINGLE-capture drag that has left the panel but is still over REAPER's own UI is an
|
||||
// instrument drop (heading for a track's FX button), NOT an OS drag.
|
||||
static void testSingleCaptureOverReaperUiIsInstrumentDrop() {
|
||||
DragState s{/*dragging=*/true, /*hasArmedSamples=*/true,
|
||||
/*singleCapture=*/true, /*overReaperUi=*/true};
|
||||
CHECK(decideGesture(500, 150, kPanel, s) == DragGesture::InstrumentDrop); // right of panel
|
||||
CHECK(decideGesture(-5, 150, kPanel, s) == DragGesture::InstrumentDrop); // left of panel
|
||||
CHECK(decideGesture(200, 400, kPanel, s) == DragGesture::InstrumentDrop); // below
|
||||
// A single card over a track's panel loads the instrument — the WHOLE panel, which is the
|
||||
// root-cause fix: a TCP too narrow to draw the FX button used to yield a cue-less no-op.
|
||||
static void testSingleOverTrackPanelIsInstrumentDrop() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::TrackPanel)) ==
|
||||
DropClass::InstrumentDrop);
|
||||
CHECK(decideDropClass(-5, kOutY, kPanel, ctx(ReaperSurface::TrackPanel)) ==
|
||||
DropClass::InstrumentDrop);
|
||||
CHECK(decideDropClass(200, 400, kPanel, ctx(ReaperSurface::TrackPanel)) ==
|
||||
DropClass::InstrumentDrop);
|
||||
}
|
||||
|
||||
// InstrumentDrop is an OUTSIDE-only refinement: the same single-capture state INSIDE the
|
||||
// client rect is still the unchanged Internal bank-to-bank drag (invariant #4).
|
||||
static void testSingleCaptureInsidePanelStaysInternal() {
|
||||
DragState s{true, true, /*singleCapture=*/true, /*overReaperUi=*/true};
|
||||
CHECK(decideGesture(200, 150, kPanel, s) == DragGesture::Internal);
|
||||
// The FX chain / floating-FX windows keep their existing outcome.
|
||||
static void testSingleOverFxSurfaceIsInstrumentDrop() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::FxSurface)) ==
|
||||
DropClass::InstrumentDrop);
|
||||
}
|
||||
|
||||
// A single-capture drag that has left REAPER ENTIRELY (overReaperUi=false) falls through to
|
||||
// OsDrag — the M11 OS drag-out to Explorer/another DAW, unchanged. This is the boundary
|
||||
// refinement's other half: leaving the client rect no longer immediately means OS-bound.
|
||||
static void testSingleCaptureOffReaperIsOsDrag() {
|
||||
DragState s{true, true, /*singleCapture=*/true, /*overReaperUi=*/false};
|
||||
CHECK(decideGesture(500, 150, kPanel, s) == DragGesture::OsDrag);
|
||||
// The embed strip is where an instance ALREADY draws: dropping there must not stack a second,
|
||||
// so it refuses rather than instantiating.
|
||||
static void testSingleOverFxEmbedRefuses() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::FxEmbed)) ==
|
||||
DropClass::Refuse);
|
||||
}
|
||||
|
||||
// A MULTI-capture drag over REAPER's UI is REJECTED for InstrumentDrop (the S17 open-question
|
||||
// lean): it is NOT a single instrument placement, so it falls through to OsDrag even while
|
||||
// over REAPER's UI — the multi-file drag-out is the natural gesture for a multi payload.
|
||||
static void testMultiCaptureOverReaperUiIsOsDrag() {
|
||||
DragState s{true, true, /*singleCapture=*/false, /*overReaperUi=*/true};
|
||||
CHECK(decideGesture(500, 150, kPanel, s) == DragGesture::OsDrag);
|
||||
// THE HEADLINE DEFECT: a single card over the arrange places a timeline item. It used to lock
|
||||
// to InstrumentDrop on the first move outside the client and then release into nothing.
|
||||
static void testSingleOverArrangeIsArrangeInsert() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::Arrange)) ==
|
||||
DropClass::ArrangeInsert);
|
||||
}
|
||||
|
||||
// Not-dragging / no-armed-samples still short-circuits to None regardless of the S17 fields.
|
||||
static void testS17FieldsIgnoredWhenNotDragging() {
|
||||
CHECK(decideGesture(500, 150, kPanel,
|
||||
DragState{false, true, true, true}) == DragGesture::None);
|
||||
CHECK(decideGesture(500, 150, kPanel,
|
||||
DragState{true, false, true, true}) == DragGesture::None);
|
||||
// Ruler / transport / docker chrome / any token REAPER adds later: a defined refusal.
|
||||
static void testSingleOverOtherReaperUiRefuses() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::Other)) == DropClass::Refuse);
|
||||
}
|
||||
|
||||
// Off REAPER entirely -> the OS drag-out, the one irreversible transition.
|
||||
static void testSingleOffReaperIsOsHandoff() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::OffReaper)) ==
|
||||
DropClass::OsHandoff);
|
||||
}
|
||||
|
||||
// --- Matrix: outside the client, multi card ------------------------------------
|
||||
|
||||
// A multi payload names no single instrument, so both instrument surfaces refuse — a DEFINED
|
||||
// outcome with a cue, where the old law silently took the OS path from these surfaces.
|
||||
static void testMultiOverInstrumentSurfacesRefuses() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::TrackPanel, false)) ==
|
||||
DropClass::Refuse);
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::FxSurface, false)) ==
|
||||
DropClass::Refuse);
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::FxEmbed, false)) ==
|
||||
DropClass::Refuse);
|
||||
}
|
||||
|
||||
// Multi over the arrange still places — one item per capture; the shell lays them out.
|
||||
static void testMultiOverArrangeIsArrangeInsert() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::Arrange, false)) ==
|
||||
DropClass::ArrangeInsert);
|
||||
}
|
||||
|
||||
// Multi off REAPER is the classic multi-file drag-out, unchanged.
|
||||
static void testMultiOffReaperIsOsHandoff() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::OffReaper, false)) ==
|
||||
DropClass::OsHandoff);
|
||||
}
|
||||
|
||||
static void testMultiOverOtherReaperUiRefuses() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, ctx(ReaperSurface::Other, false)) ==
|
||||
DropClass::Refuse);
|
||||
}
|
||||
|
||||
// --- The documented null-track / non-empty-info case ---------------------------
|
||||
|
||||
// GetThingFromPoint "may return NULL with valid info string to indicate non-track thing". Both
|
||||
// outcomes that need a track therefore refuse instead of dereferencing nothing: over the arrange
|
||||
// that is the empty region below the last track, and over a track panel it is a surface we
|
||||
// cannot attribute.
|
||||
static void testNullTrackWithSurfaceRefuses() {
|
||||
for (ReaperSurface s : {ReaperSurface::TrackPanel, ReaperSurface::FxSurface,
|
||||
ReaperSurface::Arrange}) {
|
||||
for (bool single : {true, false}) {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel,
|
||||
ctx(s, single, /*haveTrack=*/false)) == DropClass::Refuse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A track under the pointer never turns OffReaper into a REAPER-internal outcome: OffReaper is
|
||||
// the shell's "the info string was empty and there was no track" verdict, and the law trusts it.
|
||||
static void testOffReaperIgnoresTrackFlag() {
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel,
|
||||
ctx(ReaperSurface::OffReaper, true, false)) == DropClass::OsHandoff);
|
||||
}
|
||||
|
||||
// --- Not-a-drag ----------------------------------------------------------------
|
||||
|
||||
// No armed samples, or not dragging -> None regardless of position or surface.
|
||||
static void testNoDragOrNoSamplesIsNone() {
|
||||
for (ReaperSurface s : kAllSurfaces) {
|
||||
DropContext c = ctx(s);
|
||||
c.drag = DragState{/*dragging=*/true, /*hasArmedSamples=*/false};
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, c) == DropClass::None);
|
||||
CHECK(decideDropClass(200, 150, kPanel, c) == DropClass::None);
|
||||
|
||||
c.drag = DragState{/*dragging=*/false, /*hasArmedSamples=*/true};
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, c) == DropClass::None);
|
||||
CHECK(decideDropClass(200, 150, kPanel, c) == DropClass::None);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Reversibility, speed-independence, exhaustiveness -------------------------
|
||||
|
||||
// The transition sequence from the acceptance criteria: client -> arrange -> FX window ->
|
||||
// arrange -> client. Every step resolves on its own terms, and the return leg reproduces the
|
||||
// outgoing leg exactly — the instrument drop is still available after crossing the arrange, and
|
||||
// re-entering the client resumes the internal drag.
|
||||
static void testClassTransitionsAreReversible() {
|
||||
const DropContext arrange = ctx(ReaperSurface::Arrange);
|
||||
const DropContext fx = ctx(ReaperSurface::FxSurface);
|
||||
const DropContext inside = ctx(ReaperSurface::Other); // surface is ignored inside
|
||||
|
||||
CHECK(decideDropClass(200, 150, kPanel, inside) == DropClass::Internal);
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, arrange) == DropClass::ArrangeInsert);
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, fx) == DropClass::InstrumentDrop);
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, arrange) == DropClass::ArrangeInsert);
|
||||
CHECK(decideDropClass(200, 150, kPanel, inside) == DropClass::Internal);
|
||||
}
|
||||
|
||||
// One unresolvable evaluation (a surface with no track, which refuses) followed by a resolvable
|
||||
// one: the second resolves exactly as it would have on its own. This is the property the retired
|
||||
// drag-lifetime "blocked" latch violated.
|
||||
static void testUnresolvableEvaluationDoesNotAffectTheNext() {
|
||||
const DropContext trackless = ctx(ReaperSurface::Arrange, true, /*haveTrack=*/false);
|
||||
const DropContext resolvable = ctx(ReaperSurface::Arrange);
|
||||
const DropClass standalone = decideDropClass(kOutX, kOutY, kPanel, resolvable);
|
||||
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, trackless) == DropClass::Refuse);
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, resolvable) == standalone);
|
||||
CHECK(standalone == DropClass::ArrangeInsert);
|
||||
|
||||
// And in the other order — the refusal is equally uninfluenced by what preceded it.
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, trackless) == DropClass::Refuse);
|
||||
}
|
||||
|
||||
// Drag speed only changes WHICH intermediate points get evaluated. Since the class is a function
|
||||
// of the current point and context alone, a "fast flick" (one evaluation at the release point)
|
||||
// and a "slow drag" (many evaluations ending at the same point) agree at that point — with the
|
||||
// intermediate surfaces deliberately chosen to disagree with the destination.
|
||||
static void testDragSpeedCannotChangeTheOutcome() {
|
||||
const DropContext destination = ctx(ReaperSurface::TrackPanel);
|
||||
const DropClass flick = decideDropClass(kOutX, kOutY, kPanel, destination);
|
||||
|
||||
// The slow path crosses everything else first.
|
||||
for (ReaperSurface s : kAllSurfaces) {
|
||||
(void)decideDropClass(kOutX - 10, kOutY, kPanel, ctx(s));
|
||||
(void)decideDropClass(200, 150, kPanel, ctx(s)); // and back through the client
|
||||
}
|
||||
CHECK(decideDropClass(kOutX, kOutY, kPanel, destination) == flick);
|
||||
CHECK(flick == DropClass::InstrumentDrop);
|
||||
}
|
||||
|
||||
// EXHAUSTIVENESS (acceptance criterion 7, structural rather than spot-checked): for a live drag
|
||||
// outside the client, no surface x payload x track combination resolves to None — i.e. there is
|
||||
// no cell whose release does nothing without having said so. None is reachable only from a dead
|
||||
// drag, which is asserted separately above.
|
||||
static void testNoLiveOutsideCombinationResolvesToNone() {
|
||||
for (ReaperSurface s : kAllSurfaces) {
|
||||
for (bool single : {true, false}) {
|
||||
for (bool haveTrack : {true, false}) {
|
||||
const DropClass c = decideDropClass(kOutX, kOutY, kPanel, ctx(s, single, haveTrack));
|
||||
CHECK(c != DropClass::None);
|
||||
CHECK(c != DropClass::Internal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Every class carries a cue, and only the two the shell deliberately does not draw map to a
|
||||
// no-cursor cue — so "will this work" is answerable before release for every resolvable class.
|
||||
static void testEveryClassHasACue() {
|
||||
CHECK(cueForDropClass(DropClass::Internal) == DropCue::Internal);
|
||||
CHECK(cueForDropClass(DropClass::InstrumentDrop) == DropCue::Instrument);
|
||||
CHECK(cueForDropClass(DropClass::ArrangeInsert) == DropCue::ArrangeInsert);
|
||||
CHECK(cueForDropClass(DropClass::Refuse) == DropCue::Refuse);
|
||||
CHECK(cueForDropClass(DropClass::OsHandoff) == DropCue::OsOwned);
|
||||
CHECK(cueForDropClass(DropClass::None) == DropCue::None);
|
||||
}
|
||||
|
||||
// --- Path-list assembly -------------------------------------------------------
|
||||
@@ -158,7 +297,7 @@ static void testMultiPreservesOrder() {
|
||||
}
|
||||
|
||||
// Two index entries resolving to the SAME file (the cross-bank copy case — one file, two
|
||||
// entries) yield ONE CF_HDROP path; the extra is counted, first occurrence wins.
|
||||
// entries) yield ONE path; the extra is counted, first occurrence wins.
|
||||
static void testDedupeSamePath() {
|
||||
PathList l = assemblePathList({ok("x.wav"), ok("y.wav"), ok("x.wav")});
|
||||
CHECK(l.paths.size() == 2);
|
||||
@@ -167,8 +306,7 @@ static void testDedupeSamePath() {
|
||||
CHECK(l.skippedDuplicate == 1);
|
||||
}
|
||||
|
||||
// A stale index entry (file gone from disk) is skipped — never a dangling path on the OS
|
||||
// clipboard.
|
||||
// A stale index entry (file gone from disk) is skipped — never a dangling path handed onward.
|
||||
static void testSkipMissing() {
|
||||
PathList l = assemblePathList({ok("a.wav"), missing("gone.wav"), ok("b.wav")});
|
||||
CHECK(l.paths.size() == 2);
|
||||
@@ -227,9 +365,8 @@ static void testMixedTallies() {
|
||||
// (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.
|
||||
// with no highlight and no drop. 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() {
|
||||
@@ -254,18 +391,31 @@ static void testAllSkippedSelectionKeepsInternalDrag() {
|
||||
}
|
||||
|
||||
int main() {
|
||||
testInsidePanelStaysInternal();
|
||||
testLeavingClientAreaIsOsDrag();
|
||||
testInsideClientIsAlwaysInternal();
|
||||
testBoundaryHalfOpen();
|
||||
testNoDragOrNoSamplesIsNone();
|
||||
testReentryReturnsInternal();
|
||||
testOffsetPanelRect();
|
||||
|
||||
testSingleCaptureOverReaperUiIsInstrumentDrop();
|
||||
testSingleCaptureInsidePanelStaysInternal();
|
||||
testSingleCaptureOffReaperIsOsDrag();
|
||||
testMultiCaptureOverReaperUiIsOsDrag();
|
||||
testS17FieldsIgnoredWhenNotDragging();
|
||||
testSingleOverTrackPanelIsInstrumentDrop();
|
||||
testSingleOverFxSurfaceIsInstrumentDrop();
|
||||
testSingleOverFxEmbedRefuses();
|
||||
testSingleOverArrangeIsArrangeInsert();
|
||||
testSingleOverOtherReaperUiRefuses();
|
||||
testSingleOffReaperIsOsHandoff();
|
||||
|
||||
testMultiOverInstrumentSurfacesRefuses();
|
||||
testMultiOverArrangeIsArrangeInsert();
|
||||
testMultiOffReaperIsOsHandoff();
|
||||
testMultiOverOtherReaperUiRefuses();
|
||||
|
||||
testNullTrackWithSurfaceRefuses();
|
||||
testOffReaperIgnoresTrackFlag();
|
||||
testNoDragOrNoSamplesIsNone();
|
||||
|
||||
testClassTransitionsAreReversible();
|
||||
testUnresolvableEvaluationDoesNotAffectTheNext();
|
||||
testDragSpeedCannotChangeTheOutcome();
|
||||
testNoLiveOutsideCombinationResolvesToNone();
|
||||
testEveryClassHasACue();
|
||||
|
||||
testSinglePath();
|
||||
testMultiPreservesOrder();
|
||||
|
||||
Reference in New Issue
Block a user