// ignore for now
break;
case SVG::SVGElementType::Svg:
- attributes_str +=
- fmt::format(R"(width="{}pt" height="{}pt")"
- "\n"
- R"( viewBox="{:.2f} {:.2f} {:.2f} {:.2f}")",
- std::lround(px_to_pt(attributes.width)),
- std::lround(px_to_pt(attributes.height)),
- attributes.viewBox.x, attributes.viewBox.y,
- attributes.viewBox.width, attributes.viewBox.height);
+ attributes_str += fmt::format(
+ R"(width="{}pt" height="{}pt")"
+ "\n"
+ R"( viewBox="{:.2f} {:.2f} {:.2f} {:.2f}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink")",
+ std::lround(px_to_pt(attributes.width)),
+ std::lround(px_to_pt(attributes.height)), attributes.viewBox.x,
+ attributes.viewBox.y, attributes.viewBox.width,
+ attributes.viewBox.height);
break;
case SVG::SVGElementType::Text:
// ignore for now
boost::split(recreated_svg_lines, recreated_svg, boost::is_any_of("\n"));
for (std::size_t i = 0; i < original_svg_lines.size(); i++) {
REQUIRE(i < recreated_svg_lines.size());
- if (recreated_svg_lines[i].starts_with("<svg width=\"")) {
+ if (recreated_svg_lines[i] == "<g class=\"graph\">") {
// stop comparison here since we do not yet handle all attributes on the
- // 'svg' element
+ // 'g' element
break;
}
REQUIRE(recreated_svg_lines[i] == original_svg_lines[i]);
// do some sanity checks of the parts of the recreated SVG that we cannot
// yet compare with the original SVG
- CHECK(recreated_svg.find("<svg width=\"") != std::string::npos);
- CHECK(recreated_svg.find("\" height=\"") != std::string::npos);
- CHECK(recreated_svg.find("\n viewBox=\"") != std::string::npos);
- CHECK(recreated_svg.find("</svg>") != std::string::npos);
CHECK(recreated_svg.find("<g class=\"graph\">") != std::string::npos);
CHECK(recreated_svg.find("<g class=\"node\">") != std::string::npos);
CHECK(recreated_svg.find("<g class=\"edge\">") != std::string::npos);