Ψ-W2-T1 remediation: scrim the card name over the waveform, hedge two SDK claims, fix a UTF-8-truncation empty-label bug, file the legibility DAW deferral
This commit is contained in:
@@ -103,6 +103,26 @@ static void testEmptyNameAndEmptyFallbackStillYieldALegalStem() {
|
||||
CHECK(sanitizeStem(n.stemBase) == "capture");
|
||||
}
|
||||
|
||||
static void testAllWhitespaceNameFallsBackToTheScopeLiteral() {
|
||||
// Distinct path from an empty name: trimmed() is what empties it, before truncation
|
||||
// ever runs.
|
||||
const CaptureName n = composeCaptureName(inputsFor({" "}, 0, "item"));
|
||||
CHECK(n.label == "item 08-01 1432");
|
||||
CHECK(sanitizeStem(n.stemBase) == "item");
|
||||
}
|
||||
|
||||
static void testNameThatTruncatesToNothingFallsBackToCapture() {
|
||||
// Over-length and made entirely of a UTF-8 continuation byte (0x80-0xBF): not empty
|
||||
// pre-truncation, so it survives trimmed()/the fallback chain as a real name — but
|
||||
// truncateUtf8 backs off over continuation bytes and walks all the way to 0 (every byte
|
||||
// in the first kMaxSourceNameBytes is a continuation byte), which used to leave an
|
||||
// empty label.
|
||||
const std::string allContinuation(kMaxSourceNameBytes + 10, '\x80');
|
||||
const CaptureName n = composeCaptureName(inputsFor({allContinuation}));
|
||||
CHECK(n.label == "capture 08-01 1432");
|
||||
CHECK(sanitizeStem(n.stemBase) == "capture");
|
||||
}
|
||||
|
||||
static void testUnnamedTrackUsesReaperTrackNConvention() {
|
||||
// What GetTrackName actually hands back for an unnamed track — the deterministic
|
||||
// fallback rides in as an ordinary name, no special case in the composer.
|
||||
@@ -231,6 +251,8 @@ int main() {
|
||||
testEmptyNameFallsBackToTheScopeLiteral();
|
||||
testNoSourceAtAllFallsBackToTheScopeLiteral();
|
||||
testEmptyNameAndEmptyFallbackStillYieldALegalStem();
|
||||
testAllWhitespaceNameFallsBackToTheScopeLiteral();
|
||||
testNameThatTruncatesToNothingFallsBackToCapture();
|
||||
testUnnamedTrackUsesReaperTrackNConvention();
|
||||
testAllPunctuationNameKeepsTheLabelAndCollapsesTheStem();
|
||||
testNonAsciiNameKeepsTheLabelAndCollapsesTheStem();
|
||||
|
||||
@@ -250,6 +250,25 @@ static void testTextOnHoverSurfaceClearsFloor() {
|
||||
CHECK(contrastRatio(roleColor(Role::TextDim), hover) >= textFloor(TextClass::Large));
|
||||
}
|
||||
|
||||
// The card name strip (panel_render.cpp's drawCardName) draws text/primary Micro (10px, BODY
|
||||
// class) over a bg/base scrim at kCardNameScrimAlpha, itself drawn over whatever the waveform
|
||||
// left in that rect. Enumerate both backgrounds a loud/quiet capture can leave there: the
|
||||
// accent-lime fill (a full-scale peak reaching the strip) and bare bg/cell (a quiet capture,
|
||||
// nothing painted that high). Unscrimmed, text/primary reads ~1:1 against the fill — this is
|
||||
// the load-bearing check that the scrim actually fixes it.
|
||||
static void testCardNameScrimClearsBodyFloorOnItsWorstBackground() {
|
||||
const KitColor scrim = roleColor(Role::BgBase);
|
||||
const KitColor onFill = compositeOver(scrim, roleColor(Role::AccentPrimary),
|
||||
kCardNameScrimAlpha);
|
||||
const KitColor onCell = compositeOver(scrim, roleColor(Role::BgCell), kCardNameScrimAlpha);
|
||||
CHECK(contrastRatio(roleColor(Role::TextPrimary), onFill) >= textFloor(TextClass::Body));
|
||||
CHECK(contrastRatio(roleColor(Role::TextPrimary), onCell) >= textFloor(TextClass::Body));
|
||||
// Without the scrim, text/primary on the bare accent-lime fill is UNDER floor — pins the
|
||||
// defect the scrim exists to close, so a future removal of the scrim fails this first.
|
||||
CHECK(contrastRatio(roleColor(Role::TextPrimary), roleColor(Role::AccentPrimary))
|
||||
< textFloor(TextClass::Body));
|
||||
}
|
||||
|
||||
// --- Single point of change (structural guarantee) ----------------------------
|
||||
//
|
||||
// roleColor is the ONLY color source; there is no other public accessor that yields a
|
||||
@@ -346,6 +365,7 @@ int main() {
|
||||
testRegionTitleAccentsClearLargeFloorOnPanel();
|
||||
testTextOnPastelFillClearsBodyFloor();
|
||||
testTextOnHoverSurfaceClearsFloor();
|
||||
testCardNameScrimClearsBodyFloorOnItsWorstBackground();
|
||||
testCurveTraceOnHoverSurfaceClearsFloor();
|
||||
testSecondaryTertiaryAreDistinguishable();
|
||||
testOverlayTraceClearsIndicatorFloorOnTheWaveform();
|
||||
|
||||
Reference in New Issue
Block a user