sw/qa/extras/uiwriter/data/tdf139638.odt |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 14 ++++++++++++++ 2 files changed, 14 insertions(+)
New commits: commit 89790beaf8464d890bcb000ee0c784b86732c355 Author: Xisco Fauli <[email protected]> AuthorDate: Tue Mar 2 14:03:17 2021 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Jan 19 17:57:31 2022 +0100 tdf#139638: sw_uiwriter3: Add unittest Change-Id: I7b98453b629734b4b07830687d1ec26b4bd468ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111834 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/qa/extras/uiwriter/data/tdf139638.odt b/sw/qa/extras/uiwriter/data/tdf139638.odt new file mode 100644 index 000000000000..5c3b73020ff8 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf139638.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 0de2971c5813..85f56920d6b0 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -17,6 +17,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <com/sun/star/table/TableBorder2.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/XDocumentIndex.hpp> #include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XTextTable.hpp> @@ -187,6 +188,19 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134227) CPPUNIT_ASSERT_EQUAL(4, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139638) +{ + createSwDoc(DATA_DIRECTORY, "tdf139638.odt"); + + uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexes = xIndexSupplier->getDocumentIndexes(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexes->getCount()); + uno::Reference<text::XDocumentIndex> xTOCIndex(xIndexes->getByIndex(0), uno::UNO_QUERY); + + // Without the fix in place, this test would have crashed + xTOCIndex->update(); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135412) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf135412.docx");
