sc/qa/unit/uicalc/uicalc.cxx |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit 3d8c11a8ea9cabb0ee77b279cc815ca67d39ba24
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Mar 14 11:18:46 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Mar 14 12:11:37 2022 +0100

    tdf#147894: sc_uicalc: Add unittest
    
    Change-Id: Id7e5159542b17a510958ea8e22343e979720a56b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131527
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 2922521a97b5..1409c0c7a534 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -355,6 +355,31 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf63805)
     CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 1, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf147894)
+{
+    mxComponent = loadFromDesktop("private:factory/scalc");
+    ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+    CPPUNIT_ASSERT(pModelObj);
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    //Select the first row
+    goToCell("1:1");
+
+    uno::Sequence<beans::PropertyValue> aArgs(
+        comphelper::InitPropertySequence({ { "FillDir", 
uno::Any(OUString("R")) },
+                                           { "FillCmd", 
uno::Any(OUString("L")) },
+                                           { "FillStep", 
uno::Any(OUString("1")) },
+                                           { "FillDateCmd", 
uno::Any(OUString("D")) },
+                                           { "FillStart", 
uno::Any(OUString("1")) } }));
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, ".uno:FillSeries", aArgs);
+
+    CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(ScAddress(0, 0, 0)));
+    CPPUNIT_ASSERT_EQUAL(16384.0, pDoc->GetValue(ScAddress(16383, 0, 0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf94208)
 {
     mxComponent = loadFromDesktop("private:factory/scalc");

Reply via email to