# AllBarcodesDecode() | LabelAssertions | Every barcode decodes back to the data its field asks for (scan-proof, two independent decoders). |
# AllBarcodesHaveGrade(char atLeast) | LabelAssertions | Every graded barcode reaches at least grade atLeast (A–D) in the digital pre-check. |
# Barcode(string selector, int? index = default) | BarcodeAssertions | Selects one barcode of the label (see ZplSelectors: "#0", "^BC", "QR", "GS1-128", "SSCC", "(01)", or a substring of the data). Fails when nothing or – without index – more than one barcode matches. selector: Which barcode. · index: Pick the n-th match (0-based) when several barcodes match. |
# Barcode(Func<ComplianceBarcode, bool> predicate, string description = "") | BarcodeAssertions | Selects the barcode that satisfies predicate (exactly one). |
# Complies(CompliancePacks packs, ComplianceSeverity failOn = ComplianceSeverity.Error) | LabelAssertions | Runs compliance rule packs and fails on findings of failOn or above (default errors). |
# Complies(ComplianceRulePack pack, ComplianceSeverity failOn = ComplianceSeverity.Error) | LabelAssertions | Runs compliance rule packs (built-in or custom) and fails on findings of failOn or above. |
# DoesNotHaveText(string text) | LabelAssertions | No text field of the label contains text (e.g. "TODO", "{{", placeholder data). |
# FieldEquals(int fieldNumber, string expected) | LabelAssertions | The field with ^FNfieldNumber prints expected. |
# FieldEquals(string field, string expected) | LabelAssertions | The field "FN1" / "^FN1" / "1" prints expected (data as drawn, after ^FH, ^SN and field values). |
# FitsPrinter(PrinterProfile profile, bool failOnWarnings = false) | LabelAssertions | The labels print correctly on the printer model of profile (Printer Twin: printhead width and clipped fields, maximum length, resolution, firmware, options, fonts, memory; see PrinterProfileFit). profile: A printer profile, e.g. PrinterProfiles.Get("ZD421-203"). · failOnWarnings: Also fail on issues of severity warning. |
# FitsPrinter(IZplPrinterFit printer, bool failOnWarnings = false) | LabelAssertions | The labels fit printer: resolution, print width, label length – or whatever the implementation checks (see IZplPrinterFit, e.g. a Printer Twin profile). printer: Printer limits. · failOnWarnings: Also fail on issues of severity warning. |
# HasBarcodes(int count) | LabelAssertions | The label has exactly count barcodes. |
# HasLabels(int count) | LabelAssertions | The job prints exactly count label formats (^XA…^XZ; ^PQ copies count once). |
# HasText(string text) | LabelAssertions | Some text field of the label contains text. |
# MatchesSnapshot(string name, double tolerancePercent) | LabelAssertions | Pixel snapshot with tolerancePercent % changed pixels allowed (see LabelAssertions.MatchesSnapshot). |
# MatchesSnapshot(string name, SnapshotTolerance? tolerance = default) | LabelAssertions | Compares the 1-bit render of every label with the approved snapshot name.approved.png (plus the semantic snapshot name.approved.json) in ZplAssertSettings.SnapshotDirectory next to the test file. On failure name.received.png and name.diff.png are written and the message lists the changed regions and elements ("text "FROM" moved +12 dots"). Accept with ZPLCORE_ACCEPT_SNAPSHOTS=1 or zplcore snapshot accept <dir>. |
# NoClipping() | LabelAssertions | Every element lies completely on the label (nothing cut off at the ^PW/^LL edge). |
# NoOverlaps(int toleranceDots = 0) | LabelAssertions | No two elements' ink overlaps (text over text, text over barcode, lines through text …). Outlined boxes count with their four sides only and reverse (^FR) fields never count, so framed and inverted designs pass. toleranceDots: Overlaps of at most this many dots in width or height are ignored (touching lines). |
# OnLabel(int index) | LabelAssertions | Switches to label index (0-based, print order; ^PQ copies are not separate labels). |
# Renders(int? dpi = default, ZplDiagnosticSeverity failOn = ZplDiagnosticSeverity.Warning) | LabelAssertions | The ZPL renders at least one label and without render diagnostics of failOn or above (default warnings: invalid barcode data, missing fonts and graphics, malformed commands). dpi: Renders at this resolution instead of the test resolution (e.g. to prove a 203 dpi label also works at 300 dpi). · failOn: Lowest severity that fails. |
# Satisfies(Func<ComplianceLabel, bool> predicate, string because, string expression = "") | LabelAssertions | Custom assertion on the current label. |
# Text(string text, int? index = default) | TextAssertions | Selects one text field (exact content, else substring, else substring ignoring case). Fails when nothing or – without index – more than one text matches. |