Blame SOURCES/0181-CppunitTest_sw_tiledrendering-CALLBACK_SEARCH_RESULT.patch

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