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§
- Mock
Handle - Mock
Probe - Mock
State - Mock
Toolkit - The mock backend. Cloneable observer half: construct with
MockToolkit::newand keep the returnedMockProbeto inspect state after day-core takes ownership of the toolkit. - Mock
Widget - Mock
Window - A secondary window opened through the
open_windowduty (docs/windows.md), probe-visible for theopen_windowtests.
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.BodyandHeadlinestay exactly 1.0, the size every older mock expectation assumes. - text_
size