From 51de9238ddbd6b7f4cdaa5e9a5918cae952891b2 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Mon, 12 Jan 2015 15:50:10 +0100 Subject: Tried to introduce another StructureNode class as common superclass for StructuredEntity, Anchor and DocumentPrimitive. Nearly seems to work, but not entirely so. There are still issues with the Manager it seems. --- test/core/model/DocumentTest.cpp | 20 ++++++++++++-------- test/core/model/TestDocumentBuilder.hpp | 2 +- test/plugins/html/DemoOutputTest.cpp | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp index d11bb78..4b0447d 100644 --- a/test/core/model/DocumentTest.cpp +++ b/test/core/model/DocumentTest.cpp @@ -34,7 +34,7 @@ namespace model { TEST(Document, testDocumentConstruction) { // Construct Manager - TerminalLogger logger {std::cerr, true}; + TerminalLogger logger{std::cerr, true}; Manager mgr{1}; Rooted sys{new SystemTypesystem(mgr)}; // Get the domain. @@ -52,7 +52,8 @@ TEST(Document, testDocumentConstruction) ASSERT_EQ(2U, root->getField().size()); // get foreword (paragraph) { - Rooted foreword = root->getField()[0]; + Rooted foreword = + root->getField()[0].cast(); ASSERT_FALSE(foreword.isNull()); ASSERT_EQ("paragraph", foreword->getDescriptor()->getName()); // it should contain one text node @@ -61,7 +62,8 @@ TEST(Document, testDocumentConstruction) // which in turn should have a primitive content field containing the // right text. { - Rooted text = foreword->getField()[0]; + Rooted text = + foreword->getField()[0].cast(); ASSERT_FALSE(text.isNull()); ASSERT_EQ("text", text->getDescriptor()->getName()); ASSERT_TRUE(text->hasField()); @@ -74,24 +76,26 @@ TEST(Document, testDocumentConstruction) } // get section { - Rooted section = root->getField()[1]; + Rooted section = + root->getField()[1].cast(); ASSERT_FALSE(section.isNull()); ASSERT_EQ("section", section->getDescriptor()->getName()); // it should contain one paragraph ASSERT_TRUE(section->hasField()); ASSERT_EQ(1U, section->getField().size()); { - Rooted par = section->getField()[0]; + Rooted par = + section->getField()[0].cast(); ASSERT_FALSE(par.isNull()); ASSERT_EQ("paragraph", par->getDescriptor()->getName()); // it should contain one text node ASSERT_TRUE(par->hasField()); ASSERT_EQ(1U, par->getField().size()); // which in turn should have a primitive content field containing - // the - // right text. + // the right text. { - Rooted text = par->getField()[0]; + Rooted text = + par->getField()[0].cast(); ASSERT_FALSE(text.isNull()); ASSERT_EQ("text", text->getDescriptor()->getName()); ASSERT_TRUE(text->hasField()); diff --git a/test/core/model/TestDocumentBuilder.hpp b/test/core/model/TestDocumentBuilder.hpp index 4662a28..a1c8dde 100644 --- a/test/core/model/TestDocumentBuilder.hpp +++ b/test/core/model/TestDocumentBuilder.hpp @@ -235,7 +235,7 @@ Rooted buildAnchor(Logger &logger, } // Then construct the Anchor itself Rooted anchor{ - new AnnotationEntity::Anchor(parent->getManager(), parent, id)}; + new AnnotationEntity::Anchor(parent->getManager(), id, parent)}; // append the new entity to the right field. if (!parent->hasField(fieldName)) { logger.error(std::string("The parent has no field of the name ") + diff --git a/test/plugins/html/DemoOutputTest.cpp b/test/plugins/html/DemoOutputTest.cpp index ddd8f1c..9d1949e 100644 --- a/test/plugins/html/DemoOutputTest.cpp +++ b/test/plugins/html/DemoOutputTest.cpp @@ -56,7 +56,7 @@ TEST(DemoHTMLTransformer, writeHTML) #ifdef MANAGER_GRAPHVIZ_EXPORT // dump the manager state - mgr.exportGraphviz("bookDocument.dot"); + mgr.exportGraphviz("build/bookDocument.dot"); #endif // we can only do a rough check here. -- cgit v1.2.3