diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-22 18:27:37 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-23 19:07:37 +0000 |
commit | 59c1c5a4e84b18f9ccf20fb46903aa37b61cf957 (patch) | |
tree | 1a6847764c7bb17431f0e4bcee81ce7c63e55bd3 /sc/qa | |
parent | 5c8991813dc303c7ffc8fef7d8d8f0779657fde6 (diff) |
add test for new ScMatConcat code
Change-Id: I084e08575e8efd27bebdd9ae9880322913789ba4
Reviewed-on: https://gerrit.libreoffice.org/23440
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 57 |
2 files changed, 61 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index b4efe3d4addb..848521d299ac 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -195,6 +195,8 @@ public: void testFuncLCM(); void testFuncSUMSQ(); void testFuncMDETERM(); + void testMatConcat(); + void testMatConcatReplication(); void testExternalRef(); void testExternalRefFunctions(); @@ -545,6 +547,8 @@ public: CPPUNIT_TEST(testFuncLCM); CPPUNIT_TEST(testFuncSUMSQ); CPPUNIT_TEST(testFuncMDETERM); + CPPUNIT_TEST(testMatConcat); + CPPUNIT_TEST(testMatConcatReplication); CPPUNIT_TEST(testExternalRef); CPPUNIT_TEST(testExternalRangeName); CPPUNIT_TEST(testExternalRefFunctions); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 2282fdaadc5c..56ef2288a8c0 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -7150,4 +7150,61 @@ void Test::testTdf97587() m_pDoc->DeleteTab(0); } +void Test::testMatConcat() +{ + CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test")); + + for (SCCOL nCol = 0; nCol < 10; ++nCol) + { + for (SCROW nRow = 0; nRow < 10; ++nRow) + { + m_pDoc->SetValue(ScAddress(nCol, nRow, 0), nCol*nRow); + } + } + + ScMarkData aMark; + aMark.SelectOneTable(0); + m_pDoc->InsertMatrixFormula(0, 12, 9, 21, aMark, "=A1:J10&A1:J10"); + + for (SCCOL nCol = 0; nCol < 10; ++nCol) + { + for (SCROW nRow = 12; nRow < 22; ++nRow) + { + OUString aStr = m_pDoc->GetString(ScAddress(nCol, nRow, 0)); + CPPUNIT_ASSERT_EQUAL(OUString(OUString::number(nCol * (nRow - 12)) + OUString::number(nCol * (nRow - 12))), aStr); + } + } + m_pDoc->DeleteTab(0); +} + +void Test::testMatConcatReplication() +{ + // if one of the matrices is an one column or row matrix + // the matrix is replicated across the larger matrix + CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test")); + + for (SCCOL nCol = 0; nCol < 10; ++nCol) + { + for (SCROW nRow = 0; nRow < 10; ++nRow) + { + m_pDoc->SetValue(ScAddress(nCol, nRow, 0), nCol*nRow); + } + } + + ScMarkData aMark; + aMark.SelectOneTable(0); + m_pDoc->InsertMatrixFormula(0, 12, 9, 21, aMark, "=A1:J10&A1:J1"); + + for (SCCOL nCol = 0; nCol < 10; ++nCol) + { + for (SCROW nRow = 12; nRow < 22; ++nRow) + { + OUString aStr = m_pDoc->GetString(ScAddress(nCol, nRow, 0)); + CPPUNIT_ASSERT_EQUAL(OUString(OUString::number(nCol * (nRow - 12)) + "0"), aStr); + } + } + + m_pDoc->DeleteTab(0); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |