sw/qa/extras/uiwriter/data3/tdf133982.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+)
New commits: commit 9197a52c1bd79bbdc0756724c74fd2a679b9f626 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jun 18 11:08:38 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jun 18 16:48:01 2020 +0200 tdf#133982: sw: Add unittest Change-Id: I1a9b0a1150f8e3e1832aaa15a09049622bd83afc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96592 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> 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<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"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits