summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-09-02 18:35:54 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-09-03 11:47:31 +0200
commitbc46ff73d6f79d850253f9e1896643eb73238ebb (patch)
tree0dc5ca4bd63b2ac7630889eaa73ae4fb5f28c60c /sw/qa/extras
parent48def32f9ce8f10baa6bb0f01ddfe5dfa16ecdfc (diff)
tdf#135056: sw_uiwriter: Add unittest
Change-Id: I933537a44b9493adc89516bccb189003cf4f132f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101950 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf135056.odtbin0 -> 19293 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf135056.odt b/sw/qa/extras/uiwriter/data3/tdf135056.odt
new file mode 100644
index 000000000000..bd94317d07d4
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf135056.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 1b7ac397b8e8..df37d45cc8e9 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -213,6 +213,31 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132321)
CPPUNIT_ASSERT_EQUAL(1, getShapes());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135056)
+{
+ load(DATA_DIRECTORY, "tdf135056.odt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pWrtShell->GetTOXCount());
+
+ const SwTOXBase* pTOX = pWrtShell->GetTOX(0);
+ CPPUNIT_ASSERT(pTOX);
+
+ //Without the fix in place, it would have hung here
+ pWrtShell->DeleteTOX(*pTOX, true);
+
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), pWrtShell->GetTOXCount());
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pWrtShell->GetTOXCount());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626)
{
load(DATA_DIRECTORY, "tdf126626.docx");