tdf#147961: sw_uiwriter3: Add unittest
Change-Id: I49f4f98d77f0c5e8caa6471e9c938a472a9aaf96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131526
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 28fbddc..4eea50a 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -801,6 +801,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139737)
Scheduler::ProcessEventsToIdle();
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147961)
{
SwDoc* pDoc = createSwDoc();
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
pWrtShell->Insert("++");
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
// Without the fix in place, this test would have crashed here
pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147206)
{
SwDoc* pDoc = createSwDoc();