diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-06-19 12:46:30 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-06-19 16:01:34 +0200 |
commit | 8e4c79472644452431381733a5e4b21f98fcdcf3 (patch) | |
tree | 0ba07f49fdc00019cdc2973308f33c50dc9a4e2f /sw/qa | |
parent | 8df7447139b1171d8fd29f5d682b053df5936006 (diff) |
tdf#133990: sw: Add unittest
Change-Id: I3b5d1a2a2396fba9d350350ac4d04f7f97401ebe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96714
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf133990.odt | bin | 0 -> 17859 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 27 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf133990.odt b/sw/qa/extras/uiwriter/data3/tdf133990.odt Binary files differnew file mode 100644 index 000000000000..8eaca8161701 --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf133990.odt diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 95d72d82f9a3..dda897ee2ee3 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -179,6 +179,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf125261) getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133990) +{ + load(DATA_DIRECTORY, "tdf133990.odt"); + + 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(6), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + //Use selectAll 3 times in a row + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + dispatchCommand(mxComponent, ".uno:Delete", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); + + //Without the fix in place, it would have crashed here + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982) { load(DATA_DIRECTORY, "tdf133982.docx"); |