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

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