diff options
author | Eike Rathke <erack@redhat.com> | 2017-05-22 17:59:43 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-22 18:00:03 +0200 |
commit | e8a742344d612067a7a0ba5c752176d12a559967 (patch) | |
tree | 2bb90e9e732deacb20813a13e98c0110be8cdd5b | |
parent | a21f1c11aacde31fa190859828f257544afea818 (diff) |
Unit tests for ...,ref1,arrayofrefs,ref2) to result array, tdf#58874
Change-Id: I21e98ccd6c13c7e4aa98d5bbdd0dab6d9917a3dc
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index da0dc34cec2c..620d94bc2e38 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -7964,6 +7964,36 @@ void Test::testFuncRefListArraySUBTOTAL() aPos.IncRow(); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("SUBTOTAL STDEV for A4:A5 failed", 5.656854, m_pDoc->GetValue(aPos), 1e-6); + // Matrix in G7:G9, individual AVERAGE of A2:A3, A3:A4 and A4:A5 + // Plus two "ordinary" ranges, one before and one after. + m_pDoc->InsertMatrixFormula(6, 6, 6, 8, aMark, "=SUBTOTAL(1;A1:A2;OFFSET(A1;ROW(1:3);0;2);A5:A6)"); + aPos.Set(6,6,0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("SUBTOTAL AVERAGE for A1:A2,A2:A3,A5:A6 failed", 9.5, m_pDoc->GetValue(aPos)); + aPos.IncRow(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("SUBTOTAL AVERAGE for A1:A2,A3:A4,A5:A6 failed", 10.5, m_pDoc->GetValue(aPos)); + aPos.IncRow(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("SUBTOTAL AVERAGE for A1:A2,A4:A5,A5:A6 failed", 12.5, m_pDoc->GetValue(aPos)); + + // Matrix in H7:H9, individual MAX of A2:A3, A3:A4 and A4:A5 + // Plus two "ordinary" ranges, one before and one after. + m_pDoc->InsertMatrixFormula(7, 6, 7, 8, aMark, "=SUBTOTAL(4;A1:A2;OFFSET(A1;ROW(1:3);0;2);A5:A6)"); + aPos.Set(7,6,0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("SUBTOTAL MAX for A1:A2,A2:A3,A5:A6 failed", 32.0, m_pDoc->GetValue(aPos)); + aPos.IncRow(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("SUBTOTAL MAX for A1:A2,A3:A4,A5:A6 failed", 32.0, m_pDoc->GetValue(aPos)); + aPos.IncRow(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("SUBTOTAL MAX for A1:A2,A4:A5,A5:A6 failed", 32.0, m_pDoc->GetValue(aPos)); + + // Matrix in I7:I9, individual STDEV of A2:A3, A3:A4 and A4:A5 + // Plus two "ordinary" ranges, one before and one after. + m_pDoc->InsertMatrixFormula(8, 6, 8, 8, aMark, "=SUBTOTAL(7;A1:A2;OFFSET(A1;ROW(1:3);0;2);A5:A6)"); + aPos.Set(8,6,0); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("SUBTOTAL STDEV for A1:A2,A2:A3,A5:A6 failed", 12.35718, m_pDoc->GetValue(aPos), 1e-5); + aPos.IncRow(); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("SUBTOTAL STDEV for A1:A2,A3:A4,A5:A6 failed", 11.86170, m_pDoc->GetValue(aPos), 1e-5); + aPos.IncRow(); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("SUBTOTAL STDEV for A1:A2,A4:A5,A5:A6 failed", 11.55422, m_pDoc->GetValue(aPos), 1e-5); + m_pDoc->DeleteTab(0); } |