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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 3 10:40:57 UTC 2020


 sw/qa/extras/uiwriter/data3/tdf136728.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx       |   48 ++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

New commits:
commit 1da5f05be97b2cf4fa59adff6a77bdb70927202b
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Oct 1 17:45:50 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Sat Oct 3 12:40:22 2020 +0200

    tdf#136728 : sw_uiwriter: Add unittest
    
    Change-Id: I0c5f3bf454797ba7a892682087ec28d23e6f79b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103774
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf136728.odt b/sw/qa/extras/uiwriter/data3/tdf136728.odt
new file mode 100644
index 000000000000..a343938ed59f
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf136728.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 6ce22aa051df..315a6f9c4e0d 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -73,6 +73,54 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382)
     CPPUNIT_ASSERT_EQUAL(8, getShapes());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf136728)
+{
+#if !defined(_WIN32) // FIXME: For some reason, jenkins win build hangs here
+
+    load(DATA_DIRECTORY, "tdf136728.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    CPPUNIT_ASSERT_EQUAL(39, getPages());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell);
+    xTransfer->Cut();
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    TransferableDataHelper aHelper(xTransfer.get());
+    SwTransferable::Paste(*pWrtShell, aHelper);
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(39, getPages());
+
+    dispatchCommand(mxComponent, ".uno:JumpToNextTable", {});
+
+    dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    SwTransferable::Paste(*pWrtShell, aHelper);
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(39, getPages());
+
+    dispatchCommand(mxComponent, ".uno:JumpToNextTable", {});
+
+    dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+    Scheduler::ProcessEventsToIdle();
+
+    // Without the fix in place, this test would have crashed here
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+#endif
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134227)
 {
     load(DATA_DIRECTORY, "tdf134227.docx");


More information about the Libreoffice-commits mailing list