From: Magnus Jacobsson Date: Wed, 24 Aug 2022 09:54:30 +0000 (+0200) Subject: tests: SVGAnalyzer: add retrieval of edge arrow to GraphvizEdge X-Git-Tag: 6.0.2~34^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76e40a5b1d85d7e0645865e459b2361e71dd7134;p=graphviz tests: SVGAnalyzer: add retrieval of edge arrow to GraphvizEdge --- diff --git a/tests/graphviz_edge.cpp b/tests/graphviz_edge.cpp index 26e3b4f82..866e70ed5 100644 --- a/tests/graphviz_edge.cpp +++ b/tests/graphviz_edge.cpp @@ -16,6 +16,10 @@ void GraphvizEdge::add_outline_overlap_bbox(const GraphvizNode &node, m_svg_g_element.add_outline_overlap_bbox(node.svg_g_element(), tolerance); } +SVG::SVGElement &GraphvizEdge::arrow(const std::size_t index) const { + return m_svg_g_element.find_child(SVG::SVGElementType::Polygon, index); +} + std::string_view GraphvizEdge::edgeop() const { return m_edgeop; } std::string GraphvizEdge::fillcolor() const { diff --git a/tests/graphviz_edge.h b/tests/graphviz_edge.h index bd6f8423f..e2fcde1d8 100644 --- a/tests/graphviz_edge.h +++ b/tests/graphviz_edge.h @@ -28,6 +28,11 @@ public: /// element. The outline bounding box is the bounding box with penwidth taken /// into account. void add_outline_overlap_bbox(const GraphvizNode &node, double tolerance = 0); + /// Return the edge arrowhead/arrowtail with the specified index. If there's + /// both an arrowhead and an arrowtail, the arrowtail is at index 0 and the + /// arrowhead is at index 1. If there's only one, it's at index 0. Throws an + /// exception if there's no arrow at the specified index. + SVG::SVGElement &arrow(std::size_t index = 0) const; /// Return the bounding box of the edge SVG::SVGRect bbox() const; /// Return the center of the edge's bounding box