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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 5 09:09:29 UTC 2020


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

New commits:
commit e4208eb2c067afe77eb85699b9951d4a5df599f3
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Mar 4 14:33:46 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Mar 5 10:08:50 2020 +0100

    tdf#130680: Add unittest
    
    Change-Id: I5cb74cd23266d699fb381ccef0866d009cfd6c58
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89971
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf130680.odt b/sw/qa/extras/uiwriter/data3/tdf130680.odt
new file mode 100644
index 000000000000..9065433dcdaa
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf130680.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 6e9dc4f1d4e2..997e4d25317b 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -105,4 +105,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126340)
     dispatchCommand(mxComponent, ".uno:Undo", {});
     CPPUNIT_ASSERT_EQUAL(OUString("foo"), getParagraph(1)->getString());
 }
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680)
+{
+    load(DATA_DIRECTORY, "tdf130680.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
+                                                         uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(23), xIndexAccess->getCount());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+    // without the fix, it crashes
+    dispatchCommand(mxComponent, ".uno:Cut", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    //FIXME: See https://bugs.documentfoundation.org/show_bug.cgi?id=130680#c5
+    //dispatchCommand(mxComponent, ".uno:Undo", {});
+    //CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+    //dispatchCommand(mxComponent, ".uno:Undo", {});
+    //CPPUNIT_ASSERT_EQUAL(sal_Int32(23), xIndexAccess->getCount());
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list