|
|
Donner 0.5.0
Embeddable browser-grade SVG2 engine
|
Test utilities for rendering and saving SVGs in tests. More...
#include "donner/svg/renderer/tests/RendererTestUtils.h"
Static Public Member Functions | |
| static bool | IsTinySkiaBackend () |
| Returns true when the active test renderer backend is tiny-skia. | |
| static std::string | snapshotToAscii (const RendererBitmap &snapshot) |
| Convert a snapshot bitmap to ASCII art, mapping grayscale intensity to ten glyph levels. | |
| static AsciiImage | renderToAsciiImage (std::string_view svgFragment, Vector2i size=kTestSvgDefaultSize) |
| Render the given SVG fragment into ASCII art. | |
| static AsciiImage | renderToAsciiImage (SVGDocument document) |
| Render the given SVGDocument into ASCII art. | |
Test utilities for rendering and saving SVGs in tests.
|
inlinestatic |
Render the given SVG fragment into ASCII art.
The generated image is of the given size, and has a black background.
Colors will be mapped to ASCII characters, with @ white all the way to . black, with ten shades of gray.
To compare the generated ASCII image to a golden ASCII string, use matches on the returned AsciiImage object.
Example:
| svgFragment | The SVG fragment to render. |
| size | The size of the generated image. |
|
inlinestatic |
Render the given SVGDocument into ASCII art.
The generated image is of given size, and has a black background.
Colors will be mapped to ASCII characters, with @ white all the way to . black, with ten shades of gray.
To compare the generated ASCII image to a golden ASCII string, use matches on the returned AsciiImage object.
| document | SVG document to render, of max size 64x64. |
|
inlinestatic |
Convert a snapshot bitmap to ASCII art, mapping grayscale intensity to ten glyph levels.
| snapshot | Renderer snapshot in RGBA format. |