summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}