[Libreoffice-commits] core.git: sc/qa
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Mar 23 19:08:14 UTC 2016
sc/qa/unit/ucalc.hxx | 4 +++
sc/qa/unit/ucalc_formula.cxx | 57 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
New commits:
commit 59c1c5a4e84b18f9ccf20fb46903aa37b61cf957
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Mar 22 18:27:37 2016 +0100
add test for new ScMatConcat code
Change-Id: I084e08575e8efd27bebdd9ae9880322913789ba4
Reviewed-on: https://gerrit.libreoffice.org/23440
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index b4efe3d..848521d 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 2282fda..56ef228 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: */
More information about the Libreoffice-commits
mailing list