Clear stale hover on capture-loss and Alt-delete; derive gutter test via chromeRects

This commit is contained in:
2026-07-30 10:39:27 -04:00
parent 9812690b96
commit e89568c1a8
5 changed files with 26 additions and 7 deletions
+13 -4
View File
@@ -16,9 +16,11 @@
// unverified by this suite (see src/core/instrument/CLAUDE.md).
#include "../src/core/instrument/ui/keyboard_strip.h"
#include "../src/core/instrument/ui/sample_bands.h" // kPad, to derive the strip width the
// shipped default window (840x620,
#include "../src/core/instrument/ui/sample_bands.h" // computeSampleBands, to derive the CHROME
// band the shipped default window (840x620,
// editor_session.cpp) hands the strip
#include "../src/core/instrument/ui/sample_chrome.h" // chromeRects, to derive rootStrip's width
// the same way the shell does
#include <cstdio>
#include <string>
@@ -288,8 +290,15 @@ static void testNoteNamesFollowTheC4Convention() {
// one pixel of resize (840->841) collapses both gutters to zero and grows every white key
// from 10px to 11px.
static void testGutterAtTheShippedDefaultWindowSize() {
constexpr int kShippedDefaultWindowW = 840; // editor_session.cpp's ViewRect default
const int stripW = kShippedDefaultWindowW - 2 * kPad; // chromeRects insets rootStrip by kPad
constexpr int kShippedDefaultWindowW = 840; // editor_session.cpp's ViewRect default
constexpr int kShippedDefaultWindowH = 620; // editor_session.cpp's ViewRect default
// Derive rootStrip's width the same way the shell does, through the real allocator +
// chrome layout, rather than re-deriving the inset formula — so a change to either one
// fails this test instead of silently moving the shipped gutter out from under it.
const SampleBands bands =
computeSampleBands(kShippedDefaultWindowW, kShippedDefaultWindowH, 0);
const ChromeRects chrome = chromeRects(bands.chrome, /*knobSize=*/24);
const int stripW = chrome.rootStrip.width;
CHECK(stripW == 824);
const StripLayout L = layoutStrip(stripW, 30);