Blame SOURCES/0181-CppunitTest_sw_tiledrendering-CALLBACK_SEARCH_RESULT.patch

135360
From 28fbfa4f660be2c4698cdaae963e4e21d172e56d Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Tue, 6 Oct 2015 10:18:18 +0200
135360
Subject: [PATCH 181/398] CppunitTest_sw_tiledrendering:
135360
 CALLBACK_SEARCH_RESULT_SELECTION testcase
135360
135360
Change-Id: I66a8d73581641c71f2dce2d1992070f3ccce08c2
135360
(cherry picked from commit a7b86140d74039995bd4d312790244c1e2d4b501)
135360
---
135360
 sw/qa/extras/tiledrendering/tiledrendering.cxx | 17 ++++++++++++++++-
135360
 1 file changed, 16 insertions(+), 1 deletion(-)
135360
135360
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
135360
index bcc328e366a3..2fd27dd4f8ff 100644
135360
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
135360
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
135360
@@ -7,6 +7,9 @@
135360
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
135360
  */
135360
 
135360
+#include <string>
135360
+#include <boost/property_tree/json_parser.hpp>
135360
+
135360
 #include <swmodeltestbase.hxx>
135360
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
135360
 #include <comphelper/dispatchcommand.hxx>
135360
@@ -23,7 +26,6 @@
135360
 #include <drawdoc.hxx>
135360
 #include <ndtxt.hxx>
135360
 #include <wrtsh.hxx>
135360
-#include <string>
135360
 
135360
 static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/";
135360
 
135360
@@ -71,6 +73,7 @@ private:
135360
     OString m_aTextSelection;
135360
     bool m_bFound;
135360
     sal_Int32 m_nSearchResultCount;
135360
+    std::vector<OString> m_aSearchResultSelection;
135360
 };
135360
 
135360
 SwTiledRenderingTest::SwTiledRenderingTest()
135360
@@ -137,6 +140,16 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
135360
         m_nSearchResultCount = std::stoi(aStrPayload.substr(0, aStrPayload.find_first_of(";")));
135360
     }
135360
     break;
135360
+    case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
135360
+    {
135360
+        m_aSearchResultSelection.clear();
135360
+        boost::property_tree::ptree aTree;
135360
+        std::stringstream aStream(pPayload);
135360
+        boost::property_tree::read_json(aStream, aTree);
135360
+        for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection"))
135360
+            m_aSearchResultSelection.push_back(rValue.second.data().c_str());
135360
+    }
135360
+    break;
135360
     }
135360
 }
135360
 
135360
@@ -466,6 +479,8 @@ void SwTiledRenderingTest::testSearchAll()
135360
     comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
135360
     // This was 0; should be 2 results in the body text.
135360
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), m_nSearchResultCount);
135360
+    // Make sure that we get exactly as many rectangle lists as matches.
135360
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m_aSearchResultSelection.size());
135360
 
135360
     comphelper::LibreOfficeKit::setActive(false);
135360
 #endif
135360
-- 
135360
2.12.0
135360