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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 30 16:40:05 UTC 2020


 sw/qa/extras/uiwriter/data3/tdf124397.docx |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx        |   21 +++++++++++++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit d49df68ec4807f31df4fb3cdaa0448405ef40a29
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 30 17:55:06 2020 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 30 18:39:24 2020 +0200

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

diff --git a/sw/qa/extras/uiwriter/data3/tdf124397.docx b/sw/qa/extras/uiwriter/data3/tdf124397.docx
new file mode 100644
index 000000000000..65e2d25bcc62
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf124397.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index ebecddedbb16..362a0161751d 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -223,6 +223,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126340)
     CPPUNIT_ASSERT_EQUAL(OUString("foo"), getParagraph(1)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124397)
+{
+    load(DATA_DIRECTORY, "tdf124397.docx");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(),
+                                                         uno::UNO_QUERY);
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:Delete", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+    // Without the fix in place, it would crash here
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975)
 {
     // This test also covers tdf#117185 tdf#110442


More information about the Libreoffice-commits mailing list