summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-09-02 18:35:54 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-10-28 08:19:24 +0100
commitc64995d1e550b49a226d8f170b2e5533a59bb987 (patch)
treee5eb7dcb323c2ac6348502e4b9352106fea9337a
parentb2faa46071ff4a00672b0699e524e7ae66915fc0 (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> (cherry picked from commit bc46ff73d6f79d850253f9e1896643eb73238ebb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104826 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r--sw/qa/extras/uiwriter/data/tdf135056.odtbin0 -> 19293 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf135056.odt b/sw/qa/extras/uiwriter/data/tdf135056.odt
new file mode 100644
index 000000000000..bd94317d07d4
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf135056.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 0bd769d2b121..b98a12d0e90c 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4364,6 +4364,31 @@ void SwUiWriterTest::testDocModState()
CPPUNIT_ASSERT(!(pShell->IsModified()));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, 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());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pWrtShell->GetTOXCount());
+}
+
void SwUiWriterTest::testTdf94804()
{
//create new writer document