[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 30 12:57:24 UTC 2021


 sw/qa/extras/uiwriter/data/tdf135662.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx      |   26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit ed8b1b78272f7fce657fb7b5fd311c456df0916d
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Mar 30 12:17:42 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Mar 30 14:56:47 2021 +0200

    tdf#135662: sw_uiwriter3: Add unittest
    
    Change-Id: I517bff275bba0a84a69e79f45db1c2a873965feb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113345
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf135662.odt b/sw/qa/extras/uiwriter/data/tdf135662.odt
new file mode 100644
index 000000000000..d65725bda510
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf135662.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 47407eaf7149..944cb3b3f33b 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -83,6 +83,32 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382)
     CPPUNIT_ASSERT_EQUAL(8, getShapes());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135662)
+{
+    load(DATA_DIRECTORY, "tdf135662.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    CPPUNIT_ASSERT_EQUAL(2, getShapes());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell);
+    xTransfer->Cut();
+
+    CPPUNIT_ASSERT_EQUAL(0, getShapes());
+
+    TransferableDataHelper aHelper(xTransfer);
+    SwTransferable::Paste(*pWrtShell, aHelper);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 2
+    // - Actual  : 1
+    CPPUNIT_ASSERT_EQUAL(2, getShapes());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134227)
 {
     load(DATA_DIRECTORY, "tdf134227.docx");


More information about the Libreoffice-commits mailing list