Blame SOURCES/0204-CppunitTest_sd_tiledrendering-CALLBACK_SEARCH_RESULT.patch

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