diff options
-rw-r--r-- | src/plugins/html/DemoOutput.cpp | 2 | ||||
-rw-r--r-- | test/core/model/DocumentTest.cpp | 18 | ||||
-rw-r--r-- | test/core/model/TestAdvanced.hpp | 2 | ||||
-rw-r--r-- | test/core/model/TestDocument.hpp | 4 | ||||
-rw-r--r-- | test/core/model/TestDomain.hpp | 4 | ||||
-rw-r--r-- | test/plugins/xml/XmlParserTest.cpp | 3 | ||||
-rw-r--r-- | testdata/xmlparser/book_domain.oxm | 2 |
7 files changed, 18 insertions, 17 deletions
diff --git a/src/plugins/html/DemoOutput.cpp b/src/plugins/html/DemoOutput.cpp index eddff7b..074e65e 100644 --- a/src/plugins/html/DemoOutput.cpp +++ b/src/plugins/html/DemoOutput.cpp @@ -323,7 +323,7 @@ Rooted<xml::Element> DemoHTMLTransformer::transformParagraph( std::string childDescriptorName = t->getDescriptor()->getName(); if (childDescriptorName == "text") { Handle<DocumentPrimitive> primitive = - t->getField("content")[0].cast<DocumentPrimitive>(); + t->getField()[0].cast<DocumentPrimitive>(); if (primitive.isNull()) { throw OusiaException("Text field is not primitive!"); } diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp index 177f69b..a692f73 100644 --- a/test/core/model/DocumentTest.cpp +++ b/test/core/model/DocumentTest.cpp @@ -65,11 +65,11 @@ TEST(Document, construct) foreword->getField()[0].cast<StructuredEntity>(); ASSERT_FALSE(text.isNull()); ASSERT_EQ("text", text->getDescriptor()->getName()); - ASSERT_TRUE(text->hasField("content")); - ASSERT_EQ(1U, text->getField("content").size()); + ASSERT_TRUE(text->hasField()); + ASSERT_EQ(1U, text->getField().size()); ASSERT_TRUE( - text->getField("content")[0]->isa(typeOf<DocumentPrimitive>())); - Variant content = text->getField("content")[0] + text->getField()[0]->isa(typeOf<DocumentPrimitive>())); + Variant content = text->getField()[0] .cast<DocumentPrimitive>() ->getContent(); ASSERT_EQ("Some introductory text", content.asString()); @@ -99,11 +99,11 @@ TEST(Document, construct) par->getField()[0].cast<StructuredEntity>(); ASSERT_FALSE(text.isNull()); ASSERT_EQ("text", text->getDescriptor()->getName()); - ASSERT_TRUE(text->hasField("content")); - ASSERT_EQ(1U, text->getField("content").size()); - ASSERT_TRUE(text->getField("content")[0]->isa( + ASSERT_TRUE(text->hasField()); + ASSERT_EQ(1U, text->getField().size()); + ASSERT_TRUE(text->getField()[0]->isa( typeOf<DocumentPrimitive>())); - Variant content = text->getField("content")[0] + Variant content = text->getField()[0] .cast<DocumentPrimitive>() ->getContent(); ASSERT_EQ("Some actual text", content.asString()); @@ -296,7 +296,7 @@ TEST(Document, validate) new Attribute{mgr, "myAttr", sys->getStringType(), "default"}, logger); // the right map content should be valid now. - child->setAttributes(Variant::mapType{{"myAttr", "content"}}); + child->setAttributes(Variant::mapType{{"myAttr", "bla"}}); ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState()); ASSERT_TRUE(doc->validate(logger)); // but an empty map as well diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp index 56738af..5c709f0 100644 --- a/test/core/model/TestAdvanced.hpp +++ b/test/core/model/TestAdvanced.hpp @@ -130,7 +130,7 @@ static bool addText(Logger &logger, Handle<Document> doc, // And the primitive content Variant content_var{content.c_str()}; Rooted<DocumentPrimitive> primitive{new DocumentPrimitive( - parent->getManager(), text, content_var, "content")}; + parent->getManager(), text, content_var, DEFAULT_FIELD_NAME)}; return true; } diff --git a/test/core/model/TestDocument.hpp b/test/core/model/TestDocument.hpp index 0cb52a3..7675dab 100644 --- a/test/core/model/TestDocument.hpp +++ b/test/core/model/TestDocument.hpp @@ -60,7 +60,7 @@ static Rooted<Document> constructBookDocument(Manager &mgr, Logger &logger, // And its primitive content Variant text{"Some introductory text"}; Rooted<DocumentPrimitive> foreword_primitive{ - new DocumentPrimitive(mgr, foreword_text, text, "content")}; + new DocumentPrimitive(mgr, foreword_text, text, DEFAULT_FIELD_NAME)}; // Add a section. Rooted<StructuredEntity> section = buildStructuredEntity(doc, logger, root, {"section"}); @@ -79,7 +79,7 @@ static Rooted<Document> constructBookDocument(Manager &mgr, Logger &logger, // And its primitive content text = Variant{"Some actual text"}; Rooted<DocumentPrimitive> main_primitive{ - new DocumentPrimitive(mgr, main_text, text, "content")}; + new DocumentPrimitive(mgr, main_text, text, DEFAULT_FIELD_NAME)}; if (main_primitive.isNull()) { return {nullptr}; } diff --git a/test/core/model/TestDomain.hpp b/test/core/model/TestDomain.hpp index 8b572a8..5ac510c 100644 --- a/test/core/model/TestDomain.hpp +++ b/test/core/model/TestDomain.hpp @@ -81,8 +81,8 @@ static Rooted<Domain> constructBookDomain(Manager &mgr, // ... and has a primitive field. Rooted<FieldDescriptor> text_field{new FieldDescriptor( - mgr, text, domain->getTypesystems()[0]->getTypes()[0], "content", - false)}; + mgr, text, domain->getTypesystems()[0]->getTypes()[0], + DEFAULT_FIELD_NAME, false)}; return domain; } diff --git a/test/plugins/xml/XmlParserTest.cpp b/test/plugins/xml/XmlParserTest.cpp index 6110fcb..4b5e1e4 100644 --- a/test/plugins/xml/XmlParserTest.cpp +++ b/test/plugins/xml/XmlParserTest.cpp @@ -242,7 +242,7 @@ TEST(XmlParser, domainParsing) checkFieldDescriptor(subsection, {paragraph}); checkFieldDescriptor(paragraph, {text}); checkFieldDescriptor( - text, {}, "content", FieldDescriptor::FieldType::PRIMITIVE, + text, {}, DEFAULT_FIELD_NAME, FieldDescriptor::FieldType::PRIMITIVE, env.project->getSystemTypesystem()->getStringType(), false); // check parent handling using the headings domain. @@ -308,6 +308,7 @@ TEST(XmlParser, documentParsing) XmlStandaloneEnvironment env(logger); Rooted<Node> book_domain_node = env.parse("simple_book.oxd", "", "", RttiSet{&RttiTypes::Document}); + //TODO: Check result } } diff --git a/testdata/xmlparser/book_domain.oxm b/testdata/xmlparser/book_domain.oxm index ed9309b..8b46460 100644 --- a/testdata/xmlparser/book_domain.oxm +++ b/testdata/xmlparser/book_domain.oxm @@ -96,6 +96,6 @@ transparent="true" isa="" attributesDescriptor=""> --> <!-- we might want to specify std.string here --> - <primitive name="content" type="string"/> + <primitive type="string"/> </struct> </domain> |