Skip to main content

Crate day_mock

Crate day_mock 

Source
Expand description

day-mock: the headless toolkit (DESIGN.md §3.2, §21.2 M0–M1).

Records every toolkit call into a compact op log (golden-diffable), performs deterministic measurement (8pt/char × 16pt line labels, fixed control sizes), and lets tests inject native events through the real sink. The op log is the contract for the fine-grained guarantees: “exactly one op per state change” and “bounded measure calls” are assertions over this log.

Structs§

MockHandle
MockProbe
MockState
MockToolkit
The mock backend. Cloneable observer half: construct with MockToolkit::new and keep the returned MockProbe to inspect state after day-core takes ownership of the toolkit.
MockWidget
MockWindow
A secondary window opened through the open_window duty (docs/windows.md), probe-visible for the open_window tests.

Constants§

MOCK_ENCODE_FORMATS
What the mock claims it can encode: the two formats every real backend also manages, so a test that asserts a WebP refusal exercises the same path a desktop backend takes.
MOCK_IMAGE_H
MOCK_IMAGE_W
The synthetic pixel size every mock decode reports (docs/images.md): deterministic, so a test can predict the frame an image(bytes) measures to, exactly like the synthetic text metrics above.
MOCK_LINE_H
Deterministic text metrics: 8pt per char, 16pt line height, greedy wrap. The mock’s line box: one line of text is this tall, whatever it says.

Functions§

font_scale
A semantic style’s size against Body, the mock’s 8 × 16 cell: Apple’s default point sizes (Body 17), so a large-title row measures taller than a caption row the way it does natively. Body and Headline stay exactly 1.0, the size every older mock expectation assumes.
text_size