Skip to content

test: adopt the 168-test E2E feature suite into CI - #218

Merged
cloud-hai-vo merged 2 commits into
mainfrom
test/adopt-e2e-feature-suite
Jul 18, 2026
Merged

test: adopt the 168-test E2E feature suite into CI#218
cloud-hai-vo merged 2 commits into
mainfrom
test/adopt-e2e-feature-suite

Conversation

@cloud-hai-vo

Copy link
Copy Markdown
Contributor

Summary

These test files existed only on one machine. The stock Visual Studio .gitignore rule *.e2e (meant for profiler traces) matched the directory EggPdf.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.

Count Issue Resolution
5 Expected page sizes as px×0.75 (446.46 × 631.42 for A4) Named @page sizes are defined in points. Engine correctly emits A4 595.28 × 841.89, Letter 612 × 792, A5 419.53 × 595.28 — verified each against the spec. A custom size: 500px 700px case correctly stays 375 × 525 (px→pt is ×0.75) and already passed.
9 Substring-matched a contiguous phrase in the content stream 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 (the text renders) rather than the emission shape.
1 break-inside: avoid expected 2 pages Knock-on of the size fix: the corrected, larger page fits the 980px of content. Spacer raised past the A4 content box so it actually overflows.
1 WebUI flow test timed out It drove a pre-Ace hidden textarea and assumed the browser-print column was visible. Now drives the Ace editor API and clicks the Print tab, like the other passing WebUI tests.

Test evidence

  • E2E: 221/221 passing locally (was 205/221 on adoption)
  • Unit/layout untouched by this change (test-only, E2E project)

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

cloud-hai-vo and others added 2 commits July 18, 2026 16:12
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>
@cloud-hai-vo
cloud-hai-vo merged commit 7e2059e into main Jul 18, 2026
8 checks passed
@cloud-hai-vo
cloud-hai-vo deleted the test/adopt-e2e-feature-suite branch July 18, 2026 09:27
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