From 7937984a6a04446c0d3484832e6748ad925ddc80 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 28 Mar 2015 15:35:13 +0100 Subject: test for tdf#90001 Change-Id: If0cb056d5a5e82bec1f4b863e40ec05b405280ac --- sc/qa/unit/ucalc.hxx | 2 ++ sc/qa/unit/ucalc_formula.cxx | 59 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) (limited to 'sc/qa') 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. -- cgit