[Libreoffice-commits] core.git: sc/qa
Dennis Francis (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 22 10:13:53 UTC 2019
sc/qa/unit/parallelism.cxx | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
New commits:
commit 3e9ee3803535cde4c6f5de4fb7edf36e5ed6fac4
Author: Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Tue Oct 22 11:04:15 2019 +0530
Commit: Dennis Francis <dennis.francis at collabora.com>
CommitDate: Tue Oct 22 12:12:51 2019 +0200
Add a unit test for SUMPRODUCT with group-threading
This test protects the fix in commit :
2d2ea50e0de1df635d176d8032d2f9f8744e3abe
Cleanup the array-formula related members in ScInterpreter...
Change-Id: Ib98c49513e3edabdd2d2ebd1bfaf9718abb4e517
Reviewed-on: https://gerrit.libreoffice.org/81301
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx
index 9758836d8b9a..aebd1575b5c3 100644
--- a/sc/qa/unit/parallelism.cxx
+++ b/sc/qa/unit/parallelism.cxx
@@ -40,6 +40,7 @@ public:
void testMultipleFGColumn();
void testFormulaGroupSpanEval();
void testFormulaGroupSpanEvalNonGroup();
+ void testArrayFormulaGroup();
CPPUNIT_TEST_SUITE(ScParallelismTest);
CPPUNIT_TEST(testSUMIFS);
@@ -53,6 +54,7 @@ public:
CPPUNIT_TEST(testMultipleFGColumn);
CPPUNIT_TEST(testFormulaGroupSpanEval);
CPPUNIT_TEST(testFormulaGroupSpanEvalNonGroup);
+ CPPUNIT_TEST(testArrayFormulaGroup);
CPPUNIT_TEST_SUITE_END();
private:
@@ -659,6 +661,43 @@ void ScParallelismTest::testFormulaGroupSpanEvalNonGroup()
m_pDoc->DeleteTab(0);
}
+void ScParallelismTest::testArrayFormulaGroup()
+{
+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, false);
+ m_pDoc->InsertTab(0, "1");
+
+ m_pDoc->SetValue(1, 0, 0, 2.0); // B1 <== 2
+ m_pDoc->SetValue(2, 0, 0, 1.0); // C1 <== 1
+ OUString aFormula;
+
+ for (size_t nRow = 1; nRow < 16; ++nRow)
+ {
+ m_pDoc->SetValue(0, nRow, 0, 1.0); // A2:A16 <== 1
+
+ if (nRow > 10)
+ continue;
+
+ aFormula = "=SUMPRODUCT(($A" + OUString::number(1 + nRow) +
+ ":$A" + OUString::number(499 + nRow) + ")*B$1+C$1)";
+ // Formula-group in B2:B11 with first cell = "=SUMPRODUCT(($A2:$A500)*B$1+C$1)"
+ m_pDoc->SetFormula(ScAddress(1, nRow, 0), aFormula,
+ formula::FormulaGrammar::GRAM_NATIVE_UI);
+ }
+
+ m_xDocShell->DoHardRecalc();
+
+ size_t nExpected = 529;
+ OString aMsg;
+ for (size_t nRow = 1; nRow < 11; ++nRow)
+ {
+ aMsg = "Value at Cell B" + OString::number(nRow+1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), nExpected, static_cast<size_t>(m_pDoc->GetValue(1, nRow, 0)));
+ nExpected -= 2;
+ }
+
+ m_pDoc->DeleteTab(0);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScParallelismTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list