diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-06-18 11:08:38 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-26 09:29:36 +0100 |
commit | 95554417cad0a6597d9f633f87081ab3d2d03c11 (patch) | |
tree | 0c929084770520b005f71f381ac5e96917156e18 /sw/qa/extras/uiwriter/uiwriter.cxx | |
parent | 036224a6b74f51c6d44284c1fd33851be2b45ffe (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>
(cherry picked from commit 9197a52c1bd79bbdc0756724c74fd2a679b9f626)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104744
Tested-by: Michael Stahl <michael.stahl@cib.de>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter.cxx')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index cd8516d6c29e..1ace94e3d473 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -7356,6 +7356,31 @@ void SwUiWriterTest::testTdf38394() CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest, 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 + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + //Without the fix in place, it would have crashed here + lcl_dispatchCommand(mxComponent, ".uno:Cut", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); + + lcl_dispatchCommand(mxComponent, ".uno:Paste", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); +} + void SwUiWriterTest::testTdf59666() { SwDoc* pDoc = createDoc(); |