|
|
Donner 0.5.0
Embeddable browser-grade SVG2 engine
|
Parameters for controlling image comparison tests. More...
#include "donner/svg/renderer/tests/ImageComparisonTestFixture.h"
Public Member Functions | |
| ImageComparisonParams & | disableDebugSkpOnFailure () |
| Disables saving of .skp files on test failure. | |
| ImageComparisonParams & | includeAntiAliasingDifferences () |
| Counts anti-aliased pixel differences as mismatches. | |
| ImageComparisonParams & | enableGoldenUpdateFromEnv () |
| Enables updating golden images based on an environment variable. | |
| ImageComparisonParams & | setCanvasSize (int width, int height) |
| Sets a custom canvas size for rendering. | |
| ImageComparisonParams & | disableBackend (RendererBackend backend, std::string_view reason=std::string_view()) |
| Disables one backend for this test case. | |
| ImageComparisonParams & | requireFeature (RendererBackendFeature feature, std::string_view reason=std::string_view()) |
| Requires a renderer feature for this test case. | |
| ImageComparisonParams & | withSimpleTextMaxPixels (int pixels) |
| Sets a separate maxMismatchedPixels for simple text (without HarfBuzz shaping). | |
| ImageComparisonParams & | withMaxPixelsDifferent (int pixels) |
| Sets the max mismatched pixels for this test case. | |
| ImageComparisonParams & | onlyTextFull () |
| Skip this test entirely when running without HarfBuzz (simple text). | |
| int | effectiveMaxMismatchedPixels () const |
| Returns the effective maxMismatchedPixels for the active text config. | |
| bool | shouldSkip () const |
| Returns true if this test should be skipped for the active text config. | |
Static Public Member Functions | |
| static ImageComparisonParams | Skip () |
| Creates parameters to skip a test. | |
| static ImageComparisonParams | RenderOnly () |
| Creates parameters that render the test but skip pixel comparison. | |
| static ImageComparisonParams | WithThreshold (float threshold, int maxMismatchedPixels=kDefaultMismatchedPixels) |
| Creates parameters with a specific threshold and maximum mismatched pixels. | |
| static ImageComparisonParams | WithGoldenOverride (std::string_view filename, float threshold=kDefaultThreshold) |
| Creates parameters with an overridden golden image filename. | |
Public Attributes | |
| float | threshold = kDefaultThreshold |
| Maximum allowed difference per pixel (0.0 to 1.0). | |
| int | maxMismatchedPixels = kDefaultMismatchedPixels |
| Maximum number of pixels that can exceed the threshold. | |
| int | simpleTextMaxMismatchedPixels = -1 |
| Override for maxMismatchedPixels when running without HarfBuzz text shaping (DONNER_TEXT_FULL not defined). -1 means use maxMismatchedPixels for all configs. | |
| bool | skipSimpleText = false |
| If true, skip this test when running without HarfBuzz (simple text). | |
| bool | includeAntiAliasing = false |
| If true, count anti-aliased pixels as mismatches instead of suppressing them. | |
| bool | skip = false |
| If true, skip this test case. | |
| bool | saveDebugSkpOnFailure = true |
| If true, save a .skp file for debugging when a test fails. | |
| bool | updateGoldenFromEnv = false |
| If true, allow updating golden images via an environment variable. | |
| bool | showTerminalPreview = true |
| If true, emit a terminal preview grid when comparisons fail. | |
| std::optional< Vector2i > | canvasSize |
| Optional canvas size override, which determines the size of the rendered image. | |
| std::string_view | overrideGoldenFilename |
| Optional filename to use for the golden image, overriding the default. | |
| bool | allowSkia = true |
| If false, skip the test when the active backend is Skia. | |
| bool | allowTinySkia = true |
| If false, skip the test when the active backend is TinySkia. | |
| bool | allowGeode = true |
| If false, skip the test when the active backend is Geode. | |
| uint32_t | requiredFeatures = 0 |
| Bitmask of required backend features, built from RendererBackendFeatureMask. | |
| std::string_view | backendRequirementReason |
| Human-readable reason used when backend restrictions cause a skip. | |
| bool | renderOnly = false |
| If true, render but skip the pixel comparison. Used for tests where the output is implementation-defined or UB, but we still want to verify rendering stability. | |
Parameters for controlling image comparison tests.
This struct allows customization of various aspects of the image comparison process, such as error thresholds, skipping tests, and overriding golden image filenames.
|
inline |
Disables one backend for this test case.
| backend | The backend to disable. |
| reason | Optional human-readable skip reason. |
|
inline |
Disables saving of .skp files on test failure.
|
inline |
Enables updating golden images based on an environment variable.
|
inline |
Counts anti-aliased pixel differences as mismatches.
|
inline |
Skip this test entirely when running without HarfBuzz (simple text).
Use this for tests that require text-full features (e.g., color emoji fonts that can't be loaded by stb_truetype at all).
|
inlinestatic |
Creates parameters that render the test but skip pixel comparison.
Used for tests where the output is implementation-defined or has expected variance, but we want to verify that rendering completes without crashing.
|
inline |
Requires a renderer feature for this test case.
| feature | The feature to require. |
| reason | Optional human-readable skip reason. |
|
inline |
Sets a custom canvas size for rendering.
| width | The width of the canvas. |
| height | The height of the canvas. |
|
inlinestatic |
Creates parameters to skip a test.
|
inlinestatic |
Creates parameters with an overridden golden image filename.
| filename | The filename to use for the golden image. |
| threshold | Optional per-pixel difference threshold to use with the override. |
|
inline |
Sets the max mismatched pixels for this test case.
| pixels | The max mismatched pixels. |
|
inline |
Sets a separate maxMismatchedPixels for simple text (without HarfBuzz shaping).
When DONNER_TEXT_FULL is not defined, this value is used instead of maxMismatchedPixels. This allows tests that require text shaping (combining marks, ligatures, etc.) to have a looser threshold for simple text while keeping a strict threshold for HarfBuzz.
| pixels | The max mismatched pixels for simple text. |
|
inlinestatic |
Creates parameters with a specific threshold and maximum mismatched pixels.
| threshold | The per-pixel difference threshold. |
| maxMismatchedPixels | The maximum number of pixels allowed to mismatch. |