summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter/uiwriter.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-23 15:40:45 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-23 17:07:43 +0200
commit33141f999b22ce10cdbfbd76081fff211c4b5067 (patch)
tree94800cef6eed6bae27acfa62e8687b89eef06e25 /sw/qa/extras/uiwriter/uiwriter.cxx
parent295b97b2a654e00ac5a8e6a3545284fa583fce78 (diff)
SwDrawView::DeleteMarked: delete textbox of shape as well
If we delete a shape that had a textbox, then delete that textbox as well. Without that, the doc model would be still consistent, but most probably would not be what the user expects. Change-Id: Id5075233ce66d7a398c88ff3e63b05a6b2133571
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter.cxx')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 11fa7dfc798e..7fd4a7012f2c 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -12,6 +12,9 @@
#include <crsskip.hxx>
#include <shellio.hxx>
#include <expfld.hxx>
+#include <drawdoc.hxx>
+
+#include <svx/svdpage.hxx>
#include "UndoManager.hxx"
@@ -32,6 +35,7 @@ public:
void testFdo75110();
void testFdo75898();
void testFdo74981();
+ void testShapeTextboxDelete();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -43,6 +47,7 @@ public:
CPPUNIT_TEST(testFdo75110);
CPPUNIT_TEST(testFdo75898);
CPPUNIT_TEST(testFdo74981);
+ CPPUNIT_TEST(testShapeTextboxDelete);
CPPUNIT_TEST_SUITE_END();
private:
@@ -271,6 +276,23 @@ void SwUiWriterTest::testFdo74981()
CPPUNIT_ASSERT(!pTxtNode->HasHints());
}
+void SwUiWriterTest::testShapeTextboxDelete()
+{
+ SwDoc* pDoc = createDoc("shape-textbox-delete.odt");
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ SdrObject* pObject = pPage->GetObj(0);
+ pWrtShell->SelectObj(Point(), 0, pObject);
+ sal_Int32 nActual = pPage->GetObjCount();
+ // Two objects on the draw page: the shape and its textbox.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nActual);
+
+ pWrtShell->DelSelectedObj();
+ nActual = pPage->GetObjCount();
+ // Both (not only the shape) should be removed by now (the textbox wasn't removed, so this was 1).
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nActual);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();