diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-16 13:19:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-17 09:40:31 +0200 |
commit | 9d08a0cea018226ce155104d8df146dc2a412aac (patch) | |
tree | 6891a77e48ce5e8cdcbf25109334ba19607ac69d /sw | |
parent | 2e25b8c814b23ffb2904c2ad0866aeeb23b0f1fa (diff) |
avoid uno:Paste in tests
clipboard is a shared resource (except for svp) so interleaved
tests are not guaranteed to get out what they put in
Change-Id: Id3ec51417b99f3420034808f6a9fd39f6bc9a89c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102866
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 14 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 200 |
2 files changed, 166 insertions, 48 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 34fd549c9948..d74def305a0b 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -1020,7 +1020,7 @@ void SwUiWriterTest::testExportRTF() pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 3, /*bBasicCall=*/false); // Create the clipboard document. - auto xClpDoc = o3tl::make_shared<SwDoc>(); + rtl::Reference<SwDoc> xClpDoc(new SwDoc()); xClpDoc->SetClipBoard(true); pWrtShell->Copy(xClpDoc.get()); @@ -1308,8 +1308,16 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134250) dispatchCommand(mxComponent, ".uno:SelectAll", {}); dispatchCommand(mxComponent, ".uno:SelectAll", {}); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + // .uno:Copy without touching shared clipboard + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); + + // .uno:Paste without touching shared clipboard + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 5cfe6beb3aa4..1474e89a67b9 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -18,9 +18,10 @@ #include <com/sun/star/text/XPageCursor.hpp> #include <comphelper/propertysequence.hxx> #include <boost/property_tree/json_parser.hpp> +#include <fmtanchr.hxx> #include <frameformats.hxx> +#include <swdtflvr.hxx> #include <textboxhelper.hxx> -#include <fmtanchr.hxx> #include <o3tl/safeint.hxx> #include <tools/json_writer.hxx> #include <unotools/streamwrap.hxx> @@ -48,11 +49,19 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) CPPUNIT_ASSERT_EQUAL(8, getShapes()); CPPUNIT_ASSERT_EQUAL(2, getPages()); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); + CPPUNIT_ASSERT_EQUAL(3, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + CPPUNIT_ASSERT_EQUAL(8, getShapes()); CPPUNIT_ASSERT_EQUAL(2, getPages()); dispatchCommand(mxComponent, ".uno:Undo", {}); @@ -74,10 +83,18 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135412) CPPUNIT_ASSERT_EQUAL(4, getShapes()); uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("X"), xShape->getString()); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); + CPPUNIT_ASSERT_EQUAL(0, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + CPPUNIT_ASSERT_EQUAL(4, getShapes()); // Without the fix in place, the text in the shape wouldn't be pasted @@ -107,18 +124,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132911) CPPUNIT_ASSERT_EQUAL(4, getShapes()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); CPPUNIT_ASSERT_EQUAL(0, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); CPPUNIT_ASSERT_EQUAL(4, getShapes()); // Without the fix in place, it would have crashed here - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); CPPUNIT_ASSERT_EQUAL(8, getShapes()); @@ -133,12 +156,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132911) CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); CPPUNIT_ASSERT_EQUAL(0, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); CPPUNIT_ASSERT_EQUAL(4, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); CPPUNIT_ASSERT_EQUAL(8, getShapes()); @@ -263,18 +286,28 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626) CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL(2, getShapes()); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); + CPPUNIT_ASSERT_EQUAL(2, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(2, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(4, getShapes()); + dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(2, getShapes()); // without the fix, it crashes - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(4, getShapes()); } @@ -314,13 +347,19 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132187) CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL(1, getPages()); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); + dispatchCommand(mxComponent, ".uno:GoToEndOfDoc", {}); + TransferableDataHelper aHelper(xTransfer.get()); for (sal_Int32 i = 0; i < 10; ++i) { - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); } @@ -339,11 +378,19 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128739) CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL(OUString("Fehler: Verweis nicht gefunden"), getParagraph(1)->getString()); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); + CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(OUString("Fehler: Verweis nicht gefunden"), getParagraph(1)->getString()); + // without the fix, it crashes dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString()); @@ -357,11 +404,19 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124722) CPPUNIT_ASSERT(pTextDoc); CPPUNIT_ASSERT_EQUAL(22, getPages()); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); + CPPUNIT_ASSERT_EQUAL(22, getPages()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(43, getPages()); + dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(22, getPages()); } @@ -429,11 +484,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126504) dispatchCommand(mxComponent, ".uno:SelectAll", {}); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); + dispatchCommand(mxComponent, ".uno:GoToEndOfPage", {}); Scheduler::ProcessEventsToIdle(); - dispatchCommand(mxComponent, ".uno:Paste", {}); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess->getCount()); @@ -476,11 +535,14 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982) dispatchCommand(mxComponent, ".uno:SelectAll", {}); dispatchCommand(mxComponent, ".uno:SelectAll", {}); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); //Without the fix in place, it would have crashed here - dispatchCommand(mxComponent, ".uno:Cut", {}); + xTransfer->Cut(); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } @@ -502,8 +564,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134253) dispatchCommand(mxComponent, ".uno:SelectAll", {}); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); //Without the fix in place, it would have crashed here dispatchCommand(mxComponent, ".uno:Undo", {}); @@ -690,11 +755,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); //Position the mouse cursor (caret) after "ABC" below the blue image dispatchCommand(mxComponent, ".uno:GoRight", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + { + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + } // without the fix, it crashes CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); @@ -722,11 +793,16 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); + + xTransfer.set(new SwTransferable(*pWrtShell)); + xTransfer->Copy(); //Position the mouse cursor (caret) after "ABC" below the blue image dispatchCommand(mxComponent, ".uno:GoRight", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + { + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + } // without the fix, it crashes CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); @@ -817,8 +893,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129805) CPPUNIT_ASSERT_EQUAL(OUString("x"), getParagraph(1)->getString()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); // without the fix in place, it would crash here - dispatchCommand(mxComponent, ".uno:Cut", {}); + xTransfer->Cut(); CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString()); dispatchCommand(mxComponent, ".uno:Undo", {}); @@ -834,12 +913,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130685) CPPUNIT_ASSERT_EQUAL(2, getPages()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT_EQUAL(1, getPages()); - dispatchCommand(mxComponent, ".uno:Paste", {}); - dispatchCommand(mxComponent, ".uno:Paste", {}); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + SwTransferable::Paste(*pWrtShell, aHelper); // Without fix in place, this test would have failed with: //- Expected: 2 @@ -892,14 +976,18 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134931) CPPUNIT_ASSERT_EQUAL(1, getPages()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Copy", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Copy(); Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:GoDown", {}); + TransferableDataHelper aHelper(xTransfer.get()); for (sal_Int32 i = 0; i < 10; ++i) { - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); } @@ -927,13 +1015,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680) dispatchCommand(mxComponent, ".uno:SelectAll", {}); + rtl::Reference<SwDoc> xClpDoc(new SwDoc()); + xClpDoc->SetClipBoard(true); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); // without the fix, it crashes - dispatchCommand(mxComponent, ".uno:Cut", {}); + xTransfer->Cut(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + xClpDoc.clear(); + dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); + dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(sal_Int32(23), xIndexAccess->getCount()); } @@ -955,13 +1054,17 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf131684) dispatchCommand(mxComponent, ".uno:SelectAll", {}); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); dispatchCommand(mxComponent, ".uno:Undo", {}); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); // without the fix, it crashes @@ -1013,12 +1116,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132744) dispatchCommand(mxComponent, ".uno:SelectAll", {}); Scheduler::ProcessEventsToIdle(); - dispatchCommand(mxComponent, ".uno:Cut", {}); + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(0, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); //Without the fix in place, the image wouldn't be pasted @@ -1383,17 +1489,21 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133490) CPPUNIT_ASSERT_EQUAL(1, getShapes()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); - dispatchCommand(mxComponent, ".uno:Cut", {}); + + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(0, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(1, getShapes()); - dispatchCommand(mxComponent, ".uno:Paste", {}); + SwTransferable::Paste(*pWrtShell, aHelper); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(2, getShapes()); |