sw/qa/extras/uiwriter/data2/tdf131684.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 31 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
New commits: commit 03fe7a259e71d1c3f5190652649f9d4a6f75b4b7 Author: Xisco Fauli <[email protected]> AuthorDate: Tue Apr 14 20:45:49 2020 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Fri May 29 10:29:04 2020 +0200 tdf#131684: Add unittest Change-Id: Ic59d922700b4046a1ec94be5365b46dc8a021a00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92226 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ <[email protected]> (cherry picked from commit 3ee27693301b50cdebd6a47e35b6621f0ac50cfe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95022 Reviewed-by: Michael Stahl <[email protected]> diff --git a/sw/qa/extras/uiwriter/data2/tdf131684.docx b/sw/qa/extras/uiwriter/data2/tdf131684.docx new file mode 100644 index 000000000000..7d3397dfba60 Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf131684.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 6472929fc5ab..3eb6f25d9d14 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -142,6 +142,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) getProperty<OUString>(getParagraph(3), "ParaStyleName")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf131684) +{ + load(DATA_DIRECTORY, "tdf131684.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(1), xIndexAccess->getCount()); + + //Use selectAll 3 times in a row + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + lcl_dispatchCommand(mxComponent, ".uno:Cut", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); + + lcl_dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + lcl_dispatchCommand(mxComponent, ".uno:Paste", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + // without the fix, it crashes + lcl_dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdfChangeNumberingListAutoFormat) { createDoc("tdf117923.docx"); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
