Render in place: a track's output to a new sibling, source to the bench

This commit is contained in:
2026-08-02 14:17:55 -04:00
parent a0fd931dcb
commit 5c0f5f1591
21 changed files with 727 additions and 32 deletions
+43
View File
@@ -1739,6 +1739,48 @@ static void testLaneMintingEmptyFolderNotSplit() {
// -- D2.6 JSON round-trip with lane index + membership -----------------------
// An EXPLICIT Arrange record is new: the shipped "tag selected tracks -> Arrange"
// action untags instead, so until now Arrange was only ever represented by absence.
// The render-in-place verb writes one, because the record — not the behaviour — is
// what the panel's auto-tag detector defers to. It must be indistinguishable from
// absence everywhere else.
static void testExplicitArrangeRecordRoundTripsAndBehavesLikeAbsence() {
ViewModeModel vm;
vm.membership().tag("{TAGGED-ARRANGE}", kArrangeModeId);
// "{UNTAGGED}" is deliberately never tagged — the comparison partner.
const std::string json = vm.serialize();
const auto back = ViewModeModel::deserialize(json);
CHECK(back.has_value());
CHECK(back && *back == vm);
if (back) CHECK(back->serialize() == json);
// The record survives as a record, not collapsed away on the round-trip.
if (back) {
const Membership* m = back->membership().query("{TAGGED-ARRANGE}");
CHECK(m != nullptr);
CHECK(m && m->modeIds == std::set<std::string>{kArrangeModeId});
CHECK(back->membership().query("{UNTAGGED}") == nullptr);
}
// Membership answers identically for the record and for its absence, in BOTH
// modes — that equivalence is what makes writing the record free of behaviour.
const auto checkEquivalent = [](const ViewModeModel& m) {
CHECK(m.leafBelongsToMode("{TAGGED-ARRANGE}", kArrangeModeId) ==
m.leafBelongsToMode("{UNTAGGED}", kArrangeModeId));
CHECK(m.leafBelongsToMode("{TAGGED-ARRANGE}", kArrangeModeId));
CHECK(m.leafBelongsToMode("{TAGGED-ARRANGE}", kDesignModeId) ==
m.leafBelongsToMode("{UNTAGGED}", kDesignModeId));
CHECK(!m.leafBelongsToMode("{TAGGED-ARRANGE}", kDesignModeId));
};
checkEquivalent(vm);
if (back) checkEquivalent(*back); // and after a save/reload round-trip
// untag() still returns it to absence, so the existing way out still works.
CHECK(vm.membership().untag("{TAGGED-ARRANGE}"));
CHECK(vm.membership().query("{TAGGED-ARRANGE}") == nullptr);
}
static void testLaneJsonRoundTrip() {
ViewModeModel vm;
CHECK(vm.modes().add(Mode{"mixdown", "Mixdown", 2}));
@@ -1922,6 +1964,7 @@ int main() {
testLaneMintingShowBothNotForceSplit();
testLaneMintingSingleModeLeafVisibleOnceNoSplit();
testLaneMintingEmptyFolderNotSplit();
testExplicitArrangeRecordRoundTripsAndBehavesLikeAbsence();
testLaneJsonRoundTrip();
testLaneMalformedJson();