sw/qa/extras/tiledrendering/data/search.odt |binary sw/qa/extras/tiledrendering/tiledrendering.cxx | 29 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+)
New commits: commit 54619b4fa1cc477c92d0fa48cafffefe1b15a8fe Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Jun 1 17:01:21 2015 +0200 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 diff --git a/sw/qa/extras/tiledrendering/data/search.odt b/sw/qa/extras/tiledrendering/data/search.odt index 5fb02fa..9d98145 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 a6dbe60..c8d4b92 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) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits