summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-01 17:01:21 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-03 09:41:10 +0200
commit6a206dd90c156965bfbf10dfa5729a427d3238af (patch)
tree7b9ed4b73ab3054f69c6441db46cd9ad5bdf70de
parentadcbe2fea4799764f467b75b455015698d2aac55 (diff)
CppunitTest_sw_tiledrendering: add search start point testcase
Fails without the sw/source hunk of commit 1dc60bc9e99304c58007bfd5a964ff3f78480106 (SvxSearchItem: add m_nStartPoint{X,Y}, 2015-05-28). Change-Id: I7b13294760a8a3c9c413a4a11582bc2a14d3d499 (cherry picked from commit 54619b4fa1cc477c92d0fa48cafffefe1b15a8fe)
-rw-r--r--sw/qa/extras/tiledrendering/data/search.odtbin10750 -> 10976 bytes
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx29
2 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/data/search.odt b/sw/qa/extras/tiledrendering/data/search.odt
index 5fb02fa1705d..9d98145e714d 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 a6dbe6011da0..c8d4b9245820 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -33,6 +33,7 @@ public:
void testSetGraphicSelection();
void testResetSelection();
void testSearch();
+ void testSearchViewArea();
void testDocumentSizeChanged();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
@@ -43,6 +44,7 @@ public:
CPPUNIT_TEST(testSetGraphicSelection);
CPPUNIT_TEST(testResetSelection);
CPPUNIT_TEST(testSearch);
+ CPPUNIT_TEST(testSearchViewArea);
CPPUNIT_TEST(testDocumentSizeChanged);
CPPUNIT_TEST_SUITE_END();
@@ -289,6 +291,33 @@ void SwTiledRenderingTest::testSearch()
#endif
}
+void SwTiledRenderingTest::testSearchViewArea()
+{
+#if !defined(WNT) && !defined(MACOSX)
+ SwXTextDocument* pXTextDocument = createDoc("search.odt");
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ // Go to the second page, 1-based.
+ pWrtShell->GotoPage(2, false);
+ SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false);
+ // Get the ~top left corner of the second page.
+ Point aPoint = pShellCrsr->GetSttPos();
+
+ // Go back to the first page, search while the cursor is there, but the
+ // visible area is the second page.
+ pWrtShell->GotoPage(1, false);
+ uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
+ {
+ {"SearchItem.SearchString", uno::makeAny(OUString("Heading"))},
+ {"SearchItem.Backward", uno::makeAny(false)},
+ {"SearchItem.SearchStartPointX", uno::makeAny(static_cast<sal_Int32>(aPoint.getX()))},
+ {"SearchItem.SearchStartPointY", uno::makeAny(static_cast<sal_Int32>(aPoint.getY()))}
+ }));
+ comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
+ // This was just "Heading", i.e. SwView::SearchAndWrap() did not search from only the top of the second page.
+ CPPUNIT_ASSERT_EQUAL(OUString("Heading on second page"), pShellCrsr->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+#endif
+}
+
void SwTiledRenderingTest::testDocumentSizeChanged()
{
#if !defined(WNT) && !defined(MACOSX)