]> granicus.if.org Git - graphviz/commitdiff
tests: SvgAnalyzer: add a graphvizEdge class
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Wed, 17 Aug 2022 10:52:20 +0000 (12:52 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 23 Aug 2022 06:19:35 +0000 (08:19 +0200)
tests/CMakeLists.txt
tests/graphviz_edge.cpp [new file with mode: 0644]
tests/graphviz_edge.h [new file with mode: 0644]

index d82c47372adc6e0f50f9c75b00b3fbbf7ad148b8..9f48cd86efbf01c2ec1181ebea23b46a05741e0a 100644 (file)
@@ -12,6 +12,8 @@ enable_testing()
 # separate test can be as small as possible
 add_library(test_common SHARED
             catch2_main.cpp
+            graphviz_edge.cpp
+            graphviz_edge.h
             graphviz_node.h
             graphviz_node.cpp
             test_utilities.cpp
diff --git a/tests/graphviz_edge.cpp b/tests/graphviz_edge.cpp
new file mode 100644 (file)
index 0000000..8780002
--- /dev/null
@@ -0,0 +1,8 @@
+#include "graphviz_edge.h"
+
+GraphvizEdge::GraphvizEdge(SVG::SVGElement &svg_g_element)
+    : m_svg_g_element(svg_g_element) {}
+
+const SVG::SVGElement &GraphvizEdge::svg_g_element() const {
+  return m_svg_g_element;
+}
diff --git a/tests/graphviz_edge.h b/tests/graphviz_edge.h
new file mode 100644 (file)
index 0000000..fc83d33
--- /dev/null
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "svg_element.h"
+
+/**
+ * @brief The GraphvizEdge class represents a Graphviz edge according to the DOT
+ * language
+ */
+
+class GraphvizEdge {
+public:
+  GraphvizEdge() = delete;
+  explicit GraphvizEdge(SVG::SVGElement &svg_g_element);
+
+  /// Return a non-mutable reference to the SVG `g` element corresponding to the
+  /// edge
+  const SVG::SVGElement &svg_g_element() const;
+
+private:
+  /// The SVG `g` element corresponding to the edge
+  SVG::SVGElement &m_svg_g_element;
+};