diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-24 17:11:25 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-24 17:47:40 +0200 |
commit | 7596e26fd259ce5445212949403e7cd32303b2bd (patch) | |
tree | cda3ea0acb777fa8ce97e1b8485648e62078ca53 /sw/qa | |
parent | 212dce21b62a4cfb85406bebe54ee07545516e21 (diff) |
Add SwTextBoxHelper::findShapes
It builds a textbox -> shape map, so methods interested to pick the
shape instead of a shape's textbox can call it and act accordingly if
their textbox is in the map.
Change-Id: I0f30d64a284eb461f462ed6c0a36c88271153f04
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/data/shape-textbox.odt (renamed from sw/qa/extras/uiwriter/data/shape-textbox-delete.odt) | bin | 10723 -> 10723 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 24 |
2 files changed, 23 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/data/shape-textbox-delete.odt b/sw/qa/extras/uiwriter/data/shape-textbox.odt Binary files differindex 0fe0e9b9cb89..0fe0e9b9cb89 100644 --- a/sw/qa/extras/uiwriter/data/shape-textbox-delete.odt +++ b/sw/qa/extras/uiwriter/data/shape-textbox.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 2bf8d5ac7598..9ec5a76d8022 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -17,8 +17,10 @@ #include <redline.hxx> #include <section.hxx> #include <fmtclds.hxx> +#include <dcontact.hxx> #include <svx/svdpage.hxx> +#include <svx/svdview.hxx> #include "UndoManager.hxx" @@ -39,6 +41,7 @@ public: void testFdo75110(); void testFdo75898(); void testFdo74981(); + void testShapeTextboxSelect(); void testShapeTextboxDelete(); void testCp1000071(); @@ -52,6 +55,7 @@ public: CPPUNIT_TEST(testFdo75110); CPPUNIT_TEST(testFdo75898); CPPUNIT_TEST(testFdo74981); + CPPUNIT_TEST(testShapeTextboxSelect); CPPUNIT_TEST(testShapeTextboxDelete); CPPUNIT_TEST(testCp1000071); CPPUNIT_TEST_SUITE_END(); @@ -282,9 +286,27 @@ void SwUiWriterTest::testFdo74981() CPPUNIT_ASSERT(!pTxtNode->HasHints()); } +void SwUiWriterTest::testShapeTextboxSelect() +{ + SwDoc* pDoc = createDoc("shape-textbox.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(1); + SwDrawContact* pTextBox = static_cast<SwDrawContact*>(pObject->GetUserCall()); + // First, make sure that pTextBox is a fly frame (textbox of a shape). + CPPUNIT_ASSERT_EQUAL(RES_FLYFRMFMT, static_cast<RES_FMT>(pTextBox->GetFmt()->Which())); + + // Then select it. + pWrtShell->SelectObj(Point(), 0, pObject); + const SdrMarkList& rMarkList = pWrtShell->GetDrawView()->GetMarkedObjectList(); + SwDrawContact* pShape = static_cast<SwDrawContact*>(rMarkList.GetMark(0)->GetMarkedSdrObj()->GetUserCall()); + // And finally make sure the shape got selected, not just the textbox itself. + CPPUNIT_ASSERT_EQUAL(RES_DRAWFRMFMT, static_cast<RES_FMT>(pShape->GetFmt()->Which())); +} + void SwUiWriterTest::testShapeTextboxDelete() { - SwDoc* pDoc = createDoc("shape-textbox-delete.odt"); + SwDoc* pDoc = createDoc("shape-textbox.odt"); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); SdrObject* pObject = pPage->GetObj(0); |