[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 14 22:22:29 UTC 2020
sw/qa/extras/uiwriter/data3/tdf131684.docx |binary
sw/qa/extras/uiwriter/uiwriter3.cxx | 31 +++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
New commits:
commit 3ee27693301b50cdebd6a47e35b6621f0ac50cfe
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Apr 14 20:45:49 2020 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Apr 15 00:21:54 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í <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data3/tdf131684.docx b/sw/qa/extras/uiwriter/data3/tdf131684.docx
new file mode 100644
index 000000000000..7d3397dfba60
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf131684.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 2bafcd233e8f..2dc50a068445 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -374,6 +374,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680)
//CPPUNIT_ASSERT_EQUAL(sal_Int32(23), xIndexAccess->getCount());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, 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
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ dispatchCommand(mxComponent, ".uno:Cut", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+ dispatchCommand(mxComponent, ".uno:Paste", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+
+ // without the fix, it crashes
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf80663)
{
mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
More information about the Libreoffice-commits
mailing list