Fixtures
What fixtures are
Fixtures are static input files — HTML, SVG, CSS, JSON, .grida,
font binaries, images, text samples — used as deterministic inputs to
rendering, parsing, and I/O tests. They exist so that tests are reproducible,
self-contained, and don't depend on external services or generated data.
Why we keep them
- Regression detection — render the same input, compare the output.
- Spec coverage — each fixture maps to a specific feature or property
being tested (one concept per file).
- Onboarding — new contributors can see exactly what the renderer handles
by browsing fixtures.
- Cross-pipeline validation — the same fixture can be consumed by unit
tests, golden tests, reftests, probe tests, and visual inspection.
What should be covered
A fixture should exist for every rendering behavior, format variant, or
edge case that the engine supports or intends to support. This includes:
- Each CSS property / SVG element the htmlcss or SVG renderer handles
- Format I/O round-trips (SVG → Grida,
.grida decode)
- Edge cases: zero-size, empty content, deeply nested, degenerate inputs
- Unsupported-but-tracked features (the fixture documents the gap)
Best practices
- One concept per file. Don't combine unrelated properties.
- Self-contained. No external resources, network fetches, or scripts.
- Minimal. Only enough structure to isolate the behavior under test.
- Probe-friendly. High-contrast palette (prefer B/W), round pixel values,
≤ 3 colors. Designed for headless pixel probing, not human aesthetics.
- Descriptive naming.
<domain>-<property>[-<descriptor>].<ext> — the
filename alone should tell you what's being tested.
- Labeled specimens. Within a fixture, label each test case with the
value being exercised so both humans and heuristics can identify regions.
Keep labels short, and pin the dimensions of any container holding a
label (flex item, grid cell, stretched block) so font-advance-width
differences between engines can't leak into box geometry. When a test
pipeline offers a text-neutralizing stylesheet (e.g.
fixtures/test-html/_reftest/hide-text.css for the htmlcss reftests),
prefer that over stripping the label — keeping the text helps the next
reader understand the fixture.
- Match the fixture's subject to the viewport policy. For refbrowser
fixtures under
fixtures/test-html/, paint / visual-property
fixtures should size their root to a preset viewport (via min-height)
so grida's cull and Chromium's screenshot have identical dimensions.
Layout fixtures (box-model, flex, grid, intrinsic sizing) must
NOT force a body size — the output dimensions are what the test
measures; a min-height hack contaminates the result. See
fixtures/test-html/README.md
for the preset list, the paint-vs-layout rule, and the per-fixture
viewport workflow for layout tests.
- Don't duplicate. Before adding a fixture, check if an existing one
already covers the behavior. Extend or split rather than duplicate.
Git inclusion policy
Checked in (fixtures/)
All directories under fixtures/ except fixtures/local/ are committed
to the repository. These are small, purpose-built files that are part of the
test suite.
fixtures/
├── apple-emoji-linux/ # Emoji PNGs (compile-time input of the golden emoji example)
├── css/ # CSS stylesheets
├── fonts/ # Bundled font binaries (deterministic text tests)
├── images/ # Test images
├── prompts/ # AI prompt fixtures (model-v2 experiments)
├── test-grida/ # .grida format fixtures
├── test-html/ # HTML+CSS renderer fixtures (L0, etc.)
├── test-svg/ # SVG fixtures
├── text/ # Plain text samples
├── text-editor/ # Shared text-editing command fixtures (v1.json)
└── local/ # ← gitignored, see below
The grida product repo holds frozen snapshots of fonts/, images/,
test-grida/ and text-editor/ for its staying TS tests — canon and history
live HERE. If a fixture in those four dirs evolves, the grida side follows
only by a deliberate re-snapshot
(grida fixtures README).
Not checked in (fixtures/local/)
fixtures/local/ is gitignored. It holds large, third-party, or
benchmark-only datasets that are meaningful for local development but too
large or license-restricted for the repository:
W3C_SVG_11_TestSuite — W3C SVG 1.1 conformance suite (~50 MB)
resvg-test-suite — resvg's feature-focused SVG tests
oxygen-icons-5.116.0 — icon set for stress testing
perf — large scenes for benchmarking
refig — Figma community-file render corpus (workflow documented in the
render-reftest skill; source tooling lives in the grida repo)
svg-issues — reduced repro cases for SVG bugs
These must be downloaded separately by developers who need them.
Referencing local-only fixtures
Never reference fixtures/local/ paths in committed code, tests, or
documentation. Local fixtures do not exist in CI or on other developers'
machines. Specifically:
- Do not
include!(), read_to_string(), or fs::read() a local/ path
in any Rust test or example that runs in CI.
- Do not hardcode
fixtures/local/ paths in docs, READMEs, or AGENTS files
as if they are always available.
- If a doc needs to mention a local suite (e.g. for reftest instructions),
clearly mark it as local-only and note that the developer must download
it first.
- Tests that depend on local fixtures must be gated (e.g.
#[ignore] with a
comment, or behind a feature flag) so they don't fail in CI.
1---2name: fixtures3description: Guides authoring, organizing, and referencing test fixtures across the engine repo. Use when creating new fixtures, writing tests that depend on fixtures, or deciding what should be checked into git.4---56# Fixtures78## What fixtures are910Fixtures are static input files — HTML, SVG, CSS, JSON, `.grida`,11font binaries, images, text samples — used as **deterministic inputs** to12rendering, parsing, and I/O tests. They exist so that tests are reproducible,13self-contained, and don't depend on external services or generated data.1415## Why we keep them1617- **Regression detection** — render the same input, compare the output.18- **Spec coverage** — each fixture maps to a specific feature or property19 being tested (one concept per file).20- **Onboarding** — new contributors can see exactly what the renderer handles21 by browsing fixtures.22- **Cross-pipeline validation** — the same fixture can be consumed by unit23 tests, golden tests, reftests, probe tests, and visual inspection.2425## What should be covered2627A fixture should exist for every **rendering behavior, format variant, or28edge case** that the engine supports or intends to support. This includes:2930- Each CSS property / SVG element the htmlcss or SVG renderer handles31- Format I/O round-trips (SVG → Grida, `.grida` decode)32- Edge cases: zero-size, empty content, deeply nested, degenerate inputs33- Unsupported-but-tracked features (the fixture documents the gap)3435## Best practices3637- **One concept per file.** Don't combine unrelated properties.38- **Self-contained.** No external resources, network fetches, or scripts.39- **Minimal.** Only enough structure to isolate the behavior under test.40- **Probe-friendly.** High-contrast palette (prefer B/W), round pixel values,41 ≤ 3 colors. Designed for headless pixel probing, not human aesthetics.42- **Descriptive naming.** `<domain>-<property>[-<descriptor>].<ext>` — the43 filename alone should tell you what's being tested.44- **Labeled specimens.** Within a fixture, label each test case with the45 value being exercised so both humans and heuristics can identify regions.46 Keep labels short, and pin the dimensions of any container holding a47 label (flex item, grid cell, stretched block) so font-advance-width48 differences between engines can't leak into box geometry. When a test49 pipeline offers a text-neutralizing stylesheet (e.g.50 `fixtures/test-html/_reftest/hide-text.css` for the htmlcss reftests),51 prefer that over stripping the label — keeping the text helps the next52 reader understand the fixture.53- **Match the fixture's subject to the viewport policy.** For refbrowser54 fixtures under `fixtures/test-html/`, **paint / visual-property**55 fixtures should size their root to a preset viewport (via `min-height`)56 so grida's cull and Chromium's screenshot have identical dimensions.57 **Layout** fixtures (box-model, flex, grid, intrinsic sizing) must58 NOT force a body size — the output dimensions _are_ what the test59 measures; a `min-height` hack contaminates the result. See60 [`fixtures/test-html/README.md`](../../../fixtures/test-html/README.md)61 for the preset list, the paint-vs-layout rule, and the per-fixture62 `viewport` workflow for layout tests.63- **Don't duplicate.** Before adding a fixture, check if an existing one64 already covers the behavior. Extend or split rather than duplicate.6566## Git inclusion policy6768### Checked in (`fixtures/`)6970All directories under `fixtures/` **except `fixtures/local/`** are committed71to the repository. These are small, purpose-built files that are part of the72test suite.7374```75fixtures/76├── apple-emoji-linux/ # Emoji PNGs (compile-time input of the golden emoji example)77├── css/ # CSS stylesheets78├── fonts/ # Bundled font binaries (deterministic text tests)79├── images/ # Test images80├── prompts/ # AI prompt fixtures (model-v2 experiments)81├── test-grida/ # .grida format fixtures82├── test-html/ # HTML+CSS renderer fixtures (L0, etc.)83├── test-svg/ # SVG fixtures84├── text/ # Plain text samples85├── text-editor/ # Shared text-editing command fixtures (v1.json)86└── local/ # ← gitignored, see below87```8889The grida product repo holds **frozen snapshots** of `fonts/`, `images/`,90`test-grida/` and `text-editor/` for its staying TS tests — canon and history91live HERE. If a fixture in those four dirs evolves, the grida side follows92only by a deliberate re-snapshot93([grida fixtures README](https://github.com/gridaco/grida/blob/main/fixtures/README.md)).9495### Not checked in (`fixtures/local/`)9697`fixtures/local/` is **gitignored**. It holds large, third-party, or98benchmark-only datasets that are meaningful for local development but too99large or license-restricted for the repository:100101- `W3C_SVG_11_TestSuite` — W3C SVG 1.1 conformance suite (~50 MB)102- `resvg-test-suite` — resvg's feature-focused SVG tests103- `oxygen-icons-5.116.0` — icon set for stress testing104- `perf` — large scenes for benchmarking105- `refig` — Figma community-file render corpus (workflow documented in the106 render-reftest skill; source tooling lives in the grida repo)107- `svg-issues` — reduced repro cases for SVG bugs108109These must be downloaded separately by developers who need them.110111## Referencing local-only fixtures112113**Never reference `fixtures/local/` paths in committed code, tests, or114documentation.** Local fixtures do not exist in CI or on other developers'115machines. Specifically:116117- Do not `include!()`, `read_to_string()`, or `fs::read()` a `local/` path118 in any Rust test or example that runs in CI.119- Do not hardcode `fixtures/local/` paths in docs, READMEs, or AGENTS files120 as if they are always available.121- If a doc needs to mention a local suite (e.g. for reftest instructions),122 clearly mark it as **local-only** and note that the developer must download123 it first.124- Tests that depend on local fixtures must be gated (e.g. `#[ignore]` with a125 comment, or behind a feature flag) so they don't fail in CI.