Kaydet (Commit) 6a206dd9 authored tarafından Miklos Vajna's avatar Miklos Vajna

CppunitTest_sw_tiledrendering: add search start point testcase

Fails without the sw/source hunk of commit
1dc60bc9 (SvxSearchItem: add
m_nStartPoint{X,Y}, 2015-05-28).

Change-Id: I7b13294760a8a3c9c413a4a11582bc2a14d3d499
(cherry picked from commit 54619b4f)
üst adcbe2fe
...@@ -33,6 +33,7 @@ public: ...@@ -33,6 +33,7 @@ public:
void testSetGraphicSelection(); void testSetGraphicSelection();
void testResetSelection(); void testResetSelection();
void testSearch(); void testSearch();
void testSearchViewArea();
void testDocumentSizeChanged(); void testDocumentSizeChanged();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
...@@ -43,6 +44,7 @@ public: ...@@ -43,6 +44,7 @@ public:
CPPUNIT_TEST(testSetGraphicSelection); CPPUNIT_TEST(testSetGraphicSelection);
CPPUNIT_TEST(testResetSelection); CPPUNIT_TEST(testResetSelection);
CPPUNIT_TEST(testSearch); CPPUNIT_TEST(testSearch);
CPPUNIT_TEST(testSearchViewArea);
CPPUNIT_TEST(testDocumentSizeChanged); CPPUNIT_TEST(testDocumentSizeChanged);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -289,6 +291,33 @@ void SwTiledRenderingTest::testSearch() ...@@ -289,6 +291,33 @@ void SwTiledRenderingTest::testSearch()
#endif #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() void SwTiledRenderingTest::testDocumentSizeChanged()
{ {
#if !defined(WNT) && !defined(MACOSX) #if !defined(WNT) && !defined(MACOSX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment