Donner SVG main
0.8.0 · 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
Resvg Test Suite Instructions

//donner/svg/renderer/tests:resvg_test_suite uses https://github.com/RazrFalcon/resvg-test-suite to validate Donner's rendering end-to-end. The test suite provides .svg files that can be rendered with the static subset of SVG (and some SVG2), and resvg's golden images to compare against.

To validate against this suite continuously, https://github.com/jwmcglynn/pixelmatch-cpp17 is used to perceptually difference the images and wrap it in a gtest. Execution is single-threaded but it's fast enough to be run in CI, and sufficiently fast to be run as part of inner loop development.

To run the suite:

bazel run //donner/svg/renderer/tests:resvg_test_suite

Or in debug mode:

bazel run -c dbg //donner/svg/renderer/tests:resvg_test_suite

Since this is a gtest, it will also be run as part of any bazel test targeting this directory:

bazel test //...

To run as part of gtest, parameter-driven tests are generated by scanning the suite's category directories and registering one test per .svg file found.

Affected pull requests use resvg_test_suite_default_text for the complete CPU corpus and resvg_test_suite_max_text for text-rendering cases in the full shaping tier. The scoped target includes fixtures with direct, embedded, or linked text outside tests/text/. Full-graph runs exercise the disjoint resvg_test_suite_max_text and resvg_test_suite_max_nontext targets. For a direct invocation of the complete corpus in the full shaping tier, select resvg_test_suite_max explicitly. When using --config=ci for that invocation, add --test_tag_filters= to include the manual target.

The suite has these lanes, each a Bazel wrapper that bazel test //... runs:

Wrapper Backend Text tier Cases
resvg_test_suite_default_text TinySkia simple all
resvg_test_suite_max_text TinySkia full text-rendering
resvg_test_suite_max_nontext TinySkia full the rest
resvg_test_suite_geode Geode simple all
resvg_test_suite_geode_max_text Geode full text-rendering

The text-rendering cases are //third_party/resvg-test-suite:tests_with_text. Only their output depends on the text tier, so Geode with full shaping runs them alone; the other cases render the same in both tiers, and resvg_test_suite_geode compares them on Geode. Both Geode wrappers run only the GeodeGolden comparisons, as the CPU wrappers of the same cases run the TinyGolden ones. resvg_test_suite_max (manual) is the complete corpus in the full tier on TinySkia, and resvg_test_suite_wgpu_reference_linux (manual) compares the simple tier through the test-only wgpu-native reference.

Generated Parity Ledger

Generate a deterministic JSON ledger of every vendored case, active or disabled category, skip/render-only state, pixel budget, custom golden, backend mode, text-full gate, and recorded reason:

bazel run //tools/resvg_parity:parity_report -- --output /tmp/resvg-parity.json

The generator joins the C++ registration table to the vendored corpus and fails closed on duplicate registrations, unregistered categories, missing overrides, or malformed parameter expressions. //tools/resvg_parity:parity_report_tests verifies parser fixtures and the exact live-tree totals in Bazel runfiles. The report distinguishes explicit pixel-budget sources from effective cases after category defaults are applied, and counts the two render-without-compare buckets separately. The same test fails when a case renders without a comparison through anything but Params::UndefinedBehavior or Params::DeprecatedInSVG2, when an undefined-behavior case's reference is not the resvg UB marker image and the case is not in SPEC_UB_ALLOWLIST, or when a deprecated-in-SVG-2 case is not under a feature in DEPRECATED_IN_SVG2_FEATURES (both in parity_report.py; see the policy below).

