[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/qa sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue May 7 20:57:23 PDT 2013


 sc/qa/unit/ucalc.cxx           |   13 +++++++++++++
 sc/source/core/data/column.cxx |    5 ++---
 2 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 64dbb627859a0582c741db8de62970fe04ee7832
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 7 23:58:49 2013 -0400

    Fix another broadcaster bug and a test code to catch it.
    
    Broadcasters are now independent of cell storage. We need to move them
    even when the cell array is empty.
    
    Change-Id: Ib26e544ad6e3842fa722d989c994c19d7c1b3005

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9941815..ffb2c47 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1643,6 +1643,19 @@ void Test::testCellBroadcaster()
     pBC = m_pDoc->GetBroadcaster(ScAddress(1,2,0));
     CPPUNIT_ASSERT_MESSAGE("Broadcaster in B3 should have been removed.", !pBC);
 
+    // Clear everything and start over.
+    clearRange(m_pDoc, ScRange(0,0,0,10,100,0));
+
+    m_pDoc->SetString(ScAddress(1,0,0), "=A1"); // B1 depends on A1.
+    pBC = m_pDoc->GetBroadcaster(ScAddress(0,0,0));
+    CPPUNIT_ASSERT_MESSAGE("Broadcaster should exist in A1.", pBC);
+
+    // While column A is still empty, move column A down 2 cells. This should
+    // move the broadcaster from A1 to A3.
+    m_pDoc->InsertRow(0, 0, 0, 0, 0, 2);
+    pBC = m_pDoc->GetBroadcaster(ScAddress(0,2,0));
+    CPPUNIT_ASSERT_MESSAGE("Broadcaster should exist in A3.", pBC);
+
     m_pDoc->DeleteTab(0);
 }
 
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 297fd66..1ffa949 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1121,7 +1121,8 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
 {
     pAttrArray->InsertRow( nStartRow, nSize );
 
-    //! Search
+    maBroadcasters.insert_empty(nStartRow, nSize);
+    maBroadcasters.resize(MAXROWCOUNT);
 
     if ( maItems.empty() )
         return;
@@ -1225,8 +1226,6 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
     maTextWidths.resize(MAXROWCOUNT);
     maScriptTypes.insert_empty(nStartRow, nSize);
     maScriptTypes.resize(MAXROWCOUNT);
-    maBroadcasters.insert_empty(nStartRow, nSize);
-    maBroadcasters.resize(MAXROWCOUNT);
 
     CellStorageModified();
 }


More information about the Libreoffice-commits mailing list