diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-04 19:30:56 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-04 19:30:56 +0100 |
commit | 7d22aac0c7be52381822abdd0cb6860deaf01096 (patch) | |
tree | 9ff9adc2d1d7115ead1867ca093deaaa69bd5e1b /test/core/model/TestDocument.hpp | |
parent | 0daeae84055f959f7e78b2dea2eb7aef151853e5 (diff) |
fixed a nasty bug in the getField method of DocumentEntity. Also corrected some issues in the TestDocument and TestDomain.
Diffstat (limited to 'test/core/model/TestDocument.hpp')
-rw-r--r-- | test/core/model/TestDocument.hpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/test/core/model/TestDocument.hpp b/test/core/model/TestDocument.hpp index a1a3434..6b0267a 100644 --- a/test/core/model/TestDocument.hpp +++ b/test/core/model/TestDocument.hpp @@ -50,13 +50,18 @@ static Rooted<Document> constructBookDocument(Manager &mgr, return {nullptr}; } // Add its text. - Variant text{std::map<std::string, Variant>{ - {"content", Variant("Some introductory text")}}}; - Rooted<DocumentPrimitive> foreword_text = - DocumentPrimitive::buildEntity(foreword, text, "text"); + Rooted<StructuredEntity> foreword_text = + StructuredEntity::buildEntity(foreword, {bookDomain}, "text"); if (foreword_text.isNull()) { return {nullptr}; } + // And its primitive content + Variant text{"Some introductory text"}; + Rooted<DocumentPrimitive> foreword_primitive = + DocumentPrimitive::buildEntity(foreword_text, text, "content"); + if (foreword_primitive.isNull()) { + return {nullptr}; + } // Add a section. Rooted<StructuredEntity> section = StructuredEntity::buildEntity(root, {bookDomain}, "section"); @@ -67,13 +72,18 @@ static Rooted<Document> constructBookDocument(Manager &mgr, return {nullptr}; } // Add its text. - text = Variant{std::map<std::string, Variant>{ - {"content", Variant("Some introductory text")}}}; - Rooted<DocumentPrimitive> main_text = - DocumentPrimitive::buildEntity(foreword, text, "text"); + Rooted<StructuredEntity> main_text = + StructuredEntity::buildEntity(main, {bookDomain}, "text"); if (main_text.isNull()) { return {nullptr}; } + // And its primitive content + text = Variant{"Some actual text"}; + Rooted<DocumentPrimitive> main_primitive = + DocumentPrimitive::buildEntity(main_text, text, "content"); + if (main_primitive.isNull()) { + return {nullptr}; + } return doc; } |