summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-03-18 20:14:24 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-03-19 21:08:30 +0000
commit47d4f6252df2ec3cc9f7363ce37e043dcec20f2e (patch)
tree1947e8ae27ceea2019542e9044117f0201b37181
parent5b878718b90fe10a0c9a41777ebb8b22330bad3b (diff)
add test for tdf#93151
Change-Id: Ia51c50d29b4790d88e8b8e4b0708d6995d4226f7 Reviewed-on: https://gerrit.libreoffice.org/35440 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx27
2 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index b172776c0ac5..4d3558a71393 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -155,6 +155,7 @@ public:
void testFormulaRefUpdateName();
void testFormulaRefUpdateNameMove();
void testFormulaRefUpdateNameExpandRef();
+ void testFormulaRefUpdateNameExpandRef2();
void testFormulaRefUpdateNameDeleteRow();
void testFormulaRefUpdateNameCopySheet();
void testFormulaRefUpdateNameCopySheetCheckTab( SCTAB Tab, bool bCheckNames );
@@ -553,6 +554,7 @@ public:
CPPUNIT_TEST(testFormulaRefUpdateName);
CPPUNIT_TEST(testFormulaRefUpdateNameMove);
CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef);
+ CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef2);
CPPUNIT_TEST(testFormulaRefUpdateNameDeleteRow);
CPPUNIT_TEST(testFormulaRefUpdateNameCopySheet);
CPPUNIT_TEST(testFormulaRefUpdateNameDelete);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 6c288bce48e4..c11ecab06628 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2901,6 +2901,33 @@ void Test::testFormulaRefUpdateNameExpandRef()
m_pDoc->DeleteTab(0);
}
+void Test::testFormulaRefUpdateNameExpandRef2()
+{
+ setExpandRefs(true);
+
+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
+
+ m_pDoc->InsertTab(0, "Test");
+
+ bool bInserted = m_pDoc->InsertNewRangeName("MyRange", ScAddress(0,0,0), "$A$1:$B$3");
+ CPPUNIT_ASSERT(bInserted);
+
+ // Insert a new row at row 4, which should expand the named range to A1:A4.
+ ScDocFunc& rFunc = getDocShell().GetDocFunc();
+ ScMarkData aMark;
+ aMark.SelectOneTable(0);
+
+ // Insert a new column at column 3, which should expand the named
+ rFunc.InsertCells(ScRange(1,0,0,1,MAXROW,0), &aMark, INS_INSCOLS_BEFORE, false, true);
+ ScRangeData* pName = m_pDoc->GetRangeName()->findByUpperName("MYRANGE");
+ CPPUNIT_ASSERT(pName);
+ OUString aSymbol;
+ pName->GetSymbol(aSymbol, m_pDoc->GetGrammar());
+ CPPUNIT_ASSERT_EQUAL(OUString("$A$1:$C$3"), aSymbol);
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testFormulaRefUpdateNameDeleteRow()
{
m_pDoc->InsertTab(0, "Test");