summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-11-04 15:42:54 +0100
committerEike Rathke <erack@redhat.com>2016-11-04 15:43:06 +0100
commit029bd007b9886479ad1282bac733da4f358881ed (patch)
treed7c4c8e99ef12931b8176f3349ee17fe167a5023
parent334a03d801f750c6c97e02ced4cc66e680888196 (diff)
unit test for tdf#103684, calculate status bar function across sheets
Change-Id: I8205cf56628b6b4d4b5d655386df994a9c02a1ad
-rw-r--r--sc/qa/unit/ucalc.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 24e0e4551528..65d5892b4c5a 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);
}