diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-08 19:50:02 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-08 19:51:50 -0500 |
commit | 70ec826eeb8f0b311095869e23be1db95fc9d109 (patch) | |
tree | 212f521d1fadc91f17e4a5f378fd5a30e259e748 /sc/qa | |
parent | 78bf3c9abd4a8cd939e7ba4399ae4aab9f3b2982 (diff) |
New unit test to ensure correct matrix creation.
See fdo#56829 for what inspired this test case.
Change-Id: Iee15d85a35ae96769d21ce7061b352860a5b587b
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 5b48f2552db7..0606562eeaa2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -125,6 +125,7 @@ public: void testNamedRange(); void testCSV(); void testMatrix(); + void testEnterMixedMatrix(); /** * Basic test for pivot tables. @@ -250,6 +251,7 @@ public: CPPUNIT_TEST(testNamedRange); CPPUNIT_TEST(testCSV); CPPUNIT_TEST(testMatrix); + CPPUNIT_TEST(testEnterMixedMatrix); CPPUNIT_TEST(testPivotTable); CPPUNIT_TEST(testPivotTableLabels); CPPUNIT_TEST(testPivotTableDateLabels); @@ -1513,6 +1515,31 @@ void Test::testMatrix() checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat); } +void Test::testEnterMixedMatrix() +{ + m_pDoc->InsertTab(0, "foo"); + + // Insert the source values in A1:B2. + m_pDoc->SetString(0, 0, 0, "A"); + m_pDoc->SetString(1, 0, 0, "B"); + double val = 1.0; + m_pDoc->SetValue(0, 1, 0, val); + val = 2.0; + m_pDoc->SetValue(1, 1, 0, val); + + // Create a matrix range in A4:B5 referencing A1:B2. + ScMarkData aMark; + aMark.SelectOneTable(0); + m_pDoc->InsertMatrixFormula(0, 3, 1, 4, aMark, "=A1:B2", NULL); + + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,0,0), m_pDoc->GetString(0,3,0)); + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(1,0,0), m_pDoc->GetString(1,3,0)); + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(0,1,0), m_pDoc->GetValue(0,4,0)); + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(1,1,0), m_pDoc->GetValue(1,4,0)); + + m_pDoc->DeleteTab(0); +} + namespace { struct DPFieldDef |