diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-14 14:29:44 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-14 15:42:49 +0200 |
commit | 7d82dfd5d2c7610199a243c1eaa1e1a69e279527 (patch) | |
tree | 48e9d2626f88e9c399abdbedb66d56b3d38ec02d /sd/qa/unit | |
parent | 1c67b7f39971e6b7291e93b36f77c8593fd586c8 (diff) |
Add SdXImpressDocument::resetSelection() testcase.
Change-Id: I5bd6965bde1a5dcbe26abc197a67e09c06a2bb21
Diffstat (limited to 'sd/qa/unit')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 16ec35191641..7e3cf191f269 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -44,6 +44,7 @@ public: void testPostMouseEvent(); void testSetTextSelection(); void testSetGraphicSelection(); + void testResetSelection(); #endif CPPUNIT_TEST_SUITE(SdTiledRenderingTest); @@ -53,6 +54,7 @@ public: CPPUNIT_TEST(testPostMouseEvent); CPPUNIT_TEST(testSetTextSelection); CPPUNIT_TEST(testSetGraphicSelection); + CPPUNIT_TEST(testResetSelection); #endif CPPUNIT_TEST_SUITE_END(); @@ -243,6 +245,30 @@ void SdTiledRenderingTest::testSetGraphicSelection() CPPUNIT_ASSERT(aShapeBefore.getHeight() < aShapeAfter.getHeight()); } +void SdTiledRenderingTest::testResetSelection() +{ + SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); + uno::Reference<container::XIndexAccess> xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + xShape->setString("Aaa bbb."); + // Create a selection on the second word. + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdPage* pActualPage = pViewShell->GetActualPage(); + SdrObject* pObject = pActualPage->GetObj(0); + SdrView* pView = pViewShell->GetView(); + pView->SdrBeginTextEdit(pObject); + CPPUNIT_ASSERT(pView->GetTextEditObject()); + EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); + ESelection aWordSelection(0, 4, 0, 7); + rEditView.SetSelection(aWordSelection); + // Did we indeed manage to select the second word? + CPPUNIT_ASSERT_EQUAL(OUString("bbb"), rEditView.GetSelected()); + + // Now use resetSelection() to reset the selection. + pXImpressDocument->resetSelection(); + CPPUNIT_ASSERT(!pView->GetTextEditObject()); +} + #endif CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); |