From 100a24a53c862201d1fcaaf81c6faacb694d37e9 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 6 Feb 2015 19:23:07 +0100 Subject: changed name of text field from content to default. --- test/core/model/DocumentTest.cpp | 18 +++++++++--------- test/core/model/TestAdvanced.hpp | 2 +- test/core/model/TestDocument.hpp | 4 ++-- test/core/model/TestDomain.hpp | 4 ++-- test/plugins/xml/XmlParserTest.cpp | 3 ++- 5 files changed, 16 insertions(+), 15 deletions(-) (limited to 'test') 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(); 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())); - Variant content = text->getField("content")[0] + text->getField()[0]->isa(typeOf())); + Variant content = text->getField()[0] .cast() ->getContent(); ASSERT_EQ("Some introductory text", content.asString()); @@ -99,11 +99,11 @@ TEST(Document, construct) par->getField()[0].cast(); 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())); - Variant content = text->getField("content")[0] + Variant content = text->getField()[0] .cast() ->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 doc, // And the primitive content Variant content_var{content.c_str()}; Rooted 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 constructBookDocument(Manager &mgr, Logger &logger, // And its primitive content Variant text{"Some introductory text"}; Rooted foreword_primitive{ - new DocumentPrimitive(mgr, foreword_text, text, "content")}; + new DocumentPrimitive(mgr, foreword_text, text, DEFAULT_FIELD_NAME)}; // Add a section. Rooted section = buildStructuredEntity(doc, logger, root, {"section"}); @@ -79,7 +79,7 @@ static Rooted constructBookDocument(Manager &mgr, Logger &logger, // And its primitive content text = Variant{"Some actual text"}; Rooted 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 constructBookDomain(Manager &mgr, // ... and has a primitive field. Rooted 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 book_domain_node = env.parse("simple_book.oxd", "", "", RttiSet{&RttiTypes::Document}); + //TODO: Check result } } -- cgit v1.2.3