sw/qa/extras/uiwriter/data/tdf128375.docx |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+)
New commits: commit ce8745f01a14a16c30e0ef62bc0a34ad4f7f4d0e Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Jan 19 20:58:13 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jan 20 09:21:27 2022 +0100 tdf#128375: sw_uiwriter3: Add unittest Change-Id: I24b862d23d2e8dd9fbe930043457963f4cceec1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128636 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/data/tdf128375.docx b/sw/qa/extras/uiwriter/data/tdf128375.docx new file mode 100644 index 000000000000..dffd4037c199 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf128375.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 85f56920d6b0..19945bfb7ae1 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -254,6 +254,28 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf138482) CPPUNIT_ASSERT_EQUAL(2, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128375) +{ + for (sal_Int32 i = 0; i < 2; ++i) + { + createSwDoc(DATA_DIRECTORY, "tdf128375.docx"); + + 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()); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + Scheduler::ProcessEventsToIdle(); + + // Without the fix in place, this test would have crashed cutting the second document + dispatchCommand(mxComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); + } +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135061) { createSwDoc(DATA_DIRECTORY, "tdf135061.odt");