From 76e40a5b1d85d7e0645865e459b2361e71dd7134 Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Wed, 24 Aug 2022 11:54:30 +0200 Subject: [PATCH] tests: SVGAnalyzer: add retrieval of edge arrow to GraphvizEdge --- tests/graphviz_edge.cpp | 4 ++++ tests/graphviz_edge.h | 5 +++++ 2 files changed, 9 insertions(+) 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 -- 2.40.0