From 579b0e14d3bc1345512cac00a83159569cfcfa00 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 10 Apr 2015 14:31:46 +0200 Subject: Use "emph" instead of "emphasized" for the demo html output, adapt unit tests accordingly --- src/plugins/html/DemoOutput.cpp | 6 +++--- test/core/model/TestAdvanced.hpp | 12 ++++++------ test/plugins/html/DemoOutputTest.cpp | 2 +- test/plugins/xml/XmlOutputTest.cpp | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/plugins/html/DemoOutput.cpp b/src/plugins/html/DemoOutput.cpp index 8cf4e13..42c4080 100644 --- a/src/plugins/html/DemoOutput.cpp +++ b/src/plugins/html/DemoOutput.cpp @@ -32,7 +32,7 @@ typedef std::stack> AnnoStack; static bool canHandleAnchor(Handle a) { std::string annoClassName = a->getAnnotation()->getDescriptor()->getName(); - return annoClassName == "emphasized" || annoClassName == "strong"; + return annoClassName == "emph" || annoClassName == "strong"; } static Rooted openAnnotation(Manager &mgr, AnnoStack &opened, @@ -48,7 +48,7 @@ static Rooted openAnnotation(Manager &mgr, AnnoStack &opened, // get the elment name std::string elemName = entity->getDescriptor()->getName(); // emphasized has to be shortened - if (elemName == "emphasized") { + if (elemName == "emph") { elemName = "em"; } // create the new XML element representing the annotation @@ -396,4 +396,4 @@ void DemoHTMLTransformer::writeHTML(Handle doc, std::ostream &out, html->serialize(out, "", pretty); } } -} \ No newline at end of file +} diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp index 58eb965..a4e527a 100644 --- a/test/core/model/TestAdvanced.hpp +++ b/test/core/model/TestAdvanced.hpp @@ -115,7 +115,7 @@ static Rooted constructEmphasisOntology(Manager &mgr, Rooted ontology{new Ontology(mgr, sys, "emphasis")}; // create AnnotationClasses Rooted em{ - new AnnotationClass(mgr, "emphasized", ontology)}; + new AnnotationClass(mgr, "emph", ontology)}; Rooted strong{ new AnnotationClass(mgr, "strong", ontology)}; @@ -206,7 +206,7 @@ static Rooted constructAdvancedDocument(Manager &mgr, Logger &logger, return {nullptr}; } if (!addAnnotation(logger, doc, heading, "Was ist Aufklärung?", - "emphasized")) { + "emph")) { return {nullptr}; } } @@ -238,7 +238,7 @@ static Rooted constructAdvancedDocument(Manager &mgr, Logger &logger, "strong")) { return {nullptr}; } - if (!addAnnotation(logger, doc, p, "Unmündigkeit", "emphasized")) { + if (!addAnnotation(logger, doc, p, "Unmündigkeit", "emph")) { return {nullptr}; } if (!addText(logger, doc, p, @@ -247,7 +247,7 @@ static Rooted constructAdvancedDocument(Manager &mgr, Logger &logger, return {nullptr}; } if (!addAnnotation(logger, doc, p, "Selbstverschuldet", - "emphasized")) { + "emph")) { return {nullptr}; } if (!addText(logger, doc, p, @@ -260,7 +260,7 @@ static Rooted constructAdvancedDocument(Manager &mgr, Logger &logger, if (!addAnnotation(logger, doc, p, "Sapere aude! Habe Mut, dich deines eigenen " "Verstandes zu bedienen!", - "emphasized")) { + "emph")) { return {nullptr}; } if (!addText(logger, doc, p, @@ -316,4 +316,4 @@ static Rooted constructAdvancedDocument(Manager &mgr, Logger &logger, } } -#endif /* _TEST_DOCUMENT_HPP_ */ \ No newline at end of file +#endif /* _TEST_DOCUMENT_HPP_ */ diff --git a/test/plugins/html/DemoOutputTest.cpp b/test/plugins/html/DemoOutputTest.cpp index f2d0a24..e228953 100644 --- a/test/plugins/html/DemoOutputTest.cpp +++ b/test/plugins/html/DemoOutputTest.cpp @@ -98,7 +98,7 @@ TEST(DemoHTMLTransformer, AnnotationProcessing) Rooted em_end{new Anchor(mgr, p)}; ASSERT_TRUE(addText(logger, doc, p, "bla")); Rooted strong_end{new Anchor(mgr, p)}; - buildAnnotationEntity(doc, logger, {"emphasized"}, em_start, em_end); + buildAnnotationEntity(doc, logger, {"emph"}, em_start, em_end); buildAnnotationEntity(doc, logger, {"strong"}, strong_start, strong_end); #ifdef MANAGER_GRAPHVIZ_EXPORT diff --git a/test/plugins/xml/XmlOutputTest.cpp b/test/plugins/xml/XmlOutputTest.cpp index ac80a57..92d8a85 100644 --- a/test/plugins/xml/XmlOutputTest.cpp +++ b/test/plugins/xml/XmlOutputTest.cpp @@ -91,7 +91,7 @@ TEST(DemoHTMLTransformer, AnnotationProcessing) Rooted em_end{new Anchor(mgr, p)}; ASSERT_TRUE(addText(logger, doc, p, "bla")); Rooted strong_end{new Anchor(mgr, p)}; - buildAnnotationEntity(doc, logger, {"emphasized"}, em_start, em_end); + buildAnnotationEntity(doc, logger, {"emph"}, em_start, em_end); buildAnnotationEntity(doc, logger, {"strong"}, strong_start, strong_end); // Check serialization. @@ -103,9 +103,9 @@ TEST(DemoHTMLTransformer, AnnotationProcessing) // In HTML the overlapping structure must be serialized as follows: ASSERT_TRUE( res.find( - "blablubbla") != std::string::npos); + "bla" + "blub" + "bla") != std::string::npos); } TEST(DemoHTMLTransformer, PrimitiveSubtreeFields) @@ -148,4 +148,4 @@ TEST(DemoHTMLTransformer, PrimitiveSubtreeFields) std::string::npos); } } -} \ No newline at end of file +} -- cgit v1.2.3