diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-17 23:34:42 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-18 08:31:58 -0500 |
commit | 33751e97642c190dcd8692c46b4df2e7dce504d1 (patch) | |
tree | bbca3cfa6a73a0e6116aef7eeaebdc597eec44cf /sc/qa | |
parent | Register group area listeners as needed when inserting/deleting cells. (diff) | |
download | core-33751e97642c190dcd8692c46b4df2e7dce504d1.tar.gz core-33751e97642c190dcd8692c46b4df2e7dce504d1.zip |
Extend the test to cover insertion / deletion of rows.
Change-Id: I9c5f46af446f8384265d91ce5dfe269e7a090d09
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 960b180ab52d..248a0e9bff36 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4011,6 +4011,45 @@ void Test::testCopyPasteRepeatOneFormula() CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea); CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening); + // Insert a new row at row 1. + ScRange aRowOne(0,0,0,MAXCOL,0,0); + aMark.SetMarkArea(aRowOne); + ScDocFunc& rFunc = getDocShell().GetDocFunc(); + rFunc.InsertCells(aRowOne, &aMark, INS_INSROWS, true, true, false); + + CPPUNIT_ASSERT_MESSAGE("C1 should be empty.", m_pDoc->GetCellType(ScAddress(2,0,0)) == CELLTYPE_NONE); + + // Make there we only have one group area listener listening on A2:B11. + aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size()); + pListener = &aListeners[0]; + CPPUNIT_ASSERT_EQUAL(ScRange(0,1,0,1,10,0), pListener->maArea); + CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening); + + // Check the formula results. + for (SCROW i = 0; i < 10; ++i) + { + double fExpected = (i+1.0)*11.0; + CPPUNIT_ASSERT_EQUAL(fExpected, m_pDoc->GetValue(ScAddress(2,i+1,0))); + } + + // Delete row at row 1 to shift the cells up. + rFunc.DeleteCells(aRowOne, &aMark, DEL_DELROWS, true, true); + + // Check the formula results again. + for (SCROW i = 0; i < 10; ++i) + { + double fExpected = (i+1.0)*11.0; + CPPUNIT_ASSERT_EQUAL(fExpected, m_pDoc->GetValue(ScAddress(2,i,0))); + } + + // Check the group area listener again to make sure it's listening on A1:B10 once again. + aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size()); + pListener = &aListeners[0]; + CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea); + CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening); + m_pDoc->DeleteTab(0); } |