summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-10-18 20:50:40 +0200
committerEike Rathke <erack@redhat.com>2016-10-18 21:00:17 +0200
commit5cfbab03f914946bf9e5813eae707328fda438f9 (patch)
treebaea5f3fe06c19e255f905dd2d7ccc5ceed93064 /sc
parent8b9ec421accf344e0e6921c35ba53d8ff0b2de40 (diff)
unit test for tdf#101583, named expression reference expansion
Change-Id: I40dc157ebb33da59e436214b703800dfabc11a23
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc_formula.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index c3436863c09a..37d498126d25 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2764,6 +2764,20 @@ void Test::testFormulaRefUpdateNameExpandRef()
m_pDoc->SetValue(ScAddress(0,3,0), 4.0);
CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,6,0)));
+ // Insert a new column at column 2, which should not expand the named
+ // range as it is only one column wide.
+ rFunc.InsertCells(ScRange(1,0,0,1,MAXROW,0), &aMark, INS_INSCOLS_BEFORE, false, true);
+ pName = m_pDoc->GetRangeName()->findByUpperName("MYRANGE");
+ CPPUNIT_ASSERT(pName);
+ pName->GetSymbol(aSymbol, m_pDoc->GetGrammar());
+ CPPUNIT_ASSERT_EQUAL(OUString("$A$1:$A$4"), aSymbol);
+
+ // Make sure the referenced area has not changed.
+ m_pDoc->SetValue(ScAddress(0,3,0), 2.0);
+ CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(0,6,0)));
+ m_pDoc->SetValue(ScAddress(1,3,0), 2.0);
+ CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(0,6,0)));
+
// Clear the document and start over.
m_pDoc->GetRangeName()->clear();
clearSheet(m_pDoc, 0);