Collapse the FX-park drain's writes into one undo point instead of one per TrackFX_SetOffline
This commit is contained in:
@@ -4,8 +4,9 @@
|
||||
// The properties under test: a mode switch leaves its per-FX offline work here,
|
||||
// so a second switch arriving before the first drained must leave every track in
|
||||
// the state the SECOND switch specifies — never the first's, never both replayed;
|
||||
// a cancel must not strand the pre-park FX state it was the last record of; and
|
||||
// a pre-park snapshot is never taken from a chain a park has already touched.
|
||||
// a cancel must not strand the pre-park FX state it was the last record of; a
|
||||
// pre-park snapshot is never taken from a chain a park has already touched; and
|
||||
// one drain closes as at most ONE undo point, in the FX domain only.
|
||||
|
||||
#include "../src/shell/view/view_fx_park.h"
|
||||
|
||||
@@ -406,6 +407,30 @@ static void testAReEntrantParkCancelsOnlyWhatIsStillPending() {
|
||||
CHECK(intentFor(q, "{A}") && intentFor(q, "{A}")->park);
|
||||
}
|
||||
|
||||
// -- the drain's undo point --------------------------------------------------
|
||||
|
||||
static void testADrainThatWroteFxClosesItsBlockAsOneNamedFxPoint() {
|
||||
const FxParkUndoClose close = fxParkUndoClose(true);
|
||||
|
||||
// 2 is UNDO_STATE_FX (reaper_plugin.h:1542), pinned as a literal here and
|
||||
// static_asserted against the macro in view_fx_park.cpp. The drain writes
|
||||
// per-FX offline and nothing else, so any wider mask would make it marshal
|
||||
// track config or items it never touched.
|
||||
CHECK(close.mask == 2);
|
||||
CHECK(close.label != nullptr && std::string(close.label) ==
|
||||
"ReaSampler: Design View FX park");
|
||||
}
|
||||
|
||||
static void testADrainThatWroteNothingClosesItsBlockAsADiscard() {
|
||||
// The project-load reapply: a park is planned for every inactive leaf, and a
|
||||
// project saved parked already holds every one of those FX offline. Nothing is
|
||||
// written, so the block must leave no undo point behind at all.
|
||||
const FxParkUndoClose close = fxParkUndoClose(false);
|
||||
|
||||
CHECK(close.mask == 0);
|
||||
CHECK(close.label != nullptr && std::string(close.label).empty());
|
||||
}
|
||||
|
||||
int main() {
|
||||
testParkEnqueuesOneIntentCarryingNoOps();
|
||||
testParkReportsNothingCancelledWhenNoIntentWasPending();
|
||||
@@ -442,6 +467,9 @@ int main() {
|
||||
testIntentsArrivingDuringADrainSurviveIt();
|
||||
testAReEntrantParkCancelsOnlyWhatIsStillPending();
|
||||
|
||||
testADrainThatWroteFxClosesItsBlockAsOneNamedFxPoint();
|
||||
testADrainThatWroteNothingClosesItsBlockAsADiscard();
|
||||
|
||||
if (g_fail == 0) std::printf("All tests passed.\n");
|
||||
return g_fail ? 1 : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user