From 9197a52c1bd79bbdc0756724c74fd2a679b9f626 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 18 Jun 2020 11:08:38 +0200 Subject: tdf#133982: sw: Add unittest Change-Id: I1a9b0a1150f8e3e1832aaa15a09049622bd83afc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96592 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/qa/extras/uiwriter/data3/tdf133982.docx | Bin 0 -> 11705 bytes sw/qa/extras/uiwriter/uiwriter3.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 sw/qa/extras/uiwriter/data3/tdf133982.docx (limited to 'sw') 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 Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf133982.docx 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(getRun(getParagraph(1), 1), "HyperLinkURL")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982) +{ + load(DATA_DIRECTORY, "tdf133982.docx"); + + SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference 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"); -- cgit