summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-08 08:21:46 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-12-08 08:30:01 +0100
commit664e64a1901d84137245c14ecfa9432123238bfa (patch)
tree87b4869604aaa119094cb40ca358dc83d2054c41
parent1de372de21f9b74c5ee736437a9875b6c90da386 (diff)
add test for fdo#85304
Change-Id: I35692a4a4ccfd1aa5938078bdf32a3eaff082453
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx20
2 files changed, 22 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 9ab1199a3dad..81d8788c572f 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 44c78f328a02..5deed054cf14 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 {