summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-12 15:50:10 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-12 15:50:10 +0100
commit51de9238ddbd6b7f4cdaa5e9a5918cae952891b2 (patch)
tree90f9a91e8a67a5ee95b1cb2e3addda6b51ff7209 /test
parent60d9d3f9f54fab975c39d4c341f118df90628375 (diff)
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.
Diffstat (limited to 'test')
-rw-r--r--test/core/model/DocumentTest.cpp20
-rw-r--r--test/core/model/TestDocumentBuilder.hpp2
-rw-r--r--test/plugins/html/DemoOutputTest.cpp2
3 files changed, 14 insertions, 10 deletions
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<SystemTypesystem> sys{new SystemTypesystem(mgr)};
// Get the domain.
@@ -52,7 +52,8 @@ TEST(Document, testDocumentConstruction)
ASSERT_EQ(2U, root->getField().size());
// get foreword (paragraph)
{
- Rooted<StructuredEntity> foreword = root->getField()[0];
+ Rooted<StructuredEntity> foreword =
+ root->getField()[0].cast<StructuredEntity>();
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<StructuredEntity> text = foreword->getField()[0];
+ Rooted<StructuredEntity> text =
+ foreword->getField()[0].cast<StructuredEntity>();
ASSERT_FALSE(text.isNull());
ASSERT_EQ("text", text->getDescriptor()->getName());
ASSERT_TRUE(text->hasField());
@@ -74,24 +76,26 @@ TEST(Document, testDocumentConstruction)
}
// get section
{
- Rooted<StructuredEntity> section = root->getField()[1];
+ Rooted<StructuredEntity> section =
+ root->getField()[1].cast<StructuredEntity>();
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<StructuredEntity> par = section->getField()[0];
+ Rooted<StructuredEntity> par =
+ section->getField()[0].cast<StructuredEntity>();
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<StructuredEntity> text = par->getField()[0];
+ Rooted<StructuredEntity> text =
+ par->getField()[0].cast<StructuredEntity>();
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<AnnotationEntity::Anchor> buildAnchor(Logger &logger,
}
// Then construct the Anchor itself
Rooted<AnnotationEntity::Anchor> 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.