[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 3 09:48:05 UTC 2020


 sw/qa/extras/uiwriter/data3/tdf135056.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx       |   25 +++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

New commits:
commit bc46ff73d6f79d850253f9e1896643eb73238ebb
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Sep 2 18:35:54 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Sep 3 11:47:31 2020 +0200

    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 at libreoffice.org>

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
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf135056.odt 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");


More information about the Libreoffice-commits mailing list