graphics-testing
Garnet graphics testing
A development dependency for concrete renderer shards. require "garnet-graphics-testing" exports Garnet::Graphics::Testing.quad, .draws, and .bytes(image) for backend conformance tests. Fixtures contain only generic graphics values; this shard has no native/backend dependencies.
The fixture exercises rotated atlas UVs, sRGB colors, alpha blending, nearest/linear sampling, tint and transformed geometry. Each renderer can consume the same values and compare explicit readback. Declare this shard in development_dependencies; never require files from a sibling shard's spec directory.
UI fixtures additionally exercise Yoga flexbox layout, measured/shaped labels, separate generated placement and authored transforms, rectangle clipping, presented-frame hit tests and retained output across resize. The native resizable menu can be built with scripts/check-composition example-ui; see garnet-ui for input, smoke-test and HiDPI details.
The optional Spine fixtures render region, weighted/deformed mesh, clipping and overlapping additive-slot snapshots on each backend. They use small authored JSON/atlas data and generated white texture content. Spine remains a development dependency of the composition suite, with its separate runtime license; the generic fixture export does not load it. Build the scene socket example with scripts/check-composition example-spine.
Mixed composition gallery
The shared composition specs cover vectors, meshes, raster sprites, group opacity, alpha/luminance/inverted masks, retained output versions, live viewport sampling, curved strokes, antialiasing, nested clips, and linear/radial gradients. Gradient fixtures check local coordinates, spread, hard stops, premultiplied interpolation, masking and explicit backend limits. From the workspace:
scripts/check-composition unit
scripts/check-composition gl
scripts/check-composition gles
scripts/check-composition metal
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation scripts/check-composition vulkan
scripts/check-composition example-metal
GARNET_EXAMPLE_FRAMES=120 "${TMPDIR:-/tmp}/garnet-composition-metal"
Use example-gl or example-vulkan to build the same gallery for those APIs. On macOS, Vulkan requires an installed loader/ICD; the workspace script includes /usr/local/lib loader paths. Scene/vector/backend packages are development dependencies of this fixture shard, not dependencies of its generic fixture export.
From this directory, shards install followed by crystal run examples/composition.cr runs GL. Add -Dcomposition_metal for Metal. Vulkan uses -Dcomposition_vulkan and the linker/runtime paths for your installed loader.
Image-pattern fixtures additionally cover fills/strokes/meshes, independent axis addressing, paint transforms, atlas rotation and trim, premultiplied linear filtering without atlas bleed, sRGB decode, and retained scene captures reused directly on GPU. Live-pattern fixtures cover scene updates, retained drawing/output versions, independent tile resolution/size, clipping/opacity, and nested drawing patterns without ECS. The gallery includes a repeating mixed vector/raster tile with an animated dot.
Arc fixtures cover rotated elliptical fills, SVG endpoint-arc strokes, clipped image patterns and transformed gradient geometry. Vector unit tests additionally check all SVG sweep/large-arc choices, radius correction, degenerate inputs, analytic curve error, subdivision limits and immutable snapshots. The gallery's dashed orbit uses an analytic rotated ellipse.
garnet-svg adds standalone path-parser and document-loader tests. Shared rendering fixtures cover parsed paths used as clips/strokes, root and nested viewBox alignment, nested viewport clipping, symbol instances, inherited colors, isolated group opacity, and SVG pictures placed inside scenes and recorded drawings. The gallery loads its icon as an SVG document with nested SVG/symbol content plus gradient, pattern, blur and mask resources. Gradient fixtures additionally verify SVG coordinate units, straight-alpha sRGB/linear interpolation, radial object bounds, focal circles and transformed repeating strokes. SVG vector-pattern fixtures rasterize retained tile drawings through each backend and sample the produced texture through the generic pattern path.
SVG effect fixtures cover clip unions/holes/intersections, direct shape instances, transformed group bounds including unpainted geometry, alpha and sRGB/linear luminance masks, mask regions/content units, resource display semantics and gradient mask content. A neutral-mask fixture verifies inverted sRGB luminance with translucent pixels. The gallery icon uses an SVG gradient alpha mask.
The SVG filter fixture chains color-matrix and Gaussian-blur primitives, checks filter-region clipping, and verifies that drawing-unit blur scales when the same parsed picture is transformed. The filter description remains backend-neutral and executes through the shared full-target effect planner.
The SVG image fixture injects a generic texture through the loader's code-first resolver, then verifies intrinsic aspect mapping and image-viewport clipping on each renderer. The SVG shard itself does not choose a decoder or perform I/O.
Path measurement fixtures check trimmed contour breaks and sampled positions on curves through every backend. The gallery reuses one measurement to animate a partial stroke and a marker along its source curve.
The composition suite also verifies analytic path operations, optional Clipper2 Boolean/triangulation output, two-circle gradients, blur/color-matrix chains, all sixteen group blend modes, partial-alpha and chromatic blends, and scene effect extraction. scripts/check-composition builds the pinned Clipper2 native dependency for these tests; the core graphics/vector shards do not acquire that dependency.
garnet-lottie fixtures exercise timeline-driven translation, retained geometry, reverse seeking, shape stacking, path morphing and atomic opacity. Morph tests preserve prior rendered output while publishing new geometry. Independent pinned ThorVG captures check path fills/strokes, rounded rectangles, ellipses and animated transforms at two scales. Comparisons cover flat reference interiors rather than rasterizer-specific antialiased edges. The evaluator report documents provenance and the separate specification-based opacity regression.
The gallery and composition fixtures include shaped Latin and Arabic text through garnet-text-harfbuzz, including ligature/cluster checks, glyph counters, run-wide gradients and scene drawables. They also exercise garnet-text-layout with fallback, mixed bidi runs, hard line breaks, wrapping, and paragraph lowering through the same scene drawable on every backend. Install HarfBuzz 14+, FriBidi, libunibreak, and pkg-config for these optional test dependencies. Test fonts are pinned Noto fixtures with their OFL license in harfbuzz.cr/spec/fonts; applications select their own font content sources.
graphics-testing
- 0
- 0
- 0
- 3
- 21
- about 9 hours ago
- November 30, 2026
MIT License
Wed, 02 Dec 2026 02:09:13 GMT