[Libreoffice-commits] core.git: sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Tue Jun 2 06:50:46 PDT 2015


 sw/qa/extras/tiledrendering/data/search.odt    |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit 3f3ea9fadd6dc643fbd12e99075a23d59ff73207
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 2 15:26:56 2015 +0200

    CppunitTest_sw_tiledrendering: add TextFrame search testcase
    
    Fails without commit 2d17cd6b03a214393755ddfed5ba50a18f0cd774 (sw:
    LOK_CALLBACK_TEXT_SELECTION should be the union of all selections,
    2015-06-02).
    
    Change-Id: I1d45eabf53dadd24051ff46acbf4bbfb85fb60a9

diff --git a/sw/qa/extras/tiledrendering/data/search.odt b/sw/qa/extras/tiledrendering/data/search.odt
index 9d98145..76ab2e1 100644
Binary files a/sw/qa/extras/tiledrendering/data/search.odt and b/sw/qa/extras/tiledrendering/data/search.odt differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index c8d4b92..ba8237e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -34,6 +34,7 @@ public:
     void testResetSelection();
     void testSearch();
     void testSearchViewArea();
+    void testSearchTextFrame();
     void testDocumentSizeChanged();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
@@ -45,6 +46,7 @@ public:
     CPPUNIT_TEST(testResetSelection);
     CPPUNIT_TEST(testSearch);
     CPPUNIT_TEST(testSearchViewArea);
+    CPPUNIT_TEST(testSearchTextFrame);
     CPPUNIT_TEST(testDocumentSizeChanged);
     CPPUNIT_TEST_SUITE_END();
 
@@ -54,6 +56,7 @@ private:
     void callbackImpl(int nType, const char* pPayload);
     Rectangle m_aInvalidation;
     Size m_aDocumentSize;
+    OString m_aTextSelection;
 };
 
 SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName)
@@ -98,6 +101,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
         m_aDocumentSize.setHeight(aSeq[1].toInt32());
     }
     break;
+    case LOK_CALLBACK_TEXT_SELECTION:
+    {
+        m_aTextSelection = pPayload;
+    }
+    break;
     }
 }
 
@@ -318,6 +326,22 @@ void SwTiledRenderingTest::testSearchViewArea()
 #endif
 }
 
+void SwTiledRenderingTest::testSearchTextFrame()
+{
+#if !defined(WNT) && !defined(MACOSX)
+    SwXTextDocument* pXTextDocument = createDoc("search.odt");
+    pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
+    {
+        {"SearchItem.SearchString", uno::makeAny(OUString("TextFrame"))},
+        {"SearchItem.Backward", uno::makeAny(false)},
+    }));
+    comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
+    // This was empty: nothing was highlighted after searching for 'TextFrame'.
+    CPPUNIT_ASSERT(!m_aTextSelection.isEmpty());
+#endif
+}
+
 void SwTiledRenderingTest::testDocumentSizeChanged()
 {
 #if !defined(WNT) && !defined(MACOSX)


More information about the Libreoffice-commits mailing list