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

Eike Rathke erack at redhat.com
Fri Nov 4 14:43:47 UTC 2016


 sc/qa/unit/ucalc.cxx |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

New commits:
commit 029bd007b9886479ad1282bac733da4f358881ed
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Nov 4 15:42:54 2016 +0100

    unit test for tdf#103684, calculate status bar function across sheets
    
    Change-Id: I8205cf56628b6b4d4b5d655386df994a9c02a1ad

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 24e0e45..65d5892 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -676,6 +676,36 @@ void Test::testSelectionFunction()
         }
     }
 
+    // Calculate function across selected sheets.
+    clearSheet(m_pDoc, 0);
+    m_pDoc->InsertTab(1, "Test2");
+    m_pDoc->InsertTab(2, "Test3");
+
+    // Set values at B2 and C3 on each sheet.
+    m_pDoc->SetValue(ScAddress(1,1,0), 1.0);
+    m_pDoc->SetValue(ScAddress(2,2,0), 2.0);
+    m_pDoc->SetValue(ScAddress(1,1,1), 4.0);
+    m_pDoc->SetValue(ScAddress(2,2,1), 8.0);
+    m_pDoc->SetValue(ScAddress(1,1,2), 16.0);
+    m_pDoc->SetValue(ScAddress(2,2,2), 32.0);
+
+    // Mark B2 and C3 on first sheet.
+    aRanges.RemoveAll();
+    aRanges.Append(ScRange(1,1,0)); // B2
+    aRanges.Append(ScRange(2,2,0)); // C3
+    aMark.MarkFromRangeList(aRanges, true);
+    // Additionally select third sheet.
+    aMark.SelectTable(2, true);
+
+    {
+        double fRes = 0.0;
+        bool bRes = m_pDoc->GetSelectionFunction( SUBTOTAL_FUNC_SUM, ScAddress(), aMark, fRes);
+        CPPUNIT_ASSERT_MESSAGE("Failed to fetch selection function result.", bRes);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("1+2+16+32=", 51.0, fRes);
+    }
+
+    m_pDoc->DeleteTab(2);
+    m_pDoc->DeleteTab(1);
     m_pDoc->DeleteTab(0);
 }
 


More information about the Libreoffice-commits mailing list