summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter/uiwriter.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-08-15 15:59:56 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-08-15 16:48:58 +0200
commitc7307c77254557646f33017af915f6808a861e29 (patch)
treebd4ca78aa7bd07c7cfaa5072a62d59cf790ff5b9 /sw/qa/extras/uiwriter/uiwriter.cxx
parent0606ab6a73d5d9e3fd9f7b20f77a2532f2478194 (diff)
fdo#82191 sw::DocumentLayoutManager: copy textbox content of draw formats
The SwFmtCntnt, i.e. the content of the draw format was already copied, but that's only a pointer to the real content: instead duplicate the real contents on copy&paste, that's how we copy fly frames as well. Change-Id: I42475e356aaa1c54c08fb23a6a395d1726e5f33e
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter.cxx')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 10cb4545bb84..e12af858a32a 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -18,6 +18,7 @@
#include <section.hxx>
#include <fmtclds.hxx>
#include <dcontact.hxx>
+#include <textboxhelper.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdview.hxx>
@@ -46,6 +47,7 @@ public:
void testCp1000071();
void testShapeTextboxVertadjust();
void testShapeTextboxAutosize();
+ void testFdo82191();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -62,6 +64,7 @@ public:
CPPUNIT_TEST(testCp1000071);
CPPUNIT_TEST(testShapeTextboxVertadjust);
CPPUNIT_TEST(testShapeTextboxAutosize);
+ CPPUNIT_TEST(testFdo82191);
CPPUNIT_TEST_SUITE_END();
private:
@@ -390,6 +393,27 @@ void SwUiWriterTest::testShapeTextboxAutosize()
CPPUNIT_ASSERT(pFirst->GetSnapRect().getHeight() < pSecond->GetSnapRect().getHeight());
}
+void SwUiWriterTest::testFdo82191()
+{
+ SwDoc* pDoc = createDoc("fdo82191.odt");
+ SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+ // Make sure we have a single draw shape.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), SwTextBoxHelper::getCount(pPage, aTextBoxes));
+
+ SwDoc aClipboard;
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SdrObject* pObject = pPage->GetObj(0);
+ // Select it, then copy and paste.
+ pWrtShell->SelectObj(Point(), 0, pObject);
+ pWrtShell->Copy(&aClipboard);
+ pWrtShell->Paste(&aClipboard);
+
+ aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
+ // This was one: the textbox of the shape wasn't copied.
+ CPPUNIT_ASSERT_EQUAL(size_t(2), aTextBoxes.size());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();