Blame SOURCES/0204-CppunitTest_sd_tiledrendering-CALLBACK_SEARCH_RESULT.patch

f325b2
From 01f73ec6b52c617a4d64b89de93aed3a6896fcf6 Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Tue, 13 Oct 2015 16:38:37 +0200
f325b2
Subject: [PATCH 204/398] CppunitTest_sd_tiledrendering:
f325b2
 CALLBACK_SEARCH_RESULT_SELECTION testcase
f325b2
f325b2
Change-Id: I8a2fcaad5806ef204cdac0f6eaac615d50d6d9e8
f325b2
(cherry picked from commit 28a5d4b5d3641837f3be8bc39ead111f9bba7015)
f325b2
---
f325b2
 sd/qa/unit/tiledrendering/tiledrendering.cxx | 20 +++++++++++++++++---
f325b2
 1 file changed, 17 insertions(+), 3 deletions(-)
f325b2
f325b2
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
f325b2
index 8ed091998ef1..f35449b12b2c 100644
f325b2
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
f325b2
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
f325b2
@@ -7,6 +7,10 @@
f325b2
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
f325b2
  */
f325b2
 
f325b2
+#include <test/bootstrapfixture.hxx>
f325b2
+#include <unotest/macros_test.hxx>
f325b2
+#include <test/xmltesttools.hxx>
f325b2
+#include <boost/property_tree/json_parser.hpp>
f325b2
 #define LOK_USE_UNSTABLE_API
f325b2
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
f325b2
 #include <com/sun/star/frame/Desktop.hpp>
f325b2
@@ -19,9 +23,6 @@
f325b2
 #include <editeng/outliner.hxx>
f325b2
 #include <sfx2/dispatch.hxx>
f325b2
 #include <sfx2/viewfrm.hxx>
f325b2
-#include <test/bootstrapfixture.hxx>
f325b2
-#include <test/xmltesttools.hxx>
f325b2
-#include <unotest/macros_test.hxx>
f325b2
 
f325b2
 #include <DrawDocShell.hxx>
f325b2
 #include <ViewShell.hxx>
f325b2
@@ -78,6 +79,7 @@ private:
f325b2
     std::vector<Rectangle> m_aSelection;
f325b2
     bool m_bFound;
f325b2
     sal_Int32 m_nPart;
f325b2
+    std::vector<OString> m_aSearchResultSelection;
f325b2
 #endif
f325b2
 };
f325b2
 
f325b2
@@ -182,6 +184,16 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
f325b2
         m_nPart = aPayload.toInt32();
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
@@ -387,6 +399,8 @@ void SdTiledRenderingTest::testSearch()
f325b2
     lcl_search("bbb");
f325b2
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), m_nPart);
f325b2
     CPPUNIT_ASSERT_EQUAL(true, m_bFound);
f325b2
+    // This was 0; should be 1 match for "find".
f325b2
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), m_aSearchResultSelection.size());
f325b2
 
f325b2
     // This should trigger the not-found callback.
f325b2
     Application::EnableHeadlessMode(false);
f325b2
-- 
f325b2
2.12.0
f325b2