import { type VisionEnv } from "../core/env.js"; import { type Cell, type Detection, type Provider, type ProviderSource } from "../core/provider.js"; /** One source and what each capability must give for it. */ export type ConformanceFixture = { readonly name: string; readonly source: ProviderSource; /** What each capability must give for this source; a capability the fixture has no entry for is not run on it. */ readonly expect: { readonly text?: readonly { readonly page: number; readonly contains: readonly string[]; }[]; readonly render?: readonly { readonly page: number; readonly dpi: number; readonly width: number; readonly height: number; }[]; readonly cells?: readonly { readonly sheet: string; readonly cells: readonly Cell[]; }[]; readonly frames?: { readonly atS: readonly number[]; readonly maxEdge: number; readonly width: number; readonly height: number; }; readonly clip?: { readonly fromS: number; readonly toS: number; readonly maxBytes: number; }; }; }; /** What the suite runs: the provider, a twin it must agree with, the environment and the fixtures. */ export type ConformanceOptions = { readonly provider: Provider; /** A provider of the same job that must agree with this one on every fixture both can read. */ readonly twin?: Provider; readonly env: () => VisionEnv | Promise; readonly fixtures: readonly ConformanceFixture[]; /** Fail, instead of skip, when a provider cannot run here. Default: PI_VISION_REQUIRE_BINARIES=1. */ readonly requireAvailable?: boolean; }; /** A case resolves when it passes, resolves `{ skip }` when the provider cannot run here, and rejects when it fails. */ export type ConformanceCase = { readonly name: string; run(): Promise; }; /** The conformance cases for `options.provider`, unregistered, so a test can show the suite fails a provider that breaks it. * `registerProviderConformance` registers them. */ export declare function providerConformance(options: ConformanceOptions): ConformanceCase[]; /** Each case as a `node:test` test named `: `; a case that cannot run here is a skipped test with its reason. */ export declare function registerProviderConformance(options: ConformanceOptions): void; /** The fake provider's document: a JSON file of pages, each with its text and its size in points. */ export type FakeDocument = { readonly pages: readonly { readonly text: string; readonly width: number; readonly height: number; }[]; }; /** Knobs that make the fake provider disagree with a twin, render the wrong size or be unavailable, so the suite is shown to catch each. */ export type FakeProviderOptions = { readonly name?: string; readonly version?: string; /** Default: available. */ readonly detection?: Detection; /** Applied to every page's text: a twin that disagrees. */ readonly text?: (text: string) => string; /** Pixels added to every render's width: a provider that renders the wrong size. */ readonly widthError?: number; }; /** A provider of `text` and `render` over `FakeDocument` files, read through the environment. Renders are white PNGs * of the page's size at the dpi asked for. */ export declare function fakeProvider(options?: FakeProviderOptions): Provider;