Type-enforce the waveform overlay contract, narrow waveformLanes to LaneSplit, fix laneCount/cache/path-fallback bugs

This commit is contained in:
2026-07-30 09:35:11 -04:00
parent 2a0d10fab5
commit fb12c53522
19 changed files with 233 additions and 174 deletions
+5 -5
View File
@@ -88,7 +88,7 @@ static void testTwoLaneFloorHoldsTwoUsableLanes() {
// number, so a lane can never be allocated below its own minimum.
CHECK(kWaveformMinHeight == 2 * kLaneMinHeight + kLaneGap);
const SampleBands b = computeSampleBands(840, 160, 120);
const WaveformLanes lanes = waveformLanes(b.waveform, /*stereo=*/true);
const WaveformLanes lanes = waveformLanes(b.waveform, LaneSplit::Stereo);
CHECK(lanes.upper.height >= kLaneMinHeight);
CHECK(lanes.lower.height >= kLaneMinHeight);
}
@@ -108,14 +108,14 @@ static void testDegenerateWindowYieldsNoInvertedRects() {
static void testMonoUsesOneFullBandLane() {
const Rect band = Rect::ltrb(8, 100, 832, 300);
const WaveformLanes lanes = waveformLanes(band, /*stereo=*/false);
const WaveformLanes lanes = waveformLanes(band, LaneSplit::Single);
CHECK(lanes.upper == band);
CHECK(lanes.lower.empty()); // no redundant duplicate lane in mono
}
static void testStereoSplitsIntoTwoLanesWithTheSeamGap() {
const Rect band = Rect::ltrb(8, 100, 832, 300); // height 200
const WaveformLanes lanes = waveformLanes(band, /*stereo=*/true);
const WaveformLanes lanes = waveformLanes(band, LaneSplit::Stereo);
CHECK(lanes.upper.y == band.y);
CHECK(lanes.lower.bottom() == band.bottom());
// Full width each, seam exactly kLaneGap, no overlap.
@@ -127,14 +127,14 @@ static void testStereoSplitsIntoTwoLanesWithTheSeamGap() {
static void testStereoOddRemainderGoesToTheUpperLane() {
const Rect band = Rect::ltrb(0, 0, 100, 201); // usable 199 -> 100 / 99
const WaveformLanes lanes = waveformLanes(band, /*stereo=*/true);
const WaveformLanes lanes = waveformLanes(band, LaneSplit::Stereo);
CHECK(lanes.upper.height == 100);
CHECK(lanes.lower.height == 99);
CHECK(lanes.lower.bottom() == band.bottom());
}
static void testEmptyBandYieldsEmptyLanes() {
const WaveformLanes lanes = waveformLanes(Rect{}, /*stereo=*/true);
const WaveformLanes lanes = waveformLanes(Rect{}, LaneSplit::Stereo);
CHECK(lanes.upper.empty());
CHECK(lanes.lower.empty());
}