Kaydet (Commit) a3ed62e2 authored tarafından Eike Rathke's avatar Eike Rathke

Unit test for array formula and OFFSET() non-ReferenceOrRefArray, tdf#123477

Change-Id: I1ffe56ada6caed305fd2dbd5fb838e6a7ab3c2e2
Reviewed-on: https://gerrit.libreoffice.org/68408Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: Jenkins
üst c438349f
......@@ -225,6 +225,7 @@ public:
void testFuncSUMIFS();
void testFuncRefListArraySUBTOTAL();
void testFuncJumpMatrixArrayIF();
void testFuncJumpMatrixArrayOFFSET();
void testMatConcat();
void testMatConcatReplication();
void testRefR1C1WholeCol();
......@@ -658,6 +659,7 @@ public:
CPPUNIT_TEST(testFuncSUMIFS);
CPPUNIT_TEST(testFuncRefListArraySUBTOTAL);
CPPUNIT_TEST(testFuncJumpMatrixArrayIF);
CPPUNIT_TEST(testFuncJumpMatrixArrayOFFSET);
CPPUNIT_TEST(testMatConcat);
CPPUNIT_TEST(testMatConcatReplication);
CPPUNIT_TEST(testExternalRef);
......
......@@ -8774,6 +8774,33 @@ void Test::testFuncJumpMatrixArrayIF()
m_pDoc->DeleteTab(0);
}
// tdf#123477 OFFSET() returns the matrix result instead of the reference list
// array if result is not used as ReferenceOrRefArray.
void Test::testFuncJumpMatrixArrayOFFSET()
{
sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
m_pDoc->InsertTab(0, "Test");
std::vector<std::vector<const char*>> aData = {
{ "abc" },
{ "bcd" },
{ "cde" }
};
insertRangeData(m_pDoc, ScAddress(0,0,0), aData); // A1:A3
ScMarkData aMark;
aMark.SelectOneTable(0);
// Matrix in C5:C7, COLUMN()-3 here offsets by 0 but the entire expression
// is in array/matrix context.
m_pDoc->InsertMatrixFormula( 2,4, 2,6, aMark, "=FIND(\"c\";OFFSET(A1:A3;0;COLUMN()-3))");
CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula C5 failed", 3.0, m_pDoc->GetValue(ScAddress(2,4,0)));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula C6 failed", 2.0, m_pDoc->GetValue(ScAddress(2,5,0)));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula C7 failed", 1.0, m_pDoc->GetValue(ScAddress(2,6,0)));
m_pDoc->DeleteTab(0);
}
// Test iterations with circular chain of references.
void Test::testIterations()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment