diff options
Diffstat (limited to 'test/core/model/TestDocument.hpp')
-rw-r--r-- | test/core/model/TestDocument.hpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/core/model/TestDocument.hpp b/test/core/model/TestDocument.hpp index 6b0267a..eaec42c 100644 --- a/test/core/model/TestDocument.hpp +++ b/test/core/model/TestDocument.hpp @@ -23,6 +23,8 @@ #include <core/model/Domain.hpp> #include <core/model/Typesystem.hpp> +#include "TestDocumentBuilder.hpp" + namespace ousia { namespace model { @@ -30,57 +32,58 @@ namespace model { * This constructs a fairly simple test document for the "book" domain. The * structure of the document can be seen in the Code below. */ -static Rooted<Document> constructBookDocument(Manager &mgr, +static Rooted<Document> constructBookDocument(Manager &mgr, Logger &logger, Rooted<Domain> bookDomain) { // Start with the (empty) document. Rooted<Document> doc{new Document(mgr, "myDoc.oxd")}; + doc->addDomain(bookDomain); // Add the root. Rooted<StructuredEntity> root = - StructuredEntity::buildRootEntity(doc, {bookDomain}, "book"); + buildRootStructuredEntity(doc, logger, {"book"}); if (root.isNull()) { return {nullptr}; } // Add a paragraph. Rooted<StructuredEntity> foreword = - StructuredEntity::buildEntity(root, {bookDomain}, "paragraph"); + buildStructuredEntity(doc, logger, root, {"paragraph"}); if (foreword.isNull()) { return {nullptr}; } // Add its text. Rooted<StructuredEntity> foreword_text = - StructuredEntity::buildEntity(foreword, {bookDomain}, "text"); + buildStructuredEntity(doc, logger, foreword, {"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"); + buildPrimitiveEntity(logger, foreword_text, text, "content"); if (foreword_primitive.isNull()) { return {nullptr}; } // Add a section. Rooted<StructuredEntity> section = - StructuredEntity::buildEntity(root, {bookDomain}, "section"); + buildStructuredEntity(doc, logger, root, {"section"}); // Add a paragraph for it. Rooted<StructuredEntity> main = - StructuredEntity::buildEntity(section, {bookDomain}, "paragraph"); + buildStructuredEntity(doc, logger, section, {"paragraph"}); if (main.isNull()) { return {nullptr}; } // Add its text. Rooted<StructuredEntity> main_text = - StructuredEntity::buildEntity(main, {bookDomain}, "text"); + buildStructuredEntity(doc, logger, main, {"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"); + buildPrimitiveEntity(logger, main_text, text, "content"); if (main_primitive.isNull()) { return {nullptr}; } |