tdf#134253: sw: Add unittest
Change-Id: Icd930f9c632a5c44d4391ca065afbc4db166ae37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98200
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data3/tdf134253.odt b/sw/qa/extras/uiwriter/data3/tdf134253.odt
new file mode 100644
index 0000000..234b0bd
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf134253.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index d7f20d6..d191f6e 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -310,6 +310,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982)
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134253)
{
load(DATA_DIRECTORY, "tdf134253.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(2), xIndexAccess->getCount());
CPPUNIT_ASSERT_EQUAL(6, getPages());
//Use selectAll 3 times in a row
dispatchCommand(mxComponent, ".uno:SelectAll", {});
dispatchCommand(mxComponent, ".uno:SelectAll", {});
dispatchCommand(mxComponent, ".uno:SelectAll", {});
dispatchCommand(mxComponent, ".uno:Copy", {});
dispatchCommand(mxComponent, ".uno:Paste", {});
//Without the fix in place, it would have crashed here
dispatchCommand(mxComponent, ".uno:Undo", {});
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
CPPUNIT_ASSERT_EQUAL(6, getPages());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf76636)
{
load(DATA_DIRECTORY, "tdf76636.doc");