]> granicus.if.org Git - graphviz/commitdiff
tests: SvgAnalyzer: add a graphvizNode class
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 25 Jul 2022 12:30:05 +0000 (14:30 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 23 Aug 2022 06:19:35 +0000 (08:19 +0200)
tests/CMakeLists.txt
tests/graphviz_node.cpp [new file with mode: 0644]
tests/graphviz_node.h [new file with mode: 0644]

index 0ccd8cc982bf8b524738d910c12b1ef81f45dab5..d82c47372adc6e0f50f9c75b00b3fbbf7ad148b8 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_node.h
+            graphviz_node.cpp
             test_utilities.cpp
             svgpp_context.cpp
             svgpp_context.h
diff --git a/tests/graphviz_node.cpp b/tests/graphviz_node.cpp
new file mode 100644 (file)
index 0000000..fe1f486
--- /dev/null
@@ -0,0 +1,8 @@
+#include "graphviz_node.h"
+
+GraphvizNode::GraphvizNode(SVG::SVGElement &svg_element)
+    : m_svg_g_element(svg_element) {}
+
+const SVG::SVGElement &GraphvizNode::svg_g_element() const {
+  return m_svg_g_element;
+}
diff --git a/tests/graphviz_node.h b/tests/graphviz_node.h
new file mode 100644 (file)
index 0000000..8574943
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <string>
+
+#include "svg_element.h"
+
+/**
+ * @brief The GraphvizNode class represents a Graphviz node according to the DOT
+ * language
+ */
+
+class GraphvizNode {
+public:
+  GraphvizNode() = delete;
+  explicit GraphvizNode(SVG::SVGElement &svg_element);
+
+  /// Return a non-mutable reference to the SVG `g` element corresponding to the
+  /// node
+  const SVG::SVGElement &svg_g_element() const;
+
+private:
+  /// The SVG `g` element corresponding to the node
+  SVG::SVGElement &m_svg_g_element;
+};