Skip to content

engine: pin the SVG a basic tikzpicture renders (tests, gated on GOTEX_PGF) - #192

Merged
tannevaled merged 1 commit into
mainfrom
tikz-bringup-svg
Sep 2, 2026
Merged

engine: pin the SVG a basic tikzpicture renders (tests, gated on GOTEX_PGF)#192
tannevaled merged 1 commit into
mainfrom
tikz-bringup-svg

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What

Adds tikzrender_test.go: focused regression tests pinning the SVG that a basic tikzpicture renders through the real pgf/TikZ sources and the engine's own system-layer driver (texmf/pgfsys-gotex.def).

These are the counterpart of the gobble tests (tikzgobble_test.go), which prove that without GOTEX_PGF a picture is stood in for and its body never leaks. The with-sources direction — the same primitives reaching the page as vector paths — previously had a single assertion (the diagonal in tikzsingle_test.go). This covers the primitives a basic picture is built from, each in exact big-point geometry (TikZ works in cm; pgf converts itself, so 1cm = 28.45274bp, 2cm = 56.90549bp):

primitive asserted output
straight \draw line one open <path>, fill="none"
\draw ... rectangle closed path, four corners + Z
\fill[red] shape colour scope + path drawn stroke="none"
\draw[thick,blue] stroke-width / stroke-colour scopes
node text glyph outline paths

Why test-only

Verification against current main showed the basic-through-intermediate render path is already comprehensive (lines, rectangles, circles, fills, colours, line width, dashes, arrows, node text all render). The gap was not the driver but its coverage: only one geometry assertion existed for the whole real-render path. This locks the contract in for the four primitives a basic picture uses.

Gating / safety

pgf's own sources are not embedded — a host supplies them on GOTEX_TEXMF — so like the existing rendering tests these skip when that tree is absent (CI stays green). Point GOTEX_TEXMF at a flattened pgf tree to run them.

No production or driver code changes, so output with GOTEX_PGF off is byte-identical to before (verified: main-built vs branch-built binary produce identical flag-off SVG on arXiv 2212.13760 and 2304.01407). Full suite green; the 5 new tests pass against a real pgf tree and skip without one.

🤖 Generated with Claude Code

…X_PGF)

The gobble tests (tikzgobble_test.go) prove that WITHOUT GOTEX_PGF a picture is
stood in for and its body never leaks. Their counterpart — that WITH the real
pgf/TikZ sources the same primitives reach the page as vector paths — had a
single assertion (the diagonal of tikzsingle_test.go). This adds focused
regression coverage for the primitives a basic picture is built from, each in
exact big-point geometry through the engine's own system-layer driver
(texmf/pgfsys-gotex.def):

  - a straight \draw line               -> one open <path>, fill="none"
  - a \draw ... rectangle               -> a closed path with the four corners + Z
  - a \fill[red] shape                  -> a colour scope + a path drawn stroke="none"
  - \draw[thick,blue]                   -> stroke-width / stroke colour scopes
  - a node's text                       -> glyph outline paths

pgf's own sources are not embedded (a host supplies them on GOTEX_TEXMF), so like
the other rendering tests these skip when that tree is absent; point GOTEX_TEXMF
at a flattened pgf tree to run them. Test-only: no production or driver code
changes, so output with the flag off is byte-identical to before (verified by
cmp on arXiv 2212.13760 and 2304.01407).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 9653337 into main Sep 2, 2026
18 checks passed
@tannevaled
tannevaled deleted the tikz-bringup-svg branch September 2, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant