summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-06-18 11:08:38 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-06-18 16:48:01 +0200
commit9197a52c1bd79bbdc0756724c74fd2a679b9f626 (patch)
tree220cc93b07ec273296b180cf75ad35b83f2439ee /sw
parent392b0d1f04c25300cc0bee0ddea126b96e2dff4e (diff)
tdf#133982: sw: Add unittest
Change-Id: I1a9b0a1150f8e3e1832aaa15a09049622bd83afc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96592 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf133982.docxbin0 -> 11705 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf133982.docx b/sw/qa/extras/uiwriter/data3/tdf133982.docx
new file mode 100644
index 000000000000..d2e8573d15ac
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf133982.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 8a5e477af864..95d72d82f9a3 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -179,6 +179,31 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf125261)
getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL"));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982)
+{
+ load(DATA_DIRECTORY, "tdf133982.docx");
+
+ 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(2), xIndexAccess->getCount());
+
+ //Use selectAll 3 times in a row
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ //Without the fix in place, it would have crashed here
+ dispatchCommand(mxComponent, ".uno:Cut", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+
+ dispatchCommand(mxComponent, ".uno:Paste", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf76636)
{
load(DATA_DIRECTORY, "tdf76636.doc");