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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 2 18:24:55 UTC 2020


 sc/qa/unit/ucalc.hxx         |    2 ++
 sc/qa/unit/ucalc_formula.cxx |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

New commits:
commit 8c4847fb88059259f17d002c4fd84ef82937c2f3
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Nov 2 14:17:33 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Nov 2 19:24:11 2020 +0100

    tdf#100818: sc_ucalc: Add unittest
    
    Change-Id: I66c98b9ccd6ab3bf8df9312aa920c83bc789d269
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105183
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index de29194c2887..40ef0d2898a0 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -567,6 +567,7 @@ public:
     void testTdf97587();
     void testTdf107459();
     void testTdf133260();
+    void testTdf100818();
 
     void testEmptyCalcDocDefaults();
 
@@ -876,6 +877,7 @@ public:
     CPPUNIT_TEST(testTdf97587);
     CPPUNIT_TEST(testTdf107459);
     CPPUNIT_TEST(testTdf133260);
+    CPPUNIT_TEST(testTdf100818);
     CPPUNIT_TEST(testEmptyCalcDocDefaults);
     CPPUNIT_TEST(testPrecisionAsShown);
     CPPUNIT_TEST(testProtectedSheetEditByRow);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 83fbd63ec247..16258b1c9cf2 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -8539,6 +8539,32 @@ void Test::testTdf133260()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testTdf100818()
+{
+    CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Sheet1"));
+
+    //Insert local range name
+    ScRangeData* pLocal = new ScRangeData( *m_pDoc, "local", "$Sheet1.$A$1");
+    std::unique_ptr<ScRangeName> pLocalRangeName(new ScRangeName);
+    pLocalRangeName->insert(pLocal);
+    m_pDoc->SetRangeName(0, std::move(pLocalRangeName));
+
+    m_pDoc->SetValue(0, 0, 0, 1.0);
+
+    CPPUNIT_ASSERT(m_pDoc->InsertTab (1, "Sheet2"));
+
+    m_pDoc->SetString(0, 0, 1, "=INDIRECT(\"Sheet1.local\")");
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 1
+    // - Actual  : #REF!
+    CPPUNIT_ASSERT_EQUAL(OUString("1"), m_pDoc->GetString(0,0,1));
+
+    m_pDoc->DeleteTab(1);
+    m_pDoc->SetRangeName(0,nullptr); // Delete the names.
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testMatConcat()
 {
     CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test"));


More information about the Libreoffice-commits mailing list