2#include "../../../../tests/catch2/catch.hpp"
6#include "../xigNode.hpp"
10 std::ofstream fout(
"/tmp/xigNode_test.xml");
11 fout <<
"<mxfile host=\"test\">\n";
12 fout <<
" <diagram id=\"test\" name=\"test\">\n";
13 fout <<
" <mxGraphModel>\n";
15 fout <<
" <mxCell id=\"0\"/>\n";
16 fout <<
" <mxCell id=\"1\" parent=\"0\"/>\n";
17 fout <<
" <mxCell id=\"node:telescope\">\n";
18 fout <<
"</mxCell>\n";
20 fout <<
" </mxGraphModel>\n";
21 fout <<
" </diagram>\n";
22 fout <<
"</mxfile>\n";
34 static_cast<void>(ipRecv);
39SCENARIO(
"Creating an xigNode",
"[instGraph::xigNode]" )
41 GIVEN(
"a valid XML file")
43 WHEN(
"node is in file")
45 ingr::instGraphXML parentGraph;
50 int rv = parentGraph.loadXMLFile(emsg,
"/tmp/xigNode_test.xml");
66 REQUIRE(pass ==
true);
67 REQUIRE(txn !=
nullptr);
70 REQUIRE( txn->
name() ==
"telescope");
71 REQUIRE( txn->
node()->name() ==
"telescope");
72 REQUIRE( pass ==
true );
75 REQUIRE( txn->
keys().count(
"tkey") == 1);
79 WHEN(
"node is not in file")
81 ingr::instGraphXML parentGraph;
86 int rv = parentGraph.loadXMLFile(emsg,
"/tmp/xigNode_test.xml");
103 REQUIRE(pass ==
false);
104 REQUIRE(txn ==
nullptr);
108 GIVEN(
"an invalid XML file")
110 WHEN(
"parent graph is null on construction")
112 ingr::instGraphXML * parentGraph =
nullptr;
125 REQUIRE(pass ==
false);
126 REQUIRE(txn ==
nullptr);
test_xigNode(const std::string &name, ingr::instGraphXML *parentGraph)
int handleSetProperty(const pcf::IndiProperty &ipRecv)
INDI SetProperty callback.
Implementation of basic instGraph node interface for MagAO-X.
void key(const std::string &nkey)
Add a key to the set.
ingr::instNode * node()
Get the pointer to the underlying node.
std::string name()
Get the name of this node.
const std::set< std::string > & keys()
Get the set holding the INDI keys for this node.
SCENARIO("Creating an xigNode", "[instGraph::xigNode]")