summaryrefslogtreecommitdiff
path: root/test/core/model/TestDocument.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/model/TestDocument.hpp')
-rw-r--r--test/core/model/TestDocument.hpp26
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;
}