sw/qa/extras/uiwriter/data/tdf156348.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx      |   24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit 09a351281ad82a6b4fc0a5def77ad3df4a0f031a
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Feb 5 12:06:54 2025 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Feb 5 13:40:54 2025 +0100

    tdf#156348: sw_uiwriter3: Add unittest
    
    Change-Id: Icaf8ad315035018f6b9e009e486b00c1fc9deceb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181157
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf156348.odt 
b/sw/qa/extras/uiwriter/data/tdf156348.odt
new file mode 100644
index 000000000000..c440822b65d1
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf156348.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 852ccd4e3b13..9be08e248dfc 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1341,6 +1341,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139737)
     dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf156348)
+{
+    createSwDoc("tdf156348.odt");
+
+    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());
+
+    dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+
+    uno::Sequence<beans::PropertyValue> aArgs(
+        comphelper::InitPropertySequence({ { "Delimiter", uno::Any(u"  "_ustr) 
},
+                                           { "WithHeader", uno::Any(false) },
+                                           { "RepeatHeaderLines", 
uno::Any(sal_uInt16(0)) },
+                                           { "WithBorder", uno::Any(false) },
+                                           { "DontSplitTable", uno::Any(false) 
} }));
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, u".uno:ConvertTextToTable"_ustr, aArgs);
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf150845)
 {
     createSwDoc();

Reply via email to