summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-02 15:26:56 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-03 09:41:10 +0200
commitfae7413e13e204ce0bd43a124a62ca48d94fdf48 (patch)
treefc74c86e564be31a24c7e1c8dae7a1db26d4fb9d
parent6a206dd90c156965bfbf10dfa5729a427d3238af (diff)
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 (cherry picked from commit 3f3ea9fadd6dc643fbd12e99075a23d59ff73207)
-rw-r--r--sw/qa/extras/tiledrendering/data/search.odtbin10976 -> 11324 bytes
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx24
2 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/data/search.odt b/sw/qa/extras/tiledrendering/data/search.odt
index 9d98145e714d..76ab2e19368d 100644
--- a/sw/qa/extras/tiledrendering/data/search.odt
+++ b/sw/qa/extras/tiledrendering/data/search.odt
Binary files differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index c8d4b9245820..ba8237e61699 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)