[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Nov 25 14:16:13 PST 2014


 sc/qa/unit/ucalc.hxx            |    3 +++
 sc/qa/unit/ucalc_formula.cxx    |   29 +++++++++++++++++++++++++++++
 sc/source/core/data/bcaslot.cxx |    4 ++++
 3 files changed, 36 insertions(+)

New commits:
commit d8266cfcd657485e1ea817376eb00c9fb2c8260f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Nov 25 17:12:44 2014 -0500

    fdo#86615: Track dependent formulas after bulk-broadcasting...
    
    of group area listeners.
    
    Change-Id: I3a8d2ceb57462c2c2c4cddb6e34966d2465e149b

diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 4290fbd..8a5913f 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -1204,6 +1204,7 @@ void ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas()
 
     sc::BulkDataHint aHint(*pDoc, NULL);
 
+    bool bBroadcasted = false;
     BulkGroupAreasType::iterator it = maBulkGroupAreas.begin(), itEnd = maBulkGroupAreas.end();
     for (; it != itEnd; ++it)
     {
@@ -1213,9 +1214,12 @@ void ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas()
         assert(pSpans);
         aHint.setSpans(pSpans);
         pArea->GetBroadcaster().Broadcast(aHint);
+        bBroadcasted = true;
     }
 
     maBulkGroupAreas.clear();
+    if (bBroadcasted)
+        pDoc->TrackFormulas();
 }
 
 size_t ScBroadcastAreaSlotMachine::RemoveBulkArea( const ScBroadcastArea* pArea )
commit 96a4189c568fbf7f63bec13f7a77a114aa7a3ede
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Nov 25 17:11:57 2014 -0500

    fdo#86615: Write test for this.
    
    Change-Id: I75412790e0afc1dbe3255254ff13fd41c5e9934b

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index e20b069..21568ed 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -204,6 +204,8 @@ public:
      */
     void testFormulaDepTracking2();
 
+    void testFormulaDepTracking3();
+
     void testFormulaDepTrackingDeleteRow();
 
     void testFormulaDepTrackingDeleteCol();
@@ -491,6 +493,7 @@ public:
     CPPUNIT_TEST(testValueIterator);
     CPPUNIT_TEST(testFormulaDepTracking);
     CPPUNIT_TEST(testFormulaDepTracking2);
+    CPPUNIT_TEST(testFormulaDepTracking3);
     CPPUNIT_TEST(testFormulaDepTrackingDeleteRow);
     CPPUNIT_TEST(testFormulaDepTrackingDeleteCol);
     CPPUNIT_TEST(testFormulaMatrixResultUpdate);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index b15342f..90e906b 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -4248,6 +4248,35 @@ void Test::testFormulaDepTracking2()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testFormulaDepTracking3()
+{
+    sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calculation.
+
+    m_pDoc->InsertTab(0, "Formula");
+
+    const char* pData[][4] = {
+        { "1", "2", "=SUM(A1:B1)", "=SUM(C1:C3)" },
+        { "3", "4", "=SUM(A2:B2)", 0 },
+        { "5", "6", "=SUM(A3:B3)", 0 },
+    };
+
+    insertRangeData(m_pDoc, ScAddress(0,0,0), pData, SAL_N_ELEMENTS(pData), true);
+
+    // Check the initial formula results.
+    CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(2,0,0)));
+    CPPUNIT_ASSERT_EQUAL( 7.0, m_pDoc->GetValue(ScAddress(2,1,0)));
+    CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(2,2,0)));
+    CPPUNIT_ASSERT_EQUAL(21.0, m_pDoc->GetValue(ScAddress(3,0,0)));
+
+    // Change B3 and make sure the change gets propagated to D1.
+    ScDocFunc& rFunc = getDocShell().GetDocFunc();
+    rFunc.SetValueCell(ScAddress(1,2,0), 60.0, false);
+    CPPUNIT_ASSERT_EQUAL(65.0, m_pDoc->GetValue(ScAddress(2,2,0)));
+    CPPUNIT_ASSERT_EQUAL(75.0, m_pDoc->GetValue(ScAddress(3,0,0)));
+
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testFormulaDepTrackingDeleteRow()
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calculation.


More information about the Libreoffice-commits mailing list