lightweight-pdf-testing 0.3.0

Pixel-diff PDF snapshot testing (pdftoppm-based rasterization) — usable for lightweight-pdf's own examples or your own PDF templates
Documentation
  • Coverage
  • 38.89%
    7 out of 18 items documented1 out of 4 items with examples
  • Size
  • Source code size: 19.05 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 245.83 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • casoon/lightweight-pdf
    0 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • casoon

Pixel-diff snapshot testing for rendered PDFs (issue #21): render → rasterize (pdftoppm, part of poppler-utils — already a required tool for this workspace's own text-extraction tests, so this adds no new system dependency) → compare each page against a checked-in reference PNG, with a small per-pixel tolerance for renderer noise.

Deliberately independent of lightweight-pdf-test-support (that crate is this workspace's own internal dev-dependency, never published) — this crate stands on its own, usable to pin any PDF (not just ones built with lightweight-pdf) against visual regressions.

Reference images are low-DPI grayscale PNG (DEFAULT_DPI) on purpose — this is a regression trip-wire, not a print-quality visual proof, and keeping them small keeps the repository's history small.

# fn render() -> Vec<u8> { vec![] }
let dir = std::path::Path::new("test-fixtures/snapshots");
lightweight_pdf_testing::assert_snapshot(dir, "invoice", &render());

Set UPDATE_SNAPSHOTS=1 to (re)write the reference images instead of comparing against them.