Stores an ASCII representation of a rendered image, and supports diffing it to another image.
More...
#include "donner/svg/renderer/tests/RendererTestUtils.h"
|
| bool | matches (std::string_view golden) const |
| | Compare the rendered ASCII image to a golden ASCII string, and output the image differences if any.
|
|
|
std::string | generated |
| | ASCII art of generated image, with lines separated by \n.
|
Stores an ASCII representation of a rendered image, and supports diffing it to another image.
◆ matches()
| bool donner::svg::AsciiImage::matches |
( |
std::string_view | golden | ) |
const |
|
inline |
Compare the rendered ASCII image to a golden ASCII string, and output the image differences if any.
Example:
<rect width="8" height="8" fill="white" />
)");
EXPECT_TRUE(generatedAscii.matches(R"(
@@@@@@@@........
@@@@@@@@........
@@@@@@@@........
@@@@@@@@........
@@@@@@@@........
@@@@@@@@........
@@@@@@@@........
@@@@@@@@........
................
................
................
................
................
................
................
................
)"));
static AsciiImage renderToAsciiImage(std::string_view svgFragment, Vector2i size=kTestSvgDefaultSize)
Render the given SVG fragment into ASCII art.
Definition RendererTestUtils.h:153
Stores an ASCII representation of a rendered image, and supports diffing it to another image.
Definition RendererTestUtils.h:31
bool matches(std::string_view golden) const
Compare the rendered ASCII image to a golden ASCII string, and output the image differences if any.
Definition RendererTestUtils.h:68
- Parameters
-
| golden | The golden ASCII image to compare the rendered output to, which should be a multiline string, whitespaces and the first newlines are removed. |
- Returns
- true if the image matches.
The documentation for this struct was generated from the following file:
- donner/svg/renderer/tests/RendererTestUtils.h