summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-03-28 15:35:13 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-03-28 16:38:51 +0100
commit7937984a6a04446c0d3484832e6748ad925ddc80 (patch)
tree20f623737a9fe816496a1049d1eea0e8f3afdbdf /sc/qa
parentbe1b3daeeb64a44e577510561d02147b87db72c2 (diff)
test for tdf#90001
Change-Id: If0cb056d5a5e82bec1f4b863e40ec05b405280ac
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.hxx2
-rw-r--r--sc/qa/unit/ucalc_formula.cxx59
2 files changed, 61 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index a60e478bf770..1cec088af157 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -136,6 +136,7 @@ public:
void testFormulaRefUpdate();
void testFormulaRefUpdateRange();
void testFormulaRefUpdateSheets();
+ void testFormulaRefUpdateSheetsDelete();
void testFormulaRefUpdateInsertRows();
void testFormulaRefUpdateInsertColumns();
void testFormulaRefUpdateMove();
@@ -456,6 +457,7 @@ public:
CPPUNIT_TEST(testFormulaRefUpdate);
CPPUNIT_TEST(testFormulaRefUpdateRange);
CPPUNIT_TEST(testFormulaRefUpdateSheets);
+ CPPUNIT_TEST(testFormulaRefUpdateSheetsDelete);
CPPUNIT_TEST(testFormulaRefUpdateInsertRows);
CPPUNIT_TEST(testFormulaRefUpdateInsertColumns);
CPPUNIT_TEST(testFormulaRefUpdateMove);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index ca731a232bb5..fe7d417d6e9d 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1609,6 +1609,65 @@ void Test::testFormulaRefUpdateInsertRows()
m_pDoc->DeleteTab(0);
}
+void Test::testFormulaRefUpdateSheetsDelete()
+{
+ m_pDoc->InsertTab(0, "Sheet1");
+ m_pDoc->InsertTab(1, "Sheet2");
+ m_pDoc->InsertTab(2, "Sheet3");
+ m_pDoc->InsertTab(3, "Sheet4");
+
+ m_pDoc->SetString(ScAddress(1,1,1), "=SUM(Sheet1.A2:Sheet3.A2");
+ m_pDoc->SetString(ScAddress(2,1,1), "=SUM(Sheet1.A1:Sheet2.A1");
+ m_pDoc->SetString(ScAddress(3,1,1), "=SUM(Sheet2.A3:Sheet4.A3");
+
+ m_pDoc->SetString(ScAddress(1,2,1), "=SUM($Sheet1.A2:$Sheet3.A2");
+ m_pDoc->SetString(ScAddress(2,2,1), "=SUM($Sheet1.A1:$Sheet2.A1");
+ m_pDoc->SetString(ScAddress(3,2,1), "=SUM($Sheet2.A3:$Sheet4.A3");
+
+ m_pDoc->DeleteTab(2);
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.A2:Sheet2.A2)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(2,1,1), "SUM(Sheet1.A1:Sheet2.A1)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(3,1,1), "SUM(Sheet2.A3:Sheet4.A3)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.A2:$Sheet2.A2)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(2,2,1), "SUM($Sheet1.A1:$Sheet2.A1)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(3,2,1), "SUM($Sheet2.A3:$Sheet4.A3)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ m_pDoc->DeleteTab(0);
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,0), "SUM(Sheet2.A2:Sheet2.A2)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(2,1,0), "SUM(Sheet2.A1:Sheet2.A1)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(3,1,0), "SUM(Sheet2.A3:Sheet4.A3)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "SUM($Sheet2.A2:$Sheet2.A2)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(2,2,0), "SUM($Sheet2.A1:$Sheet2.A1)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ if (!checkFormula(*m_pDoc, ScAddress(3,2,0), "SUM($Sheet2.A3:$Sheet4.A3)"))
+ CPPUNIT_FAIL("Wrong Formula");
+
+ m_pDoc->DeleteTab(0);
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testFormulaRefUpdateInsertColumns()
{
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.