diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-27 14:47:05 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-27 14:48:50 -0400 |
commit | 175519643daa87ba3e65eb4b52df3c8a2f60ac64 (patch) | |
tree | 132a810c899e252c957b7e4c0b322749408d3d7e /sc | |
parent | a6b00d16eb27a5e7e31c721671001a909ecef960 (diff) |
fdo#78976: Test for this.
Change-Id: I454e29c2cdf0857d329d84000d79973489cebb41
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 43 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 |
2 files changed, 45 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index aa7ac1a0a680..3396446d5f03 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -64,6 +64,8 @@ #include <globalnames.hxx> #include <inputopt.hxx> +#include <editable.hxx> + #include <formula/IFunctionDescription.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -2196,6 +2198,47 @@ void Test::testEnterMixedMatrix() m_pDoc->DeleteTab(0); } +void Test::testMatrixEditable() +{ + sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. + + m_pDoc->InsertTab(0, "Test"); + + // Values in A1:B1. + m_pDoc->SetValue(ScAddress(0,0,0), 1.0); + m_pDoc->SetValue(ScAddress(1,0,0), 2.0); + + // A2 is a normal formula. + m_pDoc->SetString(ScAddress(0,1,0), "=5"); + + // A3:A4 is a matrix. + ScRange aMatRange(0,2,0,0,3,0); + ScMarkData aMark; + aMark.SetMarkArea(aMatRange); + m_pDoc->InsertMatrixFormula(0, 2, 0, 3, aMark, "=TRANSPOSE(A1:B1)", NULL); + + // Check their values. + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0,1,0))); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,2,0))); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0,3,0))); + + // Make sure A3:A4 is a matrix. + ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(0,2,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_MESSAGE("A3 should be matrix origin.", pFC->GetMatrixFlag() == MM_FORMULA); + + pFC = m_pDoc->GetFormulaCell(ScAddress(0,3,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_MESSAGE("A4 should be matrix reference.", pFC->GetMatrixFlag() == MM_REFERENCE); + + // Check to make sure A3:A4 combined is editable. + ScEditableTester aTester; + aTester.TestSelection(m_pDoc, aMark); + CPPUNIT_ASSERT(aTester.IsEditable()); + + m_pDoc->DeleteTab(0); +} + void Test::testCellCopy() { m_pDoc->InsertTab(0, "TestTab"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 39862eebe9d6..73181eed8063 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -195,6 +195,7 @@ public: void testCSV(); void testMatrix(); void testEnterMixedMatrix(); + void testMatrixEditable(); /** * Basic test for pivot tables. @@ -442,6 +443,7 @@ public: CPPUNIT_TEST(testCSV); CPPUNIT_TEST(testMatrix); CPPUNIT_TEST(testEnterMixedMatrix); + CPPUNIT_TEST(testMatrixEditable); CPPUNIT_TEST(testPivotTable); CPPUNIT_TEST(testPivotTableLabels); CPPUNIT_TEST(testPivotTableDateLabels); |