sw/qa/extras/uiwriter/uiwriter4.cxx |   40 ++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

New commits:
commit 2f5657ca8e54e2e49b6ad801a06d7d58fc725630
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Nov 16 12:33:49 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Nov 16 16:38:32 2021 +0100

    tdf#116640: sw_uiwriter4: Add unittest
    
    Change-Id: If201d0825dc9ad6f6ed15d2367f1f717ec9dd1c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125297
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 856281ea42e0..0b76f34ec616 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -49,6 +49,7 @@
 #include <AnnotationWin.hxx>
 #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
 #include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
 #include <vcl/TypeSerializer.hxx>
 
 #include <svx/svdpage.hxx>
@@ -224,6 +225,7 @@ public:
     void testCreateDocxAnnotation();
     void testTdf107976();
     void testTdf142157();
+    void testTdf116640();
     void testTdf108524();
     void testRhbz1810732();
     void testTableInSection();
@@ -341,6 +343,7 @@ public:
     CPPUNIT_TEST(testCreateDocxAnnotation);
     CPPUNIT_TEST(testTdf107976);
     CPPUNIT_TEST(testTdf142157);
+    CPPUNIT_TEST(testTdf116640);
     CPPUNIT_TEST(testTdf108524);
     CPPUNIT_TEST(testRhbz1810732);
     CPPUNIT_TEST(testTableInSection);
@@ -2079,6 +2082,43 @@ void SwUiWriterTest4::testTdf142157()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
 }
 
+void SwUiWriterTest4::testTdf116640()
+{
+    createSwDoc();
+
+    uno::Sequence<beans::PropertyValue> aArgs(
+        comphelper::InitPropertySequence({ { "Columns", 
uno::makeAny(sal_Int32(2)) } }));
+
+    dispatchCommand(mxComponent, ".uno:InsertSection", aArgs);
+    Scheduler::ProcessEventsToIdle();
+
+    uno::Reference<text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xSections(xTextSectionsSupplier->getTextSections(),
+                                                      uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xTextSection(xSections->getByIndex(0), 
uno::UNO_QUERY);
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+
+    uno::Reference<text::XTextColumns> xTextColumns
+        = getProperty<uno::Reference<text::XTextColumns>>(xTextSection, 
"TextColumns");
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+
+    dispatchCommand(mxComponent, ".uno:Redo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+}
+
 void SwUiWriterTest4::testTdf108524()
 {
     createSwDoc(DATA_DIRECTORY, "tdf108524.odt");

Reply via email to