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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu May 20 22:35:12 UTC 2021


 sw/qa/extras/uiwriter/data/tdf142157.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx       |   19 +++++++++++++++++++
 2 files changed, 19 insertions(+)

New commits:
commit aa6e9cceddfb154c2207ab316cb7625655452953
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu May 20 14:37:10 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri May 21 00:34:30 2021 +0200

    tdf#142157: sw_uiwriter: Add unittest
    
    Change-Id: I2dbc2f09d61220100fb616c28a8f2557c84f460f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115871
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf142157.odt b/sw/qa/extras/uiwriter/data/tdf142157.odt
new file mode 100644
index 000000000000..072c86889335
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf142157.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index e7d9e38153ab..8ef3de9d6a60 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -346,6 +346,7 @@ public:
     void testMsWordCompTrailingBlanks();
     void testCreateDocxAnnotation();
     void testTdf107976();
+    void testTdf142157();
     void testTdf108524();
     void testRhbz1810732();
     void testTableInSection();
@@ -577,6 +578,7 @@ public:
     CPPUNIT_TEST(testMsWordCompTrailingBlanks);
     CPPUNIT_TEST(testCreateDocxAnnotation);
     CPPUNIT_TEST(testTdf107976);
+    CPPUNIT_TEST(testTdf142157);
     CPPUNIT_TEST(testTdf108524);
     CPPUNIT_TEST(testRhbz1810732);
     CPPUNIT_TEST(testTableInSection);
@@ -6739,6 +6741,23 @@ void SwUiWriterTest::testRhbz1810732()
     }
 }
 
+void SwUiWriterTest::testTdf142157()
+{
+    mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+
+    const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf142157.odt";
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
+    dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+
+    uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 1
+    // - Actual  : 0
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+}
+
 void SwUiWriterTest::testTdf108524()
 {
     createDoc("tdf108524.odt");


More information about the Libreoffice-commits mailing list