Blame SOURCES/0176-CppunitTest_sw_tiledrendering-testcase-for-LOK_CALLB.patch

f325b2
From 1d76b4e38c93388488dbd7f32912f6f40e081721 Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Mon, 5 Oct 2015 15:34:28 +0200
f325b2
Subject: [PATCH 176/398] CppunitTest_sw_tiledrendering: testcase for
f325b2
 LOK_CALLBACK_SEARCH_RESULT_COUNT
f325b2
f325b2
Change-Id: I9f517bc2f3dfca9a2dc17a229f54c47b7790a355
f325b2
(cherry picked from commit b4e75e8f52c17d02a65022303fb6a0e4f1d97592)
f325b2
---
f325b2
 sw/qa/extras/tiledrendering/tiledrendering.cxx | 32 +++++++++++++++++++++++++-
f325b2
 1 file changed, 31 insertions(+), 1 deletion(-)
f325b2
f325b2
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
f325b2
index e7ab14942f79..c836f4bc5eab 100644
f325b2
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
f325b2
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
f325b2
@@ -18,6 +18,7 @@
f325b2
 #include <vcl/svapp.hxx>
f325b2
 #include <editeng/editview.hxx>
f325b2
 #include <editeng/outliner.hxx>
f325b2
+#include <svl/srchitem.hxx>
f325b2
 #include <crsskip.hxx>
f325b2
 #include <drawdoc.hxx>
f325b2
 #include <ndtxt.hxx>
f325b2
@@ -42,6 +43,7 @@ public:
f325b2
     void testSearchTextFrame();
f325b2
     void testSearchTextFrameWrapAround();
f325b2
     void testDocumentSizeChanged();
f325b2
+    void testSearchAll();
f325b2
 
f325b2
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
f325b2
     CPPUNIT_TEST(testRegisterCallback);
f325b2
@@ -56,6 +58,7 @@ public:
f325b2
     CPPUNIT_TEST(testSearchTextFrame);
f325b2
     CPPUNIT_TEST(testSearchTextFrameWrapAround);
f325b2
     CPPUNIT_TEST(testDocumentSizeChanged);
f325b2
+    CPPUNIT_TEST(testSearchAll);
f325b2
     CPPUNIT_TEST_SUITE_END();
f325b2
 
f325b2
 private:
f325b2
@@ -66,10 +69,12 @@ private:
f325b2
     Size m_aDocumentSize;
f325b2
     OString m_aTextSelection;
f325b2
     bool m_bFound;
f325b2
+    sal_Int32 m_nSearchResultCount;
f325b2
 };
f325b2
 
f325b2
 SwTiledRenderingTest::SwTiledRenderingTest()
f325b2
-    : m_bFound(true)
f325b2
+    : m_bFound(true),
f325b2
+      m_nSearchResultCount(0)
f325b2
 {
f325b2
 }
f325b2
 
f325b2
@@ -125,6 +130,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
f325b2
         m_bFound = false;
f325b2
     }
f325b2
     break;
f325b2
+    case LOK_CALLBACK_SEARCH_RESULT_COUNT:
f325b2
+    {
f325b2
+        m_nSearchResultCount = OString(pPayload).toInt32();
f325b2
+    }
f325b2
+    break;
f325b2
     }
f325b2
 }
f325b2
 
f325b2
@@ -438,6 +448,26 @@ void SwTiledRenderingTest::testDocumentSizeChanged()
f325b2
 #endif
f325b2
 }
f325b2
 
f325b2
+void SwTiledRenderingTest::testSearchAll()
f325b2
+{
f325b2
+#if !defined(WNT) && !defined(MACOSX)
f325b2
+    comphelper::LibreOfficeKit::setActive();
f325b2
+
f325b2
+    SwXTextDocument* pXTextDocument = createDoc("search.odt");
f325b2
+    pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
f325b2
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
f325b2
+    {
f325b2
+        {"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
f325b2
+        {"SearchItem.Backward", uno::makeAny(false)},
f325b2
+        {"SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(SvxSearchCmd::FIND_ALL))},
f325b2
+    }));
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
+
f325b2
+    comphelper::LibreOfficeKit::setActive(false);
f325b2
+#endif
f325b2
+}
f325b2
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
f325b2
 
f325b2
 CPPUNIT_PLUGIN_IMPLEMENT();
f325b2
-- 
f325b2
2.12.0
f325b2