summaryrefslogtreecommitdiff
path: root/test/core
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-19 00:36:45 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-19 00:36:45 +0100
commit3654efa59547d23b3c27715483999570daedc0b3 (patch)
treeceb06dc7cb3a21ac883675bc9960a9cf48585851 /test/core
parent23e593eb69f6d0beb197f33ae31b479c60d9316f (diff)
completed the work on a primitive Test Document.
Diffstat (limited to 'test/core')
-rw-r--r--test/core/model/TestDocument.hpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/core/model/TestDocument.hpp b/test/core/model/TestDocument.hpp
index c99bdd3..a1a3434 100644
--- a/test/core/model/TestDocument.hpp
+++ b/test/core/model/TestDocument.hpp
@@ -52,11 +52,28 @@ static Rooted<Document> constructBookDocument(Manager &mgr,
// Add its text.
Variant text{std::map<std::string, Variant>{
{"content", Variant("Some introductory text")}}};
- Rooted<DocumentPrimitive> text_primitive =
+ Rooted<DocumentPrimitive> foreword_text =
DocumentPrimitive::buildEntity(foreword, text, "text");
+ if (foreword_text.isNull()) {
+ return {nullptr};
+ }
// Add a section.
Rooted<StructuredEntity> section =
StructuredEntity::buildEntity(root, {bookDomain}, "section");
+ // Add a paragraph for it.
+ Rooted<StructuredEntity> main =
+ StructuredEntity::buildEntity(section, {bookDomain}, "paragraph");
+ if (main.isNull()) {
+ 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");
+ if (main_text.isNull()) {
+ return {nullptr};
+ }
return doc;
}