Skip to content

Layout: no property-based coverage, and six public types have no tests at all #466

Closed

Description

@Tim81

VellumPdf.Layout has no property-based coverage, and it is the package a consumer drives hardest
with values it did not choose itself.

What is measurable about the gap

CsCheck is referenced by exactly three test projects — Kernel, Reader and Barcodes — and not by
this one (git grep -n CsCheck -- '*.csproj' 'Directory.Packages.props'). Counting [Fact] and
[Theory] per project puts Layout last of the five substantive suites, behind Reader, Kernel,
Conformance and Barcodes.

That gap lines up with where the defects are. An audit of the package's public surface found that
several validation defects each sit on a member with no test anywhere in the repository, and that
these public, shipped types have no test asserting their behaviour in any of the seven test
projects: ColorCmyk, LayoutBox, FontReference, RendererContext, LineSeparatorRenderer and
LayoutImageRenderer. EdgeInsets appears in fixtures only as a constructor call, so Horizontal
and Vertical — the two members DocumentRenderer.ValidateGeometry depends on — are never
asserted.

Why the existing Kernel suite would not have caught them

VellumPdf.Kernel.Tests.PropertyTests.FiniteCoordinates_produceWellFormedPdf restricts its
generators to finite coordinates and says so:

NaN/Infinity are excluded — they are not representable as PDF reals.

PdfReal does reject them. PdfCanvas.N, which every content-stream coordinate goes through, does
not — it is v.ToString("0.#####", CultureInfo.InvariantCulture) with no finiteness guard. So the
one property suite that renders a document excludes precisely the input that reaches the unguarded
formatter.

Two invariants worth stating

  • A render never escapes its declared exception contract.
  • A document never places content outside its own page box.

Both are checkable by reading the emitted content stream rather than by trusting the layout code's
own arithmetic, and both fail today once the generators reach the corner where a known defect
lives.

Scope

Test-only; nothing ships. The generators and the content-stream readback land first, with the
invariants stated over the input range that holds today. Widening either to a failing corner belongs
in the pull request that fixes that defect, where the property has to fail before the fix and pass
after — the only arrangement that shows it discriminates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions