test: adopt the 168-test E2E feature suite into CI - #218
Merged
Conversation
These files existed only on one machine — the stock VS .gitignore rule '*.e2e' matched the directory name EggPdf.Tests.E2E, so they were never versioned and never ran in CI (the ignore rule was fixed in #212). Adopting them raises E2E coverage from ~20 to 221 tests: layout (flex, grid, float, tables, lists), colors/box model/borders, text and fonts, visual effects and pagination, HTML robustness, plus WebUI flows and browser-vs-PDF pixel comparison. 16 tests carried stale expectations. Each was investigated against the engine rather than rewritten to match current output; all 16 were test bugs, no engine defects: - 5 page-size tests expected px x 0.75 values (446.46 x 631.42 for A4). Named @page sizes are defined in POINTS; the engine correctly emits A4 595.28 x 841.89, Letter 612 x 792, A5 419.53 x 595.28. Verified each against the spec. (A custom 'size: 500px 700px' case correctly stays 375 x 525 — px->pt really is x0.75 — and already passed.) - 9 tests substring-matched a contiguous phrase in the content stream, but the engine positions each word as its own BT/ET block ('(Strong) Tj' then '( text) Tj') — correct rendering at correct coordinates. Added PdfTextDecoder.DecodeWithText, which appends a rendered-text layer built from text-showing operators, so assertions test the requirement (text renders) not the emission shape. - 1 page-break test no longer overflowed because the corrected (larger) page fits its 980px of content; spacer raised past the A4 content box. - 1 WebUI flow test drove a pre-Ace hidden textarea and assumed the browser-print column was visible; it now drives the Ace editor API and clicks the Print tab like the other passing WebUI tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adopting the E2E suite into CI immediately caught this: five Transform tests passed on Windows and failed on Linux. Root cause was in the product, not the tests — PdfPage built content streams with StringBuilder.AppendLine, which emits Environment.NewLine, so the same input produced CRLF-separated operators on Windows and LF-separated ones on Linux. Byte-level determinism matters here because this library signs PDFs: a regenerated document must hash identically regardless of host OS. All 87 content-stream writes now go through AppendOpLine, which always emits LF. The Transform tests' line-ending assertions were relaxed accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
These test files existed only on one machine. The stock Visual Studio
.gitignorerule*.e2e(meant for profiler traces) matched the directoryEggPdf.Tests.E2E, so they were never versioned and never ran in CI. The ignore rule was fixed in #212; this adopts the files.E2E coverage goes from ~20 to 221 tests: layout (flex/grid/float/tables/lists), colors + box model + borders, text and fonts, visual effects and pagination, HTML robustness and malformed input, plus WebUI flows and browser-vs-PDF pixel comparison.
The 16 stale tests — investigated, not rewritten to match output
Every failure was checked against the engine and the PDF spec before touching it. All 16 were test bugs; no engine defects were found.
446.46 × 631.42for A4)@pagesizes are defined in points. Engine correctly emits A4595.28 × 841.89, Letter612 × 792, A5419.53 × 595.28— verified each against the spec. A customsize: 500px 700pxcase correctly stays375 × 525(px→pt is ×0.75) and already passed.(Strong) Tjthen( text) Tj) — correct rendering at correct coordinates. AddedPdfTextDecoder.DecodeWithText, which appends a rendered-text layer built from text-showing operators, so assertions test the requirement (the text renders) rather than the emission shape.break-inside: avoidexpected 2 pagesTest evidence
CI risk, stated up front
This suite has never run on Linux. Three tests compare browser-print vs PDF pixel similarity, which is inherently platform-sensitive (CI Chromium lacks Arial). The threshold is lenient (50% similarity, 40/255 channel tolerance), so it should hold — but if CI proves them flaky I'll gate those three to local-only rather than weaken the threshold. I will not merge this red.
🤖 Generated with Claude Code