fix(gui): the tab bar's pictures are compared as shapes, and no picture depends on a temporary name

The stored tab-bar images were compared pixel for pixel on every machine.
GitHub's software renderer rasterizes the same shapes differently from the
GPU that made them (thousands of faint pixels, dozens strong along glyph
edges); sidenav.rs already says so and compares shapes everywhere, pixels
only locally. The tab bar now does the same: a hash of the visible shapes
(tests/snapshots/<name>.shapes, TABS_BLESS=1 writes them), the pixels with
TABS_PIXELS=1. The images are unchanged and still pass locally.

The hash is of a description of each shape, not of its debug form, for
two things in the debug form depended on the run, not on the books: a
glyph's place in egui's font atlas changes with which tests ran in the
process before (the same view hashed differently alone and beside another
test), and the page under a short bar holds the current time, clipped
away, which no picture shows. Shapes whose clip is off the window are
left out.

A new test renders the same companies from two differently named
temporary folders, light and dark, and requires the same hue keys (the
book ids), the same shapes and the same pixels. The sidenav fixture's
copy outside a data root is in a folder of a fixed name, not the temporary
folder's random one, since that folder's name is its badge's hue key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 21:48:18 -07:00
1 parent c072e68fda
commit 13e676a101
12 files changed
+153 -11

No files matched your search

+9 -4
View File
@@ -104,6 +104,7 @@ const FOOTERS: [Footer; 9] = [
/// menu), about 560 events and 110 stored receipts. Removed when dropped.
struct Fixture {
_dir: tempfile::TempDir,
_plain_dir: tempfile::TempDir,
root: PathBuf,
plain: PathBuf,
}
@@ -153,15 +154,19 @@ impl Fixture {
std::fs::create_dir_all(&root).unwrap();
fill(&root);
// The same books outside the root: no Books menu.
let plain = tempfile::Builder::new()
// Outside a data root a company's badge hue is chosen from its
// folder's name (company.rs `hue_key`), so that folder has a fixed
// name here, never the temporary folder's random one: the same
// picture on every machine and every run.
let plain_dir = tempfile::Builder::new()
.prefix("wb-gui-sidenav-plain-")
.tempdir()
.unwrap()
.keep();
let plain_book = plain.join("books-data");
.unwrap();
let plain_book = plain_dir.path().join("wanderland-copy").join("books-data");
copy_dir(&root, &plain_book);
Fixture {
_dir: dir,
_plain_dir: plain_dir,
root,
plain: plain_book,
}