[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/qa sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Fri Aug 2 06:23:16 PDT 2013


 sc/qa/unit/ucalc.cxx            |   36 ++++++++++++++++++++++++++++++++++++
 sc/source/core/data/column3.cxx |    3 +--
 2 files changed, 37 insertions(+), 2 deletions(-)

New commits:
commit be4c731bd680cf531633890b913302dacd5e01b8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Aug 1 15:36:40 2013 -0400

    fdo#67489: Don't stop range search even when the first cell is empty.
    
    Because we aren't supposed to. Think of those formula cells that follow
    the empty one.
    
    Change-Id: I2cd04833d5e6c561e9ab6d83a984dbdceefa2e71
    Reviewed-on: https://gerrit.libreoffice.org/5233
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 93d8dd5..0bda2a4 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -218,6 +218,7 @@ public:
     void testDataArea();
     void testAutofilter();
     void testCopyPaste();
+    void testCopyPasteRelativeFormula();
     void testMergedCells();
     void testUpdateReference();
 
@@ -322,6 +323,7 @@ public:
     CPPUNIT_TEST(testToggleRefFlag);
     CPPUNIT_TEST(testAutofilter);
     CPPUNIT_TEST(testCopyPaste);
+    CPPUNIT_TEST(testCopyPasteRelativeFormula);
     CPPUNIT_TEST(testMergedCells);
     CPPUNIT_TEST(testUpdateReference);
     CPPUNIT_TEST(testJumpToPrecedentsDependents);
@@ -5964,6 +5966,40 @@ void Test::testCopyPaste()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testCopyPasteRelativeFormula()
+{
+    m_pDoc->InsertTab(0, "Formula");
+
+    AutoCalcSwitch aACSwitch(m_pDoc, true);
+
+    // Insert values to A2 and A4.
+    m_pDoc->SetValue(ScAddress(0,1,0), 1);
+    m_pDoc->SetValue(ScAddress(0,3,0), 2);
+
+    // Insert formula to B4.
+    m_pDoc->SetString(ScAddress(1,3,0), "=A4");
+    CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,3,0)));
+
+    // Select and copy B3:B4 to the clipboard.
+    ScRange aRange(1,2,0,1,3,0);
+    ScClipParam aClipParam(aRange, false);
+    ScMarkData aMark;
+    aMark.SetMarkArea(aRange);
+    ScDocument aClipDoc(SCDOCMODE_CLIP);
+    m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark);
+
+    // Paste it to B1:B2.
+    sal_uInt16 nFlags = IDF_ALL;
+    ScRange aDestRange(1,0,0,1,1,0);
+    aMark.SetMarkArea(aDestRange);
+    m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, NULL, &aClipDoc);
+
+    // B2 references A2, so the value should be 1.
+    CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(1,1,0)));
+
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testMergedCells()
 {
     //test merge and unmerge
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 4c688ef..2a24220 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1150,8 +1150,7 @@ void ScColumn::BroadcastInArea( SCROW nRow1, SCROW nRow2 )
 
     SCROW nRow;
     SCSIZE nIndex;
-    if (!Search(nRow1, nIndex))
-        return;
+    Search(nRow1, nIndex);
 
     while ( nIndex < maItems.size() && (nRow = maItems[nIndex].nRow) <= nRow2 )
     {


More information about the Libreoffice-commits mailing list