[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - .gitreview test/httpwstest.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu May 9 08:37:47 UTC 2019


 .gitreview          |    2 +-
 test/httpwstest.cpp |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 9a6c28740b47333ed900ec24a4f75fca0e30070d
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu May 9 10:30:11 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu May 9 10:37:28 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.
    
    (cherry picked from commit 0fbabb7a22b1213afe7e3f1b071c4c2876b20584)
    
    Change-Id: Iba3fb25af206c70d5a4ff5801a934dcfd74704de
    Reviewed-on: https://gerrit.libreoffice.org/72029
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/.gitreview b/.gitreview
index fc87636e3..489239f60 100644
--- a/.gitreview
+++ b/.gitreview
@@ -3,5 +3,5 @@ host=logerrit
 port=29418
 project=online
 defaultremote=logerrit
-defaultbranch=master
+defaultbranch=distro/collabora/collabora-online-4
 
diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index 7352a9574..be6601210 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
 {
@@ -2765,6 +2790,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)


More information about the Libreoffice-commits mailing list