Section 15
Testing & quality
The canvas is where regressions hurt most. Golden tests and a performance harness are non‑negotiable.
15.1 — Test layers
| Layer | Tooling | What it covers |
|---|---|---|
| Unit | flutter_test | Pure logic — bitset ops, region indexing, palette state. |
| Widget | flutter_test | Library cards, palette strip, paywall sheet, settings. |
| Golden | flutter_test goldens | Canvas renders for fixed artworks at fixed zoom levels. |
| Integration | integration_test + Patrol | End‑to‑end: open free artwork, colour, sync, sign in. |
| Performance | Custom harness | Open a 2 000‑region artwork, record frame times, fail CI on regression. |
| Backend | Vitest / pgTAP | RLS policies, function behaviour, validation rules. |
15.2 — Test artworks
Three fixture artworks are checked into the repo: a 50‑region tutorial piece, a 500‑region typical piece, and a 2 000‑region stress piece. All goldens and performance benchmarks reference these.