summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-06 10:18:18 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-07 11:57:07 +0200
commitcd07afe6f10f5a7d7b245b0ae3f100f16450c4db (patch)
tree315a21618068f3535dace72fa042e101aed74e39 /sw
parentc022211c1c09049c70d44bb60b8047ace3732d23 (diff)
CppunitTest_sw_tiledrendering: CALLBACK_SEARCH_RESULT_SELECTION testcase
Change-Id: I66a8d73581641c71f2dce2d1992070f3ccce08c2 (cherry picked from commit a7b86140d74039995bd4d312790244c1e2d4b501)
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index bcc328e366a3..2fd27dd4f8ff 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -7,6 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <string>
+#include <boost/property_tree/json_parser.hpp>
+
#include <swmodeltestbase.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/dispatchcommand.hxx>
@@ -23,7 +26,6 @@
#include <drawdoc.hxx>
#include <ndtxt.hxx>
#include <wrtsh.hxx>
-#include <string>
static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/";
@@ -71,6 +73,7 @@ private:
OString m_aTextSelection;
bool m_bFound;
sal_Int32 m_nSearchResultCount;
+ std::vector<OString> m_aSearchResultSelection;
};
SwTiledRenderingTest::SwTiledRenderingTest()
@@ -137,6 +140,16 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
m_nSearchResultCount = std::stoi(aStrPayload.substr(0, aStrPayload.find_first_of(";")));
}
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;
}
}
@@ -466,6 +479,8 @@ void SwTiledRenderingTest::testSearchAll()
comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
// This was 0; should be 2 results in the body text.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), m_nSearchResultCount);
+ // Make sure that we get exactly as many rectangle lists as matches.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m_aSearchResultSelection.size());
comphelper::LibreOfficeKit::setActive(false);
#endif