summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-04-30 17:55:06 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2020-04-30 18:39:24 +0200
commitd49df68ec4807f31df4fb3cdaa0448405ef40a29 (patch)
tree8e53f0a405841a184aa90cd9fe1ed76dec542237 /sw/qa/extras
parent57f1c59be6b1027757266fe5cd02f9f8e0bae275 (diff)
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@libreoffice.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf124397.docxbin0 -> 29518 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx21
2 files changed, 21 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf124397.docx
Binary files 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