diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-11 17:54:48 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-11 17:54:48 +0100 |
commit | 2f75ac166594b6bc2ea30901669304eca23174ec (patch) | |
tree | 0995fdfd968a6dfdae2ca93e83b76a2686a02abc /test | |
parent | 76df276a0c30013c8d7fa98bedc6b0fbadb56699 (diff) |
changed semantics of default field, now referring to the only TREE field.
Diffstat (limited to 'test')
-rw-r--r-- | test/core/model/DomainTest.cpp | 2 | ||||
-rw-r--r-- | test/core/model/TestAdvanced.hpp | 14 | ||||
-rw-r--r-- | test/plugins/xml/XmlParserTest.cpp | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/DomainTest.cpp index 59062f0..79b62f0 100644 --- a/test/core/model/DomainTest.cpp +++ b/test/core/model/DomainTest.cpp @@ -215,7 +215,7 @@ TEST(Descriptor, pathToAdvanced) ASSERT_TRUE(path[1]->isa(&RttiTypes::StructuredClass)); ASSERT_EQ("B", path[1]->getName()); ASSERT_TRUE(path[2]->isa(&RttiTypes::FieldDescriptor)); - ASSERT_EQ("$default", path[2]->getName()); + ASSERT_EQ("", path[2]->getName()); } TEST(StructuredClass, isSubclassOf) diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp index 9c95400..575860b 100644 --- a/test/core/model/TestAdvanced.hpp +++ b/test/core/model/TestAdvanced.hpp @@ -55,11 +55,11 @@ static Rooted<Domain> constructHeadingDomain(Manager &mgr, Cardinality card; card.merge({0, 1}); // set up heading StructuredClass. - Rooted<StructuredClass> heading{new StructuredClass( - mgr, "heading", domain, card, {nullptr}, true)}; - // as field want to copy the field of paragraph. + Rooted<StructuredClass> heading{ + new StructuredClass(mgr, "heading", domain, card, {nullptr}, true)}; + // as field want to reference the field of paragraph. Rooted<StructuredClass> p = resolveDescriptor(bookDomain, "paragraph"); - heading->copyFieldDescriptor(p->getFieldDescriptors()[0]); + heading->addFieldDescriptor(p->getFieldDescriptor(), logger); // create a new field for headings in each section type. std::vector<std::string> secclasses{"book", "section", "subsection", "paragraph"}; @@ -88,8 +88,8 @@ static Rooted<Domain> constructListDomain(Manager &mgr, Rooted<StructuredClass> item{new StructuredClass( mgr, "item", domain, Cardinality::any(), {nullptr}, false)}; - // as field we want to copy the field of paragraph. - item->copyFieldDescriptor(p->getFieldDescriptors()[0]); + // as field we want to reference the field of paragraph. + item->addFieldDescriptor(p->getFieldDescriptor(), logger); // set up list StructuredClasses. std::vector<std::string> listTypes{"ol", "ul"}; for (auto &listType : listTypes) { @@ -157,7 +157,7 @@ static bool addAnnotation(Logger &logger, Handle<Document> doc, Handle<StructuredEntity> parent, const std::string &text, const std::string &annoClass) { - Manager& mgr = parent->getManager(); + Manager &mgr = parent->getManager(); Rooted<Anchor> start{new Anchor(mgr, std::to_string(annoIdx++), parent)}; if (!addText(logger, doc, parent, text)) { return false; diff --git a/test/plugins/xml/XmlParserTest.cpp b/test/plugins/xml/XmlParserTest.cpp index ef95552..7d5c697 100644 --- a/test/plugins/xml/XmlParserTest.cpp +++ b/test/plugins/xml/XmlParserTest.cpp @@ -181,7 +181,7 @@ static void checkFieldDescriptor( static void checkFieldDescriptor( Handle<Descriptor> desc, Handle<Descriptor> parent, NodeVector<StructuredClass> children, - const std::string &name = DEFAULT_FIELD_NAME, + const std::string &name = "", FieldDescriptor::FieldType type = FieldDescriptor::FieldType::TREE, Handle<Type> primitiveType = nullptr, bool optional = false) { @@ -193,7 +193,7 @@ static void checkFieldDescriptor( static void checkFieldDescriptor( Handle<Descriptor> desc, NodeVector<StructuredClass> children, - const std::string &name = DEFAULT_FIELD_NAME, + const std::string &name = "", FieldDescriptor::FieldType type = FieldDescriptor::FieldType::TREE, Handle<Type> primitiveType = nullptr, bool optional = false) { @@ -244,7 +244,7 @@ TEST(XmlParser, domainParsing) checkFieldDescriptor(subsection, {paragraph}); checkFieldDescriptor(paragraph, {text}); checkFieldDescriptor( - text, {}, DEFAULT_FIELD_NAME, FieldDescriptor::FieldType::PRIMITIVE, + text, {}, "", FieldDescriptor::FieldType::TREE, env.project->getSystemTypesystem()->getStringType(), false); // check parent handling using the headings domain. |