summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-06-19 12:46:30 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-10-27 13:56:29 +0100
commit61d83ce8d29aa6dc1039df8e7f8c5afdbf42a266 (patch)
tree0ab092464810d093a9fdebd434675690da83d08c
parenta94b737cdc4027ee2b99b0feaee58bad14bab4b1 (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> (cherry picked from commit 8e4c79472644452431381733a5e4b21f98fcdcf3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104823 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r--sw/qa/extras/uiwriter/data/tdf133990.odtbin0 -> 17859 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx27
2 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf133990.odt b/sw/qa/extras/uiwriter/data/tdf133990.odt
new file mode 100644
index 000000000000..8eaca8161701
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf133990.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 623f7bec96eb..f3f43f193310 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -6004,6 +6004,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf132944)
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, 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
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ lcl_dispatchCommand(mxComponent, ".uno:Delete", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+
+ //Without the fix in place, it would have crashed here
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
void SwUiWriterTest::testTdf106701_tabOverMarginAutotab()
{
createDoc("tdf106701_tabOverMarginAutotab.doc");