Q-W1 pt2: core/shell/app relocation + sub-namespaces; one concrete ui::Rect (LTRB fork retired); slot_map split from bank_book; BankIndex→BankModel; 59/59 green

This commit is contained in:
2026-07-28 20:48:56 -04:00
parent 67a41728f3
commit 847936f813
222 changed files with 2247 additions and 2079 deletions
+9 -8
View File
@@ -10,13 +10,14 @@
// pool, set named, invalid id); JSON round-trip lossless (full book); legacy
// bank_index → pool migration.
#include "../src/bank_book.h"
#include "../src/core/model/bank_book.h"
#include <cstdio>
#include <string>
#include <vector>
using namespace reasampler;
using namespace reasampler::model;
static int g_fail = 0;
#define CHECK(cond) do { if(!(cond)) { \
@@ -339,9 +340,9 @@ static void testJsonEmptyBookRoundTrip() {
}
static void testLegacyMigration() {
// A bare legacy bank_index JSON (BankIndex::serialize output — has "samples", no
// A bare legacy bank_index JSON (BankModel::serialize output — has "samples", no
// "banks") must promote into the pool: a book of { pool } with zero named banks.
BankIndex legacy;
BankModel legacy;
CHECK(legacy.add(sampleWith("old1")) == AddResult::Added);
CHECK(legacy.add(sampleWith("old2")) == AddResult::Added);
std::string legacyJson = legacy.serialize();
@@ -361,7 +362,7 @@ static void testLegacyMigration() {
}
// An EMPTY legacy index ("{\"samples\":[]}" style via serialize) also migrates.
BankIndex emptyLegacy;
BankModel emptyLegacy;
auto back2 = BankBook::deserialize(emptyLegacy.serialize());
CHECK(back2.has_value());
CHECK(back2 && back2->size() == 1 && back2->pool().index.empty());
@@ -408,7 +409,7 @@ static void testLoadPrefersBanksBlob() {
CHECK(src.bank("drums")->index.add(sampleWith("new1")) == AddResult::Added);
const std::string banksJson = src.serialize();
BankIndex stale;
BankModel stale;
CHECK(stale.add(sampleWith("stale-old")) == AddResult::Added);
const std::string legacyJson = stale.serialize();
@@ -424,7 +425,7 @@ static void testLoadPrefersBanksBlob() {
static void testLoadMigratesLegacyWhenNoBanks() {
// No `banks` key, a legacy `bank_index` present: migrate into the pool, zero named.
BankIndex legacy;
BankModel legacy;
CHECK(legacy.add(sampleWith("l1")) == AddResult::Added);
CHECK(legacy.add(sampleWith("l2")) == AddResult::Added);
const std::string legacyJson = legacy.serialize();
@@ -449,7 +450,7 @@ static void testLoadEmptyWhenNeither() {
static void testLoadMalformedBanksDegradesWithoutLegacyFallback() {
// A present-but-malformed `banks` blob must degrade to an empty book and must NOT
// resurrect the stale legacy key (that would revive superseded single-bank state).
BankIndex stale;
BankModel stale;
CHECK(stale.add(sampleWith("stale")) == AddResult::Added);
const std::string legacyJson = stale.serialize();
@@ -936,7 +937,7 @@ static void testBankBookSlotsRoundTrip() {
static void testMigrationDefaultsToInsertionOrderDense() {
// A pre-L7 legacy bank_index blob carries no slot data. On load -> reconcileSlots
// seeds dense insertion order (no gaps), so it is visually identical.
BankIndex legacy;
BankModel legacy;
CHECK(legacy.add(sampleWith("o1")) == AddResult::Added);
CHECK(legacy.add(sampleWith("o2")) == AddResult::Added);
CHECK(legacy.add(sampleWith("o3")) == AddResult::Added);