From e76f58e912bd6661ba755d27da97bebf711f06ad Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Wed, 4 Feb 2015 18:24:32 +0100 Subject: added mechanism for parent parsing, which does not fully work as of now. --- test/plugins/xml/XmlParserTest.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'test/plugins/xml') diff --git a/test/plugins/xml/XmlParserTest.cpp b/test/plugins/xml/XmlParserTest.cpp index 60e7c9b..c493643 100644 --- a/test/plugins/xml/XmlParserTest.cpp +++ b/test/plugins/xml/XmlParserTest.cpp @@ -144,30 +144,31 @@ static void checkFieldDescriptor( TEST(XmlParser, domainParsing) { XmlStandaloneEnvironment env(logger); - Rooted n = + Rooted book_domain_node = env.parse("book_domain.oxm", "", "", RttiSet{&RttiTypes::Domain}); - ASSERT_FALSE(n == nullptr); + ASSERT_FALSE(book_domain_node == nullptr); ASSERT_FALSE(logger.hasError()); // check the domain node. - Rooted domain = n.cast(); - ASSERT_EQ("book", domain->getName()); + Rooted book_domain = book_domain_node.cast(); + ASSERT_EQ("book", book_domain->getName()); // get the book struct node. Cardinality single; single.merge({1}); Rooted book = checkStructuredClass( - "book", "book", domain, single, nullptr, nullptr, false, true); + "book", "book", book_domain, single, nullptr, nullptr, false, true); // get the chapter struct node. Rooted chapter = - checkStructuredClass("chapter", "chapter", domain); + checkStructuredClass("chapter", "chapter", book_domain); Rooted section = - checkStructuredClass("section", "section", domain); + checkStructuredClass("section", "section", book_domain); Rooted subsection = - checkStructuredClass("subsection", "subsection", domain); + checkStructuredClass("subsection", "subsection", book_domain); Rooted paragraph = - checkStructuredClass("paragraph", "paragraph", domain, AnyCardinality, + checkStructuredClass("paragraph", "paragraph", book_domain, + AnyCardinality, nullptr, nullptr, true, false); + Rooted text = + checkStructuredClass("text", "text", book_domain, AnyCardinality, nullptr, nullptr, true, false); - Rooted text = checkStructuredClass( - "text", "text", domain, AnyCardinality, nullptr, nullptr, true, false); // check the FieldDescriptors. checkFieldDescriptor(book, {chapter, paragraph}); @@ -178,6 +179,13 @@ TEST(XmlParser, domainParsing) checkFieldDescriptor( text, {}, "content", FieldDescriptor::FieldType::PRIMITIVE, env.project->getSystemTypesystem()->getStringType(), false); + + // check parent handling. + Rooted headings_domain_node = + env.parse("headings_domain.oxm", "", "", RttiSet{&RttiTypes::Domain}); + //TODO: Unfortunately this does not work yet. + //ASSERT_FALSE(headings_domain_node == nullptr); + //ASSERT_FALSE(logger.hasError()); } } -- cgit v1.2.3