Re-derive the floor-size test fixtures from the constants and move the ceiling to sample_bands.h
This commit is contained in:
@@ -5,8 +5,10 @@
|
||||
// three-band vertical inventory (chrome over waveform over decks, no overlap, no
|
||||
// inversion) asserted as pure geometry with no paint call; the waveform band's two-lane
|
||||
// floor and the bands-clip-rather-than-squeeze rule on a short window; the deck band's
|
||||
// bottom anchor and its exact requested height; and the lane split (mono = one full-band
|
||||
// lane, stereo = two lanes with the seam gap between them).
|
||||
// bottom anchor and its exact requested height; the same stack/anchor/degrade properties
|
||||
// re-anchored AT the allocator's own kEditorMinWidth/kEditorMinHeight floor rather than only
|
||||
// below it; and the lane split (mono = one full-band lane, stereo = two lanes with the seam
|
||||
// gap between them).
|
||||
|
||||
#include "../src/core/instrument/ui/sample_bands.h"
|
||||
|
||||
@@ -104,6 +106,56 @@ static void testDegenerateWindowYieldsNoInvertedRects() {
|
||||
CHECK(tiny.decks.right() >= tiny.decks.x);
|
||||
}
|
||||
|
||||
// --- the allocator at its own floor (kEditorMinWidth x kEditorMinHeight) -------
|
||||
|
||||
// The allocator's own client-area floor is a fact IT owns (kEditorMinWidth/kEditorMinHeight
|
||||
// above); the fixtures above validate the general shape entirely below that floor (840x620,
|
||||
// 840x160). These anchor the same properties AT the floor itself, so a floor move that broke
|
||||
// the stack there would have nothing else in this file to catch it.
|
||||
|
||||
static void testBandsStackWithoutOverlapAtTheEditorFloor() {
|
||||
const SampleBands b = computeSampleBands(kEditorMinWidth, kEditorMinHeight, 120);
|
||||
CHECK(b.chrome.y == 0);
|
||||
CHECK(b.chrome.width == kEditorMinWidth);
|
||||
CHECK(b.chrome.height == kTitleHeight + kChromeRowHeight);
|
||||
CHECK(b.waveform.y >= b.chrome.bottom());
|
||||
CHECK(b.decks.y >= b.waveform.bottom());
|
||||
CHECK(b.waveform.x == kPad && b.waveform.right() == kEditorMinWidth - kPad);
|
||||
CHECK(b.decks.x == kPad && b.decks.right() == kEditorMinWidth - kPad);
|
||||
}
|
||||
|
||||
static void testDeckBandIsBottomAnchoredAtTheEditorFloor() {
|
||||
constexpr int deckH = 120;
|
||||
const SampleBands b = computeSampleBands(kEditorMinWidth, kEditorMinHeight, deckH);
|
||||
CHECK(b.decks.height == deckH);
|
||||
CHECK(b.decks.bottom() == kEditorMinHeight - kPad);
|
||||
}
|
||||
|
||||
// At a representative two-row deck height (216px — the ceiling test_deck_groups.cpp bounds
|
||||
// the wrapped deck to), the waveform gets exactly what the floor's own height leaves it: an
|
||||
// equality, not a bound, so a floor-height change that quietly ate into the waveform's slack
|
||||
// would fail here rather than only widen/narrow a `>=`.
|
||||
static void testWaveformGetsExactlyTheFloorsRemainingHeightAtATwoRowDeck() {
|
||||
constexpr int twoRowDeckH = 216;
|
||||
const SampleBands b = computeSampleBands(kEditorMinWidth, kEditorMinHeight, twoRowDeckH);
|
||||
const int expected = kEditorMinHeight - kPad - twoRowDeckH - 2 * kBandGap -
|
||||
(kTitleHeight + kChromeRowHeight);
|
||||
CHECK(b.waveform.height == expected);
|
||||
CHECK(b.waveform.height == 358);
|
||||
CHECK(b.waveform.height >= kWaveformMinHeight);
|
||||
}
|
||||
|
||||
// The floor is not immune to the degrade path: a deck grown too tall for the floor's OWN
|
||||
// height still hits the floor-wins rule instead of squeezing the waveform below its usable
|
||||
// minimum — the sub-floor fixtures above cover the general rule; this is the same rule
|
||||
// exercised at the allocator's own minimum width.
|
||||
static void testAnOversizedDeckAtTheFloorStillDegradesGracefully() {
|
||||
const SampleBands b = computeSampleBands(kEditorMinWidth, kEditorMinHeight, 500);
|
||||
CHECK(b.waveform.height == kWaveformMinHeight);
|
||||
CHECK(b.decks.y >= b.waveform.bottom());
|
||||
CHECK(b.decks.bottom() > kEditorMinHeight); // clipped below the floor's own window
|
||||
}
|
||||
|
||||
// --- the waveform band's lanes ------------------------------------------------
|
||||
|
||||
static void testMonoUsesOneFullBandLane() {
|
||||
@@ -149,6 +201,10 @@ int main() {
|
||||
testWaveformNeverShrinksBelowTheTwoLaneFloor();
|
||||
testTwoLaneFloorHoldsTwoUsableLanes();
|
||||
testDegenerateWindowYieldsNoInvertedRects();
|
||||
testBandsStackWithoutOverlapAtTheEditorFloor();
|
||||
testDeckBandIsBottomAnchoredAtTheEditorFloor();
|
||||
testWaveformGetsExactlyTheFloorsRemainingHeightAtATwoRowDeck();
|
||||
testAnOversizedDeckAtTheFloorStillDegradesGracefully();
|
||||
testMonoUsesOneFullBandLane();
|
||||
testStereoSplitsIntoTwoLanesWithTheSeamGap();
|
||||
testStereoOddRemainderGoesToTheUpperLane();
|
||||
|
||||
Reference in New Issue
Block a user