The same test also enforces these registration rules, each against a list in parity_report.py:

  • Every golden override (WithGoldenOverride or withGeodeGoldenOverride) has a non-empty reason.
  • Every golden a registration compares against has a row in donner/svg/renderer/testdata/golden/README.md that names its path relative to that directory in backticks and gives the committed file's SHA-256.
  • PIXEL_BUDGET_ALLOWLIST records each compared lane whose mismatched-pixel budget is above the default 100, at its current value, and THRESHOLD_ALLOWLIST does the same for per-pixel color thresholds above 0.05. A lane above the limit without an entry fails, a value different from its entry fails, and an entry whose lane no longer exceeds the limit is stale and fails.
  • SKIP_ALLOWLIST equals the set of active Params::Skip rows. A new skip fails, and an entry whose row no longer skips is stale and fails.
  • QUARTER_PIXEL_EDGE_ALLOWLIST equals the set of active rows that opt their Geode comparison into the quarter-pixel edge coverage rule (withGeodeQuarterPixelEdgeCoverage(), see Quarter-pixel edge coverage on Geode). An opted-in row that is not listed fails, as does one that no Geode lane compares, that compares against a Geode golden or against a custom golden that the golden README does not record as quarter-pixel quantized, or that counts anti-aliased pixels; an entry whose row no longer opts in is stale and fails.
  • GEODE_GATE_ALLOWLIST maps each active row that disables its Geode comparison to the text tiers it disables it in (see Geode gates). A row that disables another backend, disables Geode without a reason, is not listed or is listed with other tiers fails; an entry whose row no longer disables Geode is stale and fails.

//tools/resvg_parity:parity_report_tests enforces in CI that each list matches the registry. That the lists only shrink is a review rule: a new entry, or a larger value, needs maintainer approval in the pull request that adds it.

--head-to-head compares Donner with resvg's own recorded results for the same snapshot, the resvg column of third_party/resvg-test-suite/results.csv:

bazel run //tools/resvg_parity:parity_report -- --head-to-head --output /tmp/resvg-head-to-head.json

It reports both pass counts, the margin (Donner passes minus resvg passes), a strict Donner count, the cases Donner passes and resvg does not (with resvg's recorded result), and the gap: cases resvg passes and Donner does not, with their state and reason.

A Donner pass is an active case registered to compare, by default or within its recorded settings, that disableBackend does not remove from every comparison mode; the count assumes the comparison tests are green, and a text-full or backend capability gate does not remove a case. It also credits two render-only contract rows listed in RENDER_PASS_CONTRACTS in parity_report.py, filters/feGaussianBlur/huge-stdDeviation and structure/svg/funcIRI-with-invalid-characters, whose reviewed contract is a completed render rather than a pixel match. Other render-only cases and skips are not passes; neither are resvg's unknown or crashed rows.

The strict count takes the compared cases only, so it excludes those two render-only credits, and then excludes every case whose params carry a pixel-budget or threshold call (WithThreshold, WithMaxPixels, withMaxPixelsDifferent, withSimpleTextMaxPixels or withGeodeMaxPixelsDifferent, even when the value equals the default) or a custom golden (WithGoldenOverride or withGeodeGoldenOverride). It still counts cases whose vendored reference is an upstream resvg rendering newer than the snapshot (provenance in third_party/resvg-test-suite/BUILD.bazel), cases whose reference is not 500x500, and cases behind a text-full or backend capability gate.

The rows in QUARTER_PIXEL_EDGE_ALLOWLIST are not strict passes either: their Geode comparison accepts pixels the default comparison counts.

Quarter-pixel edge coverage on Geode

The resvg references sample coverage on four sub-scanlines per pixel: a horizontal edge lands on the nearest quarter-pixel boundary, and an edge pixel with k of its four quarter rows covered is stored as 64 * k (255 when all four are). Donner's CPU renderer samples the same way and matches those edges. Geode computes exact coverage and stores round(255 * f) for the true coverage f, which is within 1/8 of k/4, so the two differ by up to 31.875 + 0.25 * k + 0.5 levels: 33 at k = 3. An edge row covered 0.625 px, as on the references' 1.25 px crosshair, is 192 in the reference and 159 on Geode. On text, whose glyph, decoration and crosshair edges are mostly such pixels, that difference alone can exceed the default 100-pixel budget.

A row whose Geode comparison against its vendored resvg reference exceeds its budget only because of that difference opts in with QuarterPixelEdgeReference() (or .withGeodeQuarterPixelEdgeCoverage() chained onto its other params) in resvg_test_suite.cc and is listed in QUARTER_PIXEL_EDGE_ALLOWLIST. Pixels the rule does not accept still count against the row's unchanged budget. A row that compares against a custom golden may opt in only when the golden is a Donner software renderer rendering listed in the "Quarter-pixel quantized goldens" table of donner/svg/renderer/testdata/golden/README.md: that renderer samples coverage as resvg does, and the table records the measurement. A browser rendering, an area-averaged image or a Geode golden is not quarter-pixel quantized, so its row cannot opt in.

For an opted-in row, the Geode comparison also accepts a pixel pixelmatch counts when:

  • both images cover it partially (alpha strictly between 0 and 255 in each);
  • in the reference, the pixel directly above or below it is empty or fully covered (a pixel outside the image does not count), and neither the pixel above nor the pixel below has its alpha;
  • the two alphas differ by at most 33 levels (svg_suite::kQuarterPixelEdgeCoverageMaxAlphaDelta); and
  • pixelmatch, at the row's threshold and background, finds no difference between the two straight colors when both carry the smaller alpha. Color is compared at the sensitivity pixelmatch applies to a pixel of that smaller coverage, so at very low alpha a color difference can fall under the threshold.

The vertical-neighbor condition follows the mechanism: a quantized edge row lies between a shape's inside and outside, so a pixel above or below it is empty or fully covered and differs from it. The condition is not limited to horizontal edges. It still accepts:

  • a feature one row tall, at any opacity;
  • each row of a two-row band whose rows differ in alpha and each border an empty or fully covered row, such as the references' crosshair;
  • the single partial pixel in a column of a shallow slanted or curved edge;
  • thin horizontal strokes of translucent text (text/tspan/with-opacity keeps 218 accepted pixels).

It rejects a uniform partially covered region two or more rows tall, the first row of a translucent shape directly below an opaque one, pure vertical edges, and the interior of a vertical alpha gradient. On resvg_test_suite_geode, across the 173 rows opted in there, the rule accepts 51,612 pixels on Metal and 51,610 on software Vulkan, and every row passes its unchanged budget.

The rule is part of the canonical comparison (svg_suite::ComparisonOptions::acceptQuarterPixelEdgeCoverage in tools/svg_suite/ImageCompare.h) and is off by default. It never applies to the CPU comparisons, to a comparison against a Geode golden, or to a pixel that is fully covered or empty in either image, and it does not change the pixel budget. The test log reports how many pixels it accepted and their largest alpha difference; the diff image draws them in blue. A row whose Geode comparison passes without the rule leaves the list.

The opt-in applies to both Geode lanes, resvg_test_suite_geode (simple text tier) and resvg_test_suite_geode_max_text (full shaping). The list holds 187 rows: the 173 that need the rule on the simple tier, which need it on the full tier too, and 14 rows that only the full tier renders (13 bidirectional, Arabic and complex-script rows, and text/text/emojis against its recorded Donner golden). On the full tier the rule accepts 55,653 pixels across those 187 rows on software Vulkan (55,657 on Metal), and the largest count it leaves is 91 of 100.

Geode gates

A row whose Geode comparison fails for a cause the edge coverage rule does not cover disables its Geode comparison with disableBackend(RendererBackend::Geode, reason), in both text tiers, and is listed in GEODE_GATE_ALLOWLIST; its CPU comparisons are unchanged. A cause that only the simple tier has uses disableGeodeForSimpleText(reason) instead, so the full-shaping lane still compares the row; the list records which tiers each row disables. The reason names the measured cause, and resvg_test_suite.cc keeps one helper per cause (for example GeodeUnquantizedGoldenGate) so the reason is written once. //tools/resvg_parity:parity_report_tests enforces in CI that the list matches the gated rows and that no other backend is disabled; that the list only shrinks is a review rule.

The results.csv values are manual visual judgments recorded with the snapshot, not a pixel diff, and current upstream resvg may score differently.

Some tests need a different reference, a documented comparison setting, or (for an unimplemented feature) a skip. To do this, per-test params may be specified. A test registration appears as:

INSTANTIATE_TEST_SUITE_P(
StrokeLinecap, ImageComparisonTestFixture,
Combine(
ValuesIn(getTestsInCategory(
"painting/stroke-linecap",
{
{"zero-length-path-with-round-cap.svg",
Params::Skip("Not impl: zero-length subpath caps (#NNNN)")},
})),
ValuesIn(ActiveComparisonModes())),
TestNameFromFilename);

getTestsInCategory(category, overrides, defaultParams) scans one category directory under the resvg-test-suite tree (e.g. painting/fill, filters/feBlend, text/text) and registers every .svg it finds. overrides is keyed by the bare filename (with extension) and sets per-test Params (skip, threshold, golden override, …); files not listed use defaultParams. Combine(..., ValuesIn(ActiveComparisonModes())) runs each test under every active comparison mode: one mode on CPU builds (TinyGolden) and two on the Geode build (TinyGolden and GeodeGolden). The former GeodeTinyParity pixel-vs-pixel mode is retired; both backends are independently gated against their reference goldens.

The test name is <SuiteName>/ImageComparisonTestFixture.ResvgTest/<sanitized-filename>, where the filename stem has every non-alphanumeric character replaced by _. For the example above:

StrokeLinecap/ImageComparisonTestFixture.ResvgTest/zero_length_path_with_round_cap

On the Geode build (multiple comparison modes) the mode is appended, for example ..._TinyGolden / ..._GeodeGolden.

Each comparison renders on the canvas its reference image was rendered on, so no registration states a canvas size. The harness reads the PNG header of the image the mode compares with (the vendored PNG, the WithGoldenOverride golden, or in the GeodeGolden mode the withGeodeGoldenOverride golden) and fits the document into the square of the image's longer side, the way resvg renders the suite: most references are 500x500, upstream resvg's newer references are 300x300, and a 2:1 document's 500x250 reference comes from a 500x500 canvas. An explicit .setCanvasSize(w, h) always takes precedence. Render-only cases (Params::UndefinedBehavior, Params::DeprecatedInSVG2) compare with no image and keep the suite's 500x500 canvas. parity_report derives the same canvas for each lane from the PNG header.

A reference that is missing or unreadable fails the case with a message naming the file, rather than rendering at a guessed size. The exception is golden regeneration: with UPDATE_GOLDEN_IMAGES_DIR set, a missing golden is rendered on the canvas of the case's vendored PNG and written, so deleting a Donner-rendered golden and rerunning its row regenerates it. Every golden has its vendored PNG's size except the 800x800 ones (resvg-half-box-blur.png, resvg-all-types-inline-*.png and resvg-complex-graphemes-and-coordinates-list.png), which are resvg renderings of independent scenes; regenerate those with the resvg commands in the golden README, not with UPDATE_GOLDEN_IMAGES_DIR, which would write them at their rows' 500x500 size. A new case whose vendored PNG is missing too needs an explicit .setCanvasSize(w, h).

To run a single test:

bazel run -c dbg //donner/svg/renderer/tests:resvg_test_suite -- \
--gtest_filter="*zero_length_path_with_round_cap"

If a test is skipped, it is still useful to manually run it without editing resvg_test_suite.cc. Params::Skip(...) prefixes the generated gtest name with DISABLED_. Run those tests with gtest's disabled-test flag and a narrow filter; text-full-only tests still require a text-full build.

To run a skipped test:

bazel run -c dbg //donner/svg/renderer/tests:resvg_test_suite -- \
--gtest_filter="*zero_length_path_with_round_cap" --gtest_also_run_disabled_tests

With suffix-matching, the same test identifier can be used.

Triaging Test Failures

When tests fail, follow this systematic approach to triage and document them:

1. Run the Failing Tests

First, identify which tests are failing:

bazel run //donner/svg/renderer/tests:resvg_test_suite -c dbg -- '--gtest_filter=TextFontWeight/*'

Look for tests marked as FAIL and note the pixel difference count. Tests pass if the count of pixels whose color difference exceeds the threshold (default 0.02) is within the pixel budget (default 100 pixels).

2. Examine the Test Output

When a test fails, the framework provides detailed diagnostic information:

Test Failure Header

[ COMPARE ] .../tests/text/word-spacing/simple-case.svg [TinySkia]: FAIL (8234 pixels differ, with 100 max)
  • FAIL: Test failed (vs PASS for success)
  • [TinySkia]: which backend rendered this comparison (TinySkia, or a Geode* mode)
  • 8234 pixels differ: Number of pixels that don't match between actual and expected
  • with 100 max: Pixel budget for passing (tests pass if pixel diff ≤ 100)

Verbose Rendering Output

When a test fails, it re-renders with verbose logging showing:

Document world from canvas transform: matrix(2.5 0 0 2.5 0 0)
Instantiating SVG id=svg1 #1
Instantiating Text id=text1 #5
Rendering Text id=text1 #5 transform=matrix(2.5 0 0 2.5 0 0)

This shows:

  • Canvas transform: The scaling/transform applied to the entire SVG
  • Instantiating: Elements being created from the SVG DOM
  • Rendering: Elements being drawn to the canvas with their transforms

SVG Source Display

The complete SVG source is printed inline:

SVG Content for simple-case.svg:
---
<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"
font-family="Noto Sans" font-size="48">
<title>word-spacing</title>
<text id="text1" x="30" y="100" word-spacing="10">Two words</text>
</svg>
---

Look for:

  • <title>: Describes what the test validates
  • Element attributes: Features being tested (e.g., multiple x/y values)
  • Complexity: Number of elements and their properties

Output File Paths

On failure, three PNGs are written to $TEST_UNDECLARED_OUTPUTS_DIR (Bazel exposes this under bazel-testlogs/.../test.outputs/), named after the sanitized test:

actual_<name>.png — Donner's output (what the renderer currently produces)
expected_<name>.png — the resvg golden (reference rendering)
diff_<name>.png — per-pixel difference highlight

actual (Donner's output): what the renderer currently produces.

expected (golden reference): the resvg-test-suite PNG for this test, from the bazel runfiles directory, generated by resvg.

diff (visual comparison): highlights where actual and expected differ — red/orange pixels mark differing pixels, colored outlines mark positional differences.

Interpreting Output Files

What to look for:

  • Diff image:
    • Solid red areas = completely different pixels
    • Colored outlines = positional/alignment differences
    • Minimal differences = still a real cause to find; do not widen the threshold or budget to absorb them
    • Large differences = missing feature or wrong implementation
  • Actual vs Expected:
    • Compare side-by-side to understand the failure
    • Missing elements = not implemented
    • Wrong position = baseline/positioning issue
    • Wrong style = font/styling issue
    • Whole-shape or per-glyph offset = a real coordinate-space / layout bug, not "AA"

3. Analyze the Failure

Based on the output, determine what's causing the failure:

Check the SVG source (printed in test output):

  • Look at the <title> to understand test intent
  • Identify which SVG features are being tested
  • Note complex attributes or patterns

Compare images:

  • Open the diff image to see where differences are
  • Compare actual vs expected side-by-side
  • Assess the magnitude of differences (pixel count)

Review verbose output:

  • Check if elements are being instantiated
  • Verify transforms are being applied
  • Look for errors or warnings in the render log

4. Categorize the Failure

Common failure categories:

  • Not implemented: Feature doesn't exist yet (e.g., <tspan>, writing-mode). With a tracking issue, this is the only new Params::Skip, and it needs maintainer approval to join SKIP_ALLOWLIST. Skipped cases do not render, so they lose no-crash and sanitizer coverage.
  • Undefined behavior: The specification leaves the behavior undefined or implementation-defined, or the vendored reference is the resvg UB marker image (a byte-for-byte copy of third_party/resvg-test-suite/resources/ub.png); Params::UndefinedBehavior(reason) renders without a comparison.
  • Deprecated in SVG 2: The case exercises a feature SVG 2 removed or deprecated and Donner deliberately does not implement (see docs/unsupported_svg1_features.md); Params::DeprecatedInSVG2(reason) renders without a comparison. A removed feature with a UB marker reference belongs here.

    Nothing else renders without a comparison, and a case that passes the default comparison compares.

  • Reference disagreement, harness mismatch, or API-policy difference: Donner follows the specification and the vendored reference does not, the harness and reference disagree (for example an opaque reference background), or Donner's API policy differs. These are not skips: the case compares against a Donner-rendered golden with a recorded justification, via Params::WithGoldenOverride(path, threshold, "Reference disagreement: <what the vendored PNG gets wrong>") (or Harness mismatch: / API policy:), plus an entry in tools/resvg_parity/exception_policies.json and a row with the golden's SHA-256 in donner/svg/renderer/testdata/golden/README.md.
  • Bug: Wrong output for an implemented feature. Find the root cause (wrong transform, coverage geometry, color space, premultiplication, layer compositing) and fix the engine. Note: pixelmatch already excludes anti-aliased edge pixels, so a diff our harness reports is never "just AA": a diff large enough to fail a test has a real cause (see CLAUDE.md §"Anti-Aliasing Is Never the Root Cause"). A pixel budget in the hundreds is not accepted: fix the engine, or hold the row back from the change until it is fixed.

5. Document in resvg_test_suite.cc

Add the test to the appropriate INSTANTIATE_TEST_SUITE_P block with params and a reason. For an approved skip of an unimplemented feature:

INSTANTIATE_TEST_SUITE_P(
TextWordSpacing, ImageComparisonTestFixture,
Combine(
ValuesIn(getTestsInCategory(
"text/word-spacing",
{
{"simple-case.svg", Params::Skip("Not impl: word-spacing (#NNNN)")},
{"negative.svg", Params::Skip("Not impl: word-spacing (#NNNN)")},
})),
ValuesIn(ActiveComparisonModes())),
TestNameFromFilename);

Skip reason formats. A new skip uses only the first form. The second is the form of the one skip already in SKIP_ALLOWLIST, kept until it is fixed; do not add new ones:

  • Not impl: <feature> (#<issue>) - an unimplemented feature with its tracking issue.
  • Unsupported input: <input> (#<issue>) - an input the parser does not accept (structure/svg/not-UTF-8-encoding).

Other reason formats:

  • Params::WithGoldenOverride(path, threshold, "Reference disagreement: <what the vendored PNG gets wrong>") (or Harness mismatch: / API policy:) - compares against a Donner-rendered golden; record its provenance and SHA-256 in the golden README.
  • Params::UndefinedBehavior("<reason>") - Undefined behavior or a UB marker reference (renders, no compare). The factory name carries the classification, so the reason only explains it.
  • Params::DeprecatedInSVG2("<feature> (removed in SVG 2)") - Removed or deprecated SVG 2 feature (renders, no compare). Add the feature to DEPRECATED_IN_SVG2_FEATURES in tools/resvg_parity/parity_report.py first; //tools/resvg_parity:parity_report_tests fails otherwise.
  • Params::WithThreshold(t, maxPx) - only after a root-cause investigation, with the reason. Never widen a threshold to absorb a diff you haven't explained (see CLAUDE.md / AGENTS.md). A threshold above 0.05 or a budget above 100 pixels must already be in THRESHOLD_ALLOWLIST or PIXEL_BUDGET_ALLOWLIST; new entries need maintainer approval.
  • Reference rasterizer generation: <cause>; analytic residual N px, supersampled M px - a per-case pixel budget (withMaxPixelsDifferent or WithMaxPixels, default color threshold, no other exception) for a reference drawn with 4x4 supersampled edge coverage where Donner's analytic coverage differs, typically on the 1.25 px crosshair. Allowed only when a 4x4 supersampled render of the case compares within the default allowance (M <= 100), the residual is edge coverage with matching layout, and the budget is the largest residual on macOS and Linux for both CPU text tiers (and Geode where it runs) plus 3% rounded up to 5 pixels. Record what a 1 px text shift does against the budget.
  • Params().withGeodeQuarterPixelEdgeCoverage() - a row whose Geode comparison fails only on the reference's quarter-pixel edge quantization; see Quarter-pixel edge coverage on Geode. The row must already be in QUARTER_PIXEL_EDGE_ALLOWLIST; new entries need maintainer approval.
  • Reference label glyphs: <cause>; analytic residual N px, supersampled M px - the same form for a reference set whose label glyphs differ beyond coverage (the color-adjust-functions cases), where the residual is confined to the labels and deliberate filter regressions are shown to exceed the budget. parity_report_tests checks the form of both classes; the evidence and per-case numbers are in design doc 0021.

6. Group Related Failures

Within a category's override map, group the entries by reason with a short comment so the gaps read at a glance:

{
// Not impl: variable-font weight axis
{"variable-weight.svg", Params::Skip("Not impl: variable-font weight (#NNNN)")},
{"weight-interpolation.svg", Params::Skip("Not impl: variable-font weight (#NNNN)")},
}

Each resvg category is its own getTestsInCategory(...) block, so a feature that shows up in more than one category (e.g. text/font-weight and painting/fill) is tracked once per category, not in a shared list.

7. Verify Skip Configuration

After adding skips, verify tests run correctly:

bazel run //donner/svg/renderer/tests:resvg_test_suite -c dbg -- '--gtest_filter=TextFontWeight/*'

You should see:

  • Skipped tests don't run
  • Passing tests still pass
  • Clear count of passed/skipped tests

Example Triage Workflow

  1. Run tests
    bazel run //donner/svg/renderer/tests:resvg_test_suite -c dbg -- '--gtest_filter=TextFontWeight/*'
  2. Examine the SVG of the failing test (printed as output)
  3. Open the diff image to see where differences are
  4. Identify the cause of the failure. Fix the root cause in Donner; for a reference disagreement, harness mismatch or API-policy difference, compare against a Donner-rendered golden with a recorded justification; skip only an unimplemented feature with a tracking issue and maintainer approval.

Tips

  • Visual inspection: Always view the diff images to understand the nature of failures
  • Magnitude is the tell: hundreds of differing pixels, per-glyph drift, or whole-shape offsets are a real bug — pixelmatch already excludes AA, so the diff is not edge anti-aliasing
  • Categorize systematically: Group tests by missing feature for easier tracking
  • Keep comments concise: Use the established format from existing tests

MCP Servers

The resvg-test-triage MCP server provides automated test analysis. When available, use it to:

Batch analyze test failures:

# After running tests, pass output to MCP server
result = await mcp.call_tool("batch_triage_tests", {
"test_output": test_output_string
})
# Server returns:
# - Categorized failures by feature
# - Suggested skip comments
# - Grouping recommendations

Analyze individual tests:

result = await mcp.call_tool("analyze_test_failure", {
"test_name": "e-text-023.svg",
"svg_content": svg_source,
"pixel_diff": 8234
})
# Returns feature detection, category, and skip suggestion

Get implementation guidance (NEW):

# Find which files to modify for a missing feature
result = await mcp.call_tool("suggest_implementation_approach", {
"test_name": "e-text-031.svg",
"features": ["writing_mode"],
"category": "text_layout",
"codebase_files": [] # Optionally provide files from glob/grep
})
# Returns:
# - Ranked list of files to modify
# - Search keywords for finding similar features
# - Implementation hints specific to the feature

Find related tests for batch implementation (NEW):

# Discover all tests failing for the same feature
result = await mcp.call_tool("find_related_tests", {
"feature": "writing-mode",
"skip_file_content": resvg_test_suite_cc_content
})
# Returns:
# - List of all tests with this feature (e.g., e-text-031, e-text-033)
# - Impact assessment and priority (low/medium/high)
# - Batch implementation opportunity!

Track feature progress (NEW):

# Generate progress report for a test category
result = await mcp.call_tool("generate_feature_report", {
"category": "e-text",
"test_output": bazel_test_output,
"skip_file_content": resvg_test_suite_cc_content
})
# Returns:
# - Pass/fail/skip counts
# - Completion rate percentage
# - Next priority feature by test impact
# - List of all missing features

Analyze visual differences (NEW):

# Programmatically analyze diff images
result = await mcp.call_tool("analyze_visual_diff", {
"diff_image_path": "/tmp/diff_e-text-031.png",
"actual_image_path": "/tmp/e-text-031.png",
"expected_image_path": "/path/to/resvg-test-suite/png/e-text-031.png"
})
# Returns:
# - Difference type: positioning/missing_element/styling/anti_aliasing
# - Visual analysis metrics (pixel counts, regions, offsets)
# - Likely cause with confidence score

Setup:

  1. Install: pip install -e tools/mcp-servers/resvg-test-triage
  2. Configure in MCP settings:
    • Claude Code: See tools/mcp-servers/resvg-test-triage/mcp-config-example.json
    • VSCode: Add to .vscode/mcp.json (see README for format)
  3. Use tools during test triage

Benefits:

  • Consistent categorization across all tests
  • Auto-detection of SVG features being tested
  • Batch processing of 50+ test failures
  • Properly formatted skip comments
  • Vision model analysis with actual, expected, and diff images
  • Implementation guidance - suggests files to modify
  • Batch opportunities - find all tests for same feature
  • Progress tracking - monitor feature completion
  • Visual analysis - categorize diff types automatically

See resvg-test-triage README for full documentation.