From: Magnus Jacobsson Date: Wed, 27 Jul 2022 12:28:44 +0000 (+0200) Subject: tests: SvgAnalyzer: add comment with graph title (ID) to the recreated SVG X-Git-Tag: 5.0.1~7^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42b16b5a0c66deb829db66b56690376dcfab7b0d;p=graphviz tests: SvgAnalyzer: add comment with graph title (ID) to the recreated SVG --- diff --git a/tests/svg_element.cpp b/tests/svg_element.cpp index a0d32efa5..c842a4b90 100644 --- a/tests/svg_element.cpp +++ b/tests/svg_element.cpp @@ -49,6 +49,11 @@ void SVG::SVGElement::to_string_impl(std::string &output, const auto indent_str = std::string(current_indent, ' '); output += indent_str; + if (type == SVG::SVGElementType::Svg) { + const auto comment = fmt::format("Title: {} Pages: 1", 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 f052a55a8..84a2f37ee 100644 --- a/tests/test_svg_analyzer.cpp +++ b/tests/test_svg_analyzer.cpp @@ -124,8 +124,8 @@ TEST_CASE( for (std::size_t i = 0; i < original_svg_lines.size(); i++) { REQUIRE(i < recreated_svg_lines.size()); if (recreated_svg_lines[i] == "") { - // stop comparison here since we do not yet handle the graph title - // comment that comes before the 'svg' element + // stop comparison here since we do not yet handle attributes on the + // 'svg' element break; } REQUIRE(recreated_svg_lines[i] == original_svg_lines[i]);