From: Magnus Jacobsson Date: Mon, 25 Jul 2022 12:30:05 +0000 (+0200) Subject: tests: SvgAnalyzer: add a graphvizNode class X-Git-Tag: 6.0.1~32^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba45498df5f3281f47af7b76cf422cbc5d6ef56f;p=graphviz tests: SvgAnalyzer: add a graphvizNode class --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0ccd8cc98..d82c47372 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 index 000000000..fe1f486b7 --- /dev/null +++ b/tests/graphviz_node.cpp @@ -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 index 000000000..857494370 --- /dev/null +++ b/tests/graphviz_node.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +#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; +};