summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-08-13 23:47:58 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-08-13 23:48:30 -0400
commit05f5191de3895b5c6b263d6dfba63f494e5e4a5b (patch)
tree68b5c4e47b748a3a35067bce81b3baf12d9aeb82 /sc/qa
parentc4d26f327605b77c8395bdb512d8ddcd8c11bfd1 (diff)
Do the same when deleting rows.
Change-Id: Ib1deab33a8771e196d0520bae872eb0d492c913e
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc_sharedformula.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 094db8f1acd1..4d9ad67f0e38 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -309,6 +309,37 @@ void Test::testSharedFormulasRefUpdate()
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
+ // Insert cells over A11:A12 and shift down.
+ m_pDoc->InsertRow(ScRange(0,10,0,0,11,0));
+ if (!checkFormula(*m_pDoc, ScAddress(1,0,0), "A10"))
+ CPPUNIT_FAIL("Wrong formula in B1");
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,0), "A13"))
+ CPPUNIT_FAIL("Wrong formula in B2");
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "A14"))
+ CPPUNIT_FAIL("Wrong formula in B3");
+
+ pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0));
+ CPPUNIT_ASSERT_MESSAGE("B1 should be a non-shared formula cell.", pFC && !pFC->IsShared());
+ pFC = m_pDoc->GetFormulaCell(ScAddress(1,1,0));
+ CPPUNIT_ASSERT_MESSAGE("This must be a shared formula cell.", pFC && pFC->IsShared());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
+
+ // Delete A11:A12 to bring it back to the way it was.
+ m_pDoc->DeleteRow(ScRange(0,10,0,0,11,0));
+
+ if (!checkFormula(*m_pDoc, ScAddress(1,0,0), "A10"))
+ CPPUNIT_FAIL("Wrong formula in B1");
+ if (!checkFormula(*m_pDoc, ScAddress(1,1,0), "A11"))
+ CPPUNIT_FAIL("Wrong formula in B2");
+ if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "A12"))
+ CPPUNIT_FAIL("Wrong formula in B3");
+
+ pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0));
+ CPPUNIT_ASSERT_MESSAGE("This must be a shared formula cell.", pFC && pFC->IsShared());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
+
m_pDoc->DeleteTab(0);
}