feat(diagrams): add raster fixtures for pixel-only recovery - #3
Open
MannXo wants to merge 1 commit into
Open
Conversation
Twelve PNG fixtures built by a recorded, byte-reproducible command. Ten redraw a graph that also ships as SVG, against the same ground truth, so SVG, vector PDF and raster can be scored apart. Raster is where nothing is left. Vector PDF still holds path operators and positioned glyphs; a PNG holds pixels, so shapes and text both have to be recovered before a graph can be inferred at all. Two engines, named in each filename because the engine and not the source decides the pixels. Mermaid cannot go through cairo for the same reason it cannot in the PDF set: librsvg does not render <foreignObject>, so a cairo copy carries the whole drawing and none of its labels. That failure is silent, since the file is valid and only the text is missing, so a test asserts any fixture drawn from a <foreignObject> source is built by Skia rather than leaving it to whoever edits the recipe next. Determinism comes free here. Neither engine writes a tIME chunk or anything else clock-derived, so unlike the PDFs there is no normalisation step and --check compares raw bytes. No font is redistributed: a PNG holds an image of text rather than the outlines that drew it, so the fsType question the PDF builder answers does not arise. That is why graphviz_cjk ships as raster while it cannot ship as PDF, which recovers CJK, Hebrew and Arabic coverage for the one container that had lost it. Everything is drawn at 2x, since a caption set around 12px sits near the floor of what OCR reads reliably at 1:1. PNGs are bucket-managed and still need publishing; corpus.lock.json is unchanged, so the twelve pin assertions fail until that lands, exactly as the ten PDF assertions do.
Author
|
the ci failures are not related to this PR, all failures stem from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Twelve raster fixtures. Ten redraw a graph that also ships as SVG, against the same ground truth,
so SVG, vector PDF and raster can be scored apart.
Raster is the container that keeps least. A vector PDF still holds path operators and positioned
glyphs; a PNG holds pixels, so the shapes and the text both have to be recovered before a graph
can be inferred at all.
Built by
scripts/build_diagram_rasters.py, which mirrorsbuild_diagram_pdfs.pyand has thesame
--check. Determinism comes free here. Neither engine writes atIMEchunk or anythingelse derived from the clock, so two runs agree byte for byte with no normalisation step.
Two engines, named in each filename because the engine and not the source decides the pixels.
Mermaid cannot go through cairo for the reason you already documented for the PDF set. That
failure is silent, since the file is valid and only the text is missing, so
test_diagram_manifest.pynow asserts that a fixture drawn from a<foreignObject>source isbuilt by Skia rather than leaving it to whoever edits the recipe next.
graphviz_cjkships here. A PNG holds an image of text rather than the outlines that drew it, sono font is redistributed and the
fsTypequestion does not arise, which recovers CJK, Hebrew andArabic coverage for the one container that had lost it. Flagging rather than assuming, since the
call is yours.
Everything is drawn at 2x. A caption set around 12px sits near the floor of what OCR reads
reliably at 1:1, and a benchmark should not be measuring a resampling artefact.
PNGs are bucket-managed and still need publishing.
corpus.lock.jsonis unchanged, so the twelvepin assertions fail exactly as the ten PDF ones already do on main. Files ready to hand over.