diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-04-14 20:45:49 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-05-29 10:29:04 +0200 |
commit | 03fe7a259e71d1c3f5190652649f9d4a6f75b4b7 (patch) | |
tree | 749bb8644c26f9d0fa4dc869012fb3e51b9d3739 | |
parent | fd6a96606d13a18e65af518668e4432af9e54c1a (diff) |
tdf#131684: Add unittest
Change-Id: Ic59d922700b4046a1ec94be5365b46dc8a021a00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92226
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
(cherry picked from commit 3ee27693301b50cdebd6a47e35b6621f0ac50cfe)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95022
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/qa/extras/uiwriter/data2/tdf131684.docx | bin | 0 -> 6506 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data2/tdf131684.docx b/sw/qa/extras/uiwriter/data2/tdf131684.docx Binary files differnew file mode 100644 index 000000000000..7d3397dfba60 --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/tdf131684.docx 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"); |