Figler.Render.Oracle.Runner (figler v0.1.0-beta.1)

Copy Markdown View Source

Runs same-scene visual comparisons from JSON manifests.

A manifest selects the same .fig page or root, scale, and background used to produce each OpenPencil reference PNG:

{
  "fig": "fixture.fig",
  "oracle": {"renderer": "open-pencil", "source_root": "1:23"},
  "cases": [
    {
      "name": "button",
      "reference": "button.png",
      "root": "1:23",
      "scale": 2.0,
      "background": "transparent",
      "fallback_fonts": ["../fonts/NotoSansSC-Regular.otf"],
      "font_languages": ["zh-Hans"],
      "expected_warning_codes": ["font_substituted"],
      "thresholds": {
        "channel": 2,
        "changed_ratio": 0.001,
        "mean_delta": 0.1,
        "max_delta": 16
      }
    }
  ]
}

Paths are resolved relative to the manifest. Large fixtures and references can remain outside the repository. Optional manifest-level and per-case oracle metadata is copied into reports so source-renderer IDs can be recorded when importers remap nodes.

Summary

Functions

Runs all visual cases in a render-oracle manifest.

Types

result()

@type result() :: %{
  manifest: String.t(),
  fixture: String.t(),
  oracle: map(),
  case_count: non_neg_integer(),
  failed_count: non_neg_integer(),
  passed?: boolean(),
  cases: [map()]
}

Functions

run(manifest_path)

@spec run(Path.t()) :: {:ok, result()} | {:error, term()}

Runs all visual cases in a render-oracle manifest.