From: Magnus Jacobsson Date: Fri, 29 Jul 2022 14:07:37 +0000 (+0200) Subject: tests: SvgAnalyzer: add node and edge ID comments to the recreated SVG X-Git-Tag: 5.0.1~7^2~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5d7a10c55e52feb461c649d7287632c66d62d59;p=graphviz tests: SvgAnalyzer: add node and edge ID comments to the recreated SVG --- diff --git a/tests/svg_element.cpp b/tests/svg_element.cpp index 97c4545ef..efce9e1c9 100644 --- a/tests/svg_element.cpp +++ b/tests/svg_element.cpp @@ -55,6 +55,11 @@ void SVG::SVGElement::to_string_impl(std::string &output, const auto comment = fmt::format("Title: {} Pages: 1", graphviz_id); output += fmt::format("\n", xml_encode(comment)); } + if (type == SVG::SVGElementType::Group && + (attributes.class_ == "node" || attributes.class_ == "edge")) { + const auto comment = graphviz_id; + output += fmt::format("\n", xml_encode(comment)); + } output += "<"; output += tag(type); diff --git a/tests/test_svg_analyzer.cpp b/tests/test_svg_analyzer.cpp index fb97d6ae2..2a32ebcb5 100644 --- a/tests/test_svg_analyzer.cpp +++ b/tests/test_svg_analyzer.cpp @@ -148,5 +148,8 @@ TEST_CASE( } CHECK(recreated_svg.find("") != std::string::npos); CHECK(recreated_svg.find("") != std::string::npos); + CHECK(recreated_svg.find("") != std::string::npos); + CHECK(recreated_svg.find("") != std::string::npos); + CHECK(recreated_svg.find("") != std::string::npos); } }