diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-12-11 20:54:12 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-12-11 20:55:55 -0500 |
commit | 170616e9f2d30c1302bbb5a7a4b588bc05cd5cc9 (patch) | |
tree | 14874b362163c3abfb6cb54aebef5ba6ec41d258 /sc/qa | |
parent | 52781a55441cb270ffecc2522d1e069141a21607 (diff) |
fdo#86572: Write test for this.
Change-Id: I00c3eaac473f0464e923e785cc50ad6769c78d41
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sharedformula.cxx | 36 |
2 files changed, 38 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index b2332743f4e5..0c39d6f3576c 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -327,6 +327,7 @@ public: void testSharedFormulaMoveBlock(); void testSharedFormulaUpdateOnNamedRangeChange(); void testSharedFormulaUpdateOnDBChange(); + void testSharedFormulaAbsCellListener(); void testFormulaPosition(); void testMixData(); @@ -563,6 +564,7 @@ public: CPPUNIT_TEST(testSharedFormulaInsertColumn); CPPUNIT_TEST(testSharedFormulaUpdateOnNamedRangeChange); CPPUNIT_TEST(testSharedFormulaUpdateOnDBChange); + CPPUNIT_TEST(testSharedFormulaAbsCellListener); CPPUNIT_TEST(testFormulaPosition); CPPUNIT_TEST(testMixData); CPPUNIT_TEST(testJumpToPrecedentsDependents); diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 677f4ffad778..aa1d778bf354 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1656,4 +1656,40 @@ void Test::testSharedFormulaUpdateOnDBChange() m_pDoc->DeleteTab(0); } +void Test::testSharedFormulaAbsCellListener() +{ + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc. + + m_pDoc->InsertTab(0, "Test"); + + m_pDoc->SetValue(ScAddress(0,0,0), 1.0); + + const char* pData[][1] = { + { "=$A$1" }, + { "=$A$1" }, + { "=$A$1" } + }; + + insertRangeData(m_pDoc, ScAddress(1,0,0), pData, SAL_N_ELEMENTS(pData)); + + // A1 should have 3 listeners listening into it. + const SvtBroadcaster* pBC = m_pDoc->GetBroadcaster(ScAddress(0,0,0)); + CPPUNIT_ASSERT(pBC); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pBC->GetAllListeners().size()); + + // Check the formula results. + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(1,0,0))); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(1,1,0))); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(1,2,0))); + + // Change the value of A1 and make sure B1:B3 follows. + m_pDoc->SetValue(ScAddress(0,0,0), 2.5); + + CPPUNIT_ASSERT_EQUAL(2.5, m_pDoc->GetValue(ScAddress(1,0,0))); + CPPUNIT_ASSERT_EQUAL(2.5, m_pDoc->GetValue(ScAddress(1,1,0))); + CPPUNIT_ASSERT_EQUAL(2.5, m_pDoc->GetValue(ScAddress(1,2,0))); + + m_pDoc->DeleteTab(0); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |