]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/props_test.cxx
scenery: Use correct property root in xml loading.
[simgear.git] / simgear / props / props_test.cxx
index 7e67e352ed19011a9b9a73b6950932a425d79f1a..f8299263a1252f58753a99e25139eee9385243db 100644 (file)
@@ -3,9 +3,17 @@
 // Test harness.
 ////////////////////////////////////////////////////////////////////////
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+
 #include <simgear/compiler.h>
 
 #include <iostream>
+
+// working around MSVC weirdness with props.hxx and SGMathFwd
+#include <simgear/math/SGMath.hxx>
+
 #include "props.hxx"
 #include "props_io.hxx"
 
@@ -324,6 +332,26 @@ test_property_nodes ()
   cout << endl;
 }
 
+void test_addChild()
+{
+  SGPropertyNode root;
+
+  cout << "Testing the addChild function " << endl;
+  cout << "Created root node " << root.getPath() << endl;
+
+  SGPropertyNode *test = root.getChild("test", 0, true);
+  SGPropertyNode *n = test->getNode("foo", true);
+  n->getChild("child", 1, true)->setIntValue(1);
+  n->getChild("child", 2, true)->setIntValue(2);
+  n->getChild("child", 4, true)->setIntValue(2);
+  dump_node(&root);
+
+  SGPropertyNode *ch = n->addChild("child");
+  ch->setIntValue(3);
+  cerr << endl << "ADDED: " << ch->getPath() << endl << endl;
+  dump_node(&root);
+}
+
 
 int main (int ac, char ** av)
 {
@@ -342,5 +370,7 @@ int main (int ac, char ** av)
     }
   }
 
+  test_addChild();
+
   return 0;
 }