test/httpwstest.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
New commits: commit 0fbabb7a22b1213afe7e3f1b071c4c2876b20584 Author: Miklos Vajna <[email protected]> AuthorDate: Thu May 9 10:30:11 2019 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Thu May 9 10:30:11 2019 +0200 test: fix HTTPWSTest::testRenderShapeSelectionWriter() failure with ... ... debug core.git. SVGActionWriter::ImplWriteActions() in core.git writes additional <desc> XML elements, guarded with a '#if OSL_DEBUG_LEVEL > 0' block. Filter these out, so the reference SVG will match both product and debug builds. Change-Id: Iba3fb25af206c70d5a4ff5801a934dcfd74704de diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp index 687f46ae7..38524bd73 100644 --- a/test/httpwstest.cpp +++ b/test/httpwstest.cpp @@ -52,6 +52,31 @@ using namespace helpers; +namespace +{ +/** + * Strips <desc>...</desc> strings from an SVG, some of which are only in debug builds, so breaks + * comparison with a fixed reference. + */ +void stripDescriptions(std::vector<char>& svg) +{ + while (true) + { + std::string startDesc("<desc>"); + auto itStart = std::search(svg.begin(), svg.end(), startDesc.begin(), startDesc.end()); + if (itStart == svg.end()) + return; + + std::string endDesc("</desc>"); + auto itEnd = std::search(svg.begin(), svg.end(), endDesc.begin(), endDesc.end()); + if (itEnd == svg.end()) + return; + + svg.erase(itStart, itEnd + endDesc.size()); + } +} +} + /// Tests the HTTP WebSocket API of loolwsd. The server has to be started manually before running this test. class HTTPWSTest : public CPPUNIT_NS::TestFixture { @@ -2775,6 +2800,8 @@ void HTTPWSTest::testRenderShapeSelectionWriter() if (it != responseSVG.end()) responseSVG.erase(responseSVG.begin(), ++it); + stripDescriptions(responseSVG); + CPPUNIT_ASSERT(svgMatch(testname, responseSVG, "shapes_writer.svg")); } catch (const Poco::Exception& exc) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
