Debian Codegraph @

tests/test_svg_analyzer_color.cpp

raw
1 #include <format>
2 #include <string_view>
3
4 #include <catch2/catch_all.hpp>
5
6 #include "svg_analyzer.h"
7 #include "test_utilities.h"
8
9 TEST_CASE("SvgAnalyzer color",
10 "Test that the SvgAnalyzer can recreate the original "
11 "SVG with the correct `stroke` and `stroke-opacity` attributes when "
12 "the Graphviz `color` attribute is used for nodes and edges ") {
13
14 const auto shape = GENERATE(from_range(all_node_shapes));
15 INFO("Shape: " << shape);
16
17 const std::string_view color =
18 GENERATE("", "\"#10204000\"", "\"#10204080\"", "\"#102040ff\"");
19 INFO("Color: " << color);
20 const auto color_attr = color.empty() ? "" : std::format(" color={}", color);
21
22 auto dot = std::format("digraph g1 {{node [shape={}{}]; edge [{}]; a -> b}}",
23 shape, color_attr, color_attr);
24
25 SVGAnalyzer::make_from_dot(dot).re_create_and_verify_svg();
26 }