Files
cnmcdee d507697ae8 tools/visreg: refresh 5 stale goldens, raise window-wait to 20s
First full run: 537 PASS, 9 FAIL, 1 SKIP (547 total).
Five RMSE failures were stale docs-sweep goldens (mid-draw
captures: chart data present, border/title/overlay lines missing)
— IndAdaptiveCyberCycle, IndCyberCycle, IndRegressionChannel,
IndRelativeVolatilityIndex, InstTankLevelAlarms. Each refreshed
golden is a settled render verified bit-stable across two
independent runs (RMSE 0). Four no-window failures were load
flakes under parallel execution; window-wait budget 10s -> 20s.
Confirmation re-run of all 9: 9 PASS, 0 FAIL, all 0.0000% RMSE.
2026-12-02 10:10:41 +00:00
..

Visual regression harness (tools/visreg/)

Re-renders every xframe-demo widget and diffs it against its golden screenshot, so a drawing regression shows up as a failing widget instead of a surprise on a docs page.

Run

tools/visreg/run.sh            # full sweep: all 547 widgets
tools/visreg/run.sh --widgets "GtkButton GtkLabel"   # subset
tools/visreg/run.sh --threshold 1.0                  # looser threshold

Exit code is 0 when every compared widget passes (or is skipped), 1 when any widget fails. A report is written either way to tools/visreg/report/:

  • report.csv — one row per widget: name,status,rmse_pct,rmse_raw,notes
  • report.md — summary + failure table
  • summary.txt — one-line counts
  • diffs/ — ImageMagick diff images, failures only

report/ is git-ignored; the harness, goldens and this README are committed.

How it renders

The same path the docs sweep used (Dec 2, 2026, hot_chicago):

  1. Runs the prebuilt target/debug/examples/<WidgetName> binary (built once by cargo build -p xframe-demo --examples; the harness rebuilds only if a binary is missing, or always with --rebuild).
  2. Under Xvfb (1280x1024x24, no window manager), the demo opens its 800x600 window at 100,100 and draws the widget.
  3. The window is found by title (<Name> - XFrame demo) with xdotool and captured with ImageMagick import -window <wid> — with no WM there are no decorations, so the capture is exactly the 800x600 client area, matching the goldens. The capture is settled: frames are taken until two consecutive screenshots are pixel-identical, so a shot can never catch the X server mid-draw (the docs sweep's GtkCalendar golden did exactly that — fill drawn, border/text not yet — and the harness refuses to repeat the mistake).

How it compares

compare -metric RMSE golden new diff.png. The normalised RMSE (the parenthesised value, 0–1) × 100 is the reported RMSE %. A widget passes when RMSE % ≤ threshold (default 0.5%).

The threshold is deliberately not zero: screenshots can differ by a few pixels from font rendering / anti-aliasing between runs, and a zero-threshold harness would cry wolf. 0.5% of an 800x600 window is ~2,400 fully-different pixels — far above the handful of pixels of AA wobble a clean tree produces (a clean-tree run measures 0.0000% on the overwhelming majority of widgets), and far below what any real drawing regression produces (a missing border, wrong fill or shifted label is typically several percent). If a clean tree ever fails, the threshold — not the widget — is the suspect; re-tune it from a calibration run (--widgets a sample across families, inspect the RMSE distribution) before touching widget code.

Goldens

golden/ holds the 547 docs-sweep screenshots from /opt/lightgui-docs/rust_shots/ (Dec 2, 2026) — the same images on the rustdoc widget pages. They are the baseline: a widget that renders identically to its docs screenshot passes.

To accept an intentional rendering change, review the failure diffs in report/diffs/ first, then:

tools/visreg/run.sh --widgets "<changed widgets>" --keep-shots --update-goldens
git diff --stat tools/visreg/golden/   # confirm only intended goldens moved

Known skips

  • GtkInvisible — skipped by design. It draws nothing (its golden is a blank 800x600 window); there is nothing to compare.

Known-baseline notes

  • GtkCalendar golden refreshed Dec 2, 2026. The docs-sweep golden was a mid-draw capture: grey fill only, no border and no Calendar label (RMSE 3.9246% vs a correct render). The widget/drawing code is unchanged since Nov 30, and the docs pilot screenshot of the same widget (taken 06:00 UTC, before the sweep) is pixel-identical (RMSE 0) to the current render — so the golden, not the widget, was wrong. Refreshed from a settled harness capture; the stale file is not kept.
  • Five indicator/instrument goldens refreshed Dec 2, 2026 (first full run: 537 PASS, 9 FAIL, 1 SKIP): IndAdaptiveCyberCycle (3.2035%), IndCyberCycle (4.2955%), IndRegressionChannel (4.5600%), IndRelativeVolatilityIndex (4.0846%), InstTankLevelAlarms (4.2938%). Same mid-draw signature as GtkCalendar — the golden shows the chart data but is missing the border, title text and overlay lines the widget draws last. Each refreshed golden is a settled harness render verified bit-stable across two independent runs (RMSE 0 between them) with the failure RMSE reproducing exactly; the widget/drawing code is unchanged since Nov 30, so the goldens were the stale side.
  • "No window" flakes in the first full run (GtkEntry, IndLinearRegressionIntercept, IndRSquared, IndShannonEntropy): all four pass at 0.0000% on re-run — under 4-way parallel load the 10s window-wait budget was too short. The budget is now 20s.