diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-01 17:01:21 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-01 17:24:21 +0200 |
commit | 54619b4fa1cc477c92d0fa48cafffefe1b15a8fe (patch) | |
tree | cdd9abdcbe8243c6474cc7f8233358c6526d63d9 /sw/qa/extras | |
parent | 15cd958a8a5c0b8dbe8891e2ce47aea6c91ba914 (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
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/tiledrendering/data/search.odt | bin | 10750 -> 10976 bytes | |||
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 29 |
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 Binary files differindex 5fb02fa1705d..9d98145e714d 100644 --- a/sw/qa/extras/tiledrendering/data/search.odt +++ b/sw/qa/extras/tiledrendering/data/search.odt 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) |