zplCore.comzplCore.com

SnapshotStore

public sealed class SnapshotStore
Snapshot folder with the approval workflow. Files per snapshot name:
  • name.approved.png (label 1), name.label2.approved.png … – commit these
  • name.approved.json – semantic snapshot (elements, positions, data) – commit it too
  • name.received.png / name.received.json / name.diff.png – written on failure; add *.received.* and *.diff.png to .gitignore
Accept with ZPLCORE_ACCEPT_SNAPSHOTS=1, zplcore snapshot accept <dir> or by renaming received to approved.

Constructors

SignatureDescription
# SnapshotStore(string directory)Opens (and creates on write) the folder.

Properties

PropertyTypeDescription
Directory { get; }stringAbsolute folder path.

Methods

Method SignatureReturnsDescription
static # AcceptAll(string directory)IReadOnlyList<string>Promotes every received snapshot in directory to approved (received → approved, diff removed). Returns the accepted snapshot names.
static # Explain(SnapshotResult r, SnapshotTolerance tolerance, int dpi)IEnumerable<(string, string)>Human-readable explanation of a failed result (used in assertion messages and the CLI).
static # ImageName(string name, int index, string kind)stringFile name of label index's image ("approved", "received" or "diff").
static # SafeName(string name)stringMakes a snapshot or test name safe as a file name (keeps letters, digits, - _ . and spaces as -).
# Verify(string name, SnapshotSubject subject, SnapshotTolerance tolerance, bool accept, bool failOnMissing = true)SnapshotResultCompares subject with the approved snapshot name; writes received and diff files on failure, removes stale ones on success, and writes the approved files in accept mode.