summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-25 21:19:51 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-30 23:49:54 -0400
commit407a677409707f017db464105aac51684126db44 (patch)
treef5758625eea9653f201fc46ad0e3988cc6933dc8 /sc/qa
parent11e64bb4a39eb92f81ead995940ae3953f8ad386 (diff)
Re-implement sheet reference adjustment on sheet move.
Change-Id: I24e93e0bbc51c7f9a1f1ea0c126a1399ace84a9e
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc_formula.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 531d1d327c25..a8a54d351d0a 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -813,6 +813,36 @@ void Test::testFormulaRefUpdateSheets()
if (!checkFormula(*m_pDoc, ScAddress(1,2,2), "SUM($Sheet1.$B$2:$C$3)"))
CPPUNIT_FAIL("Wrong formula in Sheet2.B3.");
+ // Move the last sheet (Sheet2) to the first position.
+ m_pDoc->MoveTab(2, 0);
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,0), "SUM(Sheet1.B2:C3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B2.");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "SUM($Sheet1.$B$2:$C$3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B3.");
+
+ // Move back.
+ m_pDoc->MoveTab(0, 2);
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,2), "SUM(Sheet1.B2:C3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B2.");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,2), "SUM($Sheet1.$B$2:$C$3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B3.");
+
+ // Move the "Temp" sheet to the last position.
+ m_pDoc->MoveTab(1, 2);
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B2.");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B3.");
+
+ // Move back.
+ m_pDoc->MoveTab(2, 1);
+
// Delete the temporary sheet.
m_pDoc->DeleteTab(1);
@@ -848,6 +878,26 @@ void Test::testFormulaRefUpdateSheets()
if (!checkFormula(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)"))
CPPUNIT_FAIL("Wrong formula in Sheet2.B3.");
+ // Append a bunch of sheets.
+ m_pDoc->InsertTab(2, "Temp1");
+ m_pDoc->InsertTab(3, "Temp2");
+ m_pDoc->InsertTab(4, "Temp3");
+
+ // Move these tabs around. This shouldn't affects the first 2 sheets.
+ m_pDoc->MoveTab(2, 4);
+ m_pDoc->MoveTab(3, 2);
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B2.");
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)"))
+ CPPUNIT_FAIL("Wrong formula in Sheet2.B3.");
+
+ // Delete the temp sheets.
+ m_pDoc->DeleteTab(4);
+ m_pDoc->DeleteTab(3);
+ m_pDoc->DeleteTab(2);
+
// Delete Sheet1.
m_pDoc->DeleteTab(0);
m_pDoc->GetName(0, aName);