From 01f73ec6b52c617a4d64b89de93aed3a6896fcf6 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 13 Oct 2015 16:38:37 +0200 Subject: [PATCH 204/398] CppunitTest_sd_tiledrendering: CALLBACK_SEARCH_RESULT_SELECTION testcase Change-Id: I8a2fcaad5806ef204cdac0f6eaac615d50d6d9e8 (cherry picked from commit 28a5d4b5d3641837f3be8bc39ead111f9bba7015) --- sd/qa/unit/tiledrendering/tiledrendering.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 8ed091998ef1..f35449b12b2c 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include +#include +#include +#include #define LOK_USE_UNSTABLE_API #include #include @@ -19,9 +23,6 @@ #include #include #include -#include -#include -#include #include #include @@ -78,6 +79,7 @@ private: std::vector m_aSelection; bool m_bFound; sal_Int32 m_nPart; + std::vector m_aSearchResultSelection; #endif }; @@ -182,6 +184,16 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) m_nPart = aPayload.toInt32(); } break; + case LOK_CALLBACK_SEARCH_RESULT_SELECTION: + { + m_aSearchResultSelection.clear(); + boost::property_tree::ptree aTree; + std::stringstream aStream(pPayload); + boost::property_tree::read_json(aStream, aTree); + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) + m_aSearchResultSelection.push_back(rValue.second.data().c_str()); + } + break; } } @@ -387,6 +399,8 @@ void SdTiledRenderingTest::testSearch() lcl_search("bbb"); CPPUNIT_ASSERT_EQUAL(static_cast(1), m_nPart); CPPUNIT_ASSERT_EQUAL(true, m_bFound); + // This was 0; should be 1 match for "find". + CPPUNIT_ASSERT_EQUAL(static_cast(1), m_aSearchResultSelection.size()); // This should trigger the not-found callback. Application::EnableHeadlessMode(false); -- 2.12.0