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

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sun Dec 7 23:31:41 PST 2014


 sc/qa/unit/ucalc.hxx          |    2 ++
 sc/qa/unit/ucalc_formula.cxx  |   20 ++++++++++++++++++++
 sc/source/core/tool/token.cxx |    3 +++
 3 files changed, 25 insertions(+)

New commits:
commit 664e64a1901d84137245c14ecfa9432123238bfa
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Dec 8 08:21:46 2014 +0100

    add test for fdo#85304
    
    Change-Id: I35692a4a4ccfd1aa5938078bdf32a3eaff082453

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 9ab1199a..81d8788 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -149,6 +149,7 @@ public:
     void testFormulaRefUpdateNameExpandRef();
     void testFormulaRefUpdateNameDeleteRow();
     void testFormulaRefUpdateNameCopySheet();
+    void testFormulaRefUpdateNameDelete();
     void testFormulaRefUpdateValidity();
     void testMultipleOperations();
     void testFuncCOLUMN();
@@ -454,6 +455,7 @@ public:
     CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef);
     CPPUNIT_TEST(testFormulaRefUpdateNameDeleteRow);
     CPPUNIT_TEST(testFormulaRefUpdateNameCopySheet);
+    CPPUNIT_TEST(testFormulaRefUpdateNameDelete);
     CPPUNIT_TEST(testFormulaRefUpdateValidity);
     CPPUNIT_TEST(testMultipleOperations);
     CPPUNIT_TEST(testFuncCOLUMN);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 44c78f32..5deed05 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2636,6 +2636,26 @@ void Test::testFormulaRefUpdateNameCopySheet()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testFormulaRefUpdateNameDelete()
+{
+    m_pDoc->InsertTab(0, "Test");
+
+    // Insert a new name 'MyRange' to reference B1
+    bool bInserted = m_pDoc->InsertNewRangeName("MyRange", ScAddress(0,0,0), "$Test.$B$1");
+    CPPUNIT_ASSERT(bInserted);
+
+    const ScRangeData* pName = m_pDoc->GetRangeName()->findByUpperName("MYRANGE");
+    CPPUNIT_ASSERT(pName);
+
+    m_pDoc->DeleteCol(1, 0, 3, 0, 0, 1);
+    const ScTokenArray* pCode = pName->GetCode();
+    sc::TokenStringContext aCxt(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH);
+    OUString aExpr = pCode->CreateString(aCxt, ScAddress(0,0,0));
+    CPPUNIT_ASSERT_EQUAL(OUString("$Test.$B$1"), aExpr);
+
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testFormulaRefUpdateValidity()
 {
     struct {
commit 1de372de21f9b74c5ee736437a9875b6c90da386
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Dec 8 08:05:34 2014 +0100

    don't update range name if ref not in update range, fdo#85304
    
    Change-Id: I1ccfacd98bd10f6ae1d4eaf7a705fe8863045697

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 74b30ad..f0ba930 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2955,6 +2955,9 @@ bool adjustSingleRefInName(
         return false;
     }
 
+    if (!rCxt.maRange.In(rRef.toAbs(rPos)))
+        return false;
+
     bool bChanged = false;
 
     if (rCxt.mnColDelta)


More information about the Libreoffice-commits mailing list