Kaydet (Commit) 1a2b8b23 authored tarafından Eike Rathke's avatar Eike Rathke

add unit test for fdo#88398

Check that grouped area listeners aren't discarded when unsharing a
grouped formula.

Change-Id: Ic3d3e9acb5b97d927a85ca433de127dd3b74a30c
üst 98a940b6
......@@ -329,6 +329,7 @@ public:
void testSharedFormulaUpdateOnNamedRangeChange();
void testSharedFormulaUpdateOnDBChange();
void testSharedFormulaAbsCellListener();
void testSharedFormulaUnshareAreaListeners();
void testFormulaPosition();
void testMixData();
......@@ -568,6 +569,7 @@ public:
CPPUNIT_TEST(testSharedFormulaUpdateOnNamedRangeChange);
CPPUNIT_TEST(testSharedFormulaUpdateOnDBChange);
CPPUNIT_TEST(testSharedFormulaAbsCellListener);
CPPUNIT_TEST(testSharedFormulaUnshareAreaListeners);
CPPUNIT_TEST(testFormulaPosition);
CPPUNIT_TEST(testMixData);
CPPUNIT_TEST(testJumpToPrecedentsDependents);
......
......@@ -1702,4 +1702,35 @@ void Test::testSharedFormulaAbsCellListener()
m_pDoc->DeleteTab(0);
}
void Test::testSharedFormulaUnshareAreaListeners()
{
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
m_pDoc->InsertTab(0, "Test");
const char* pData[][2] = {
{ "=SUM(B1:B2)", "1" },
{ "=SUM(B2:B3)", "2" },
{ "=SUM(B3:B4)", "4" },
{ 0, "8" }
};
insertRangeData(m_pDoc, ScAddress(0,0,0), pData, SAL_N_ELEMENTS(pData));
// Check that A1:A3 is a formula group.
const ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(0,0,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
m_pDoc->SetValue(ScAddress(0,1,0), 23.0); // unshare at A2
m_pDoc->SetValue(ScAddress(1,1,0), 16.0); // change value of B2
m_pDoc->SetValue(ScAddress(1,2,0), 32.0); // change value of B3
// A1 and A3 should be recalculated.
CPPUNIT_ASSERT_EQUAL(17.0, m_pDoc->GetValue(ScAddress(0,0,0)));
CPPUNIT_ASSERT_EQUAL(40.0, m_pDoc->GetValue(ScAddress(0,2,0)));
m_pDoc->DeleteTab(0);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment