[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue May 27 11:48:39 PDT 2014
sc/qa/unit/ucalc.cxx | 43 +++++++++++++++++++++++++++++++++++++++++
sc/qa/unit/ucalc.hxx | 2 +
sc/source/core/data/column.cxx | 2 -
3 files changed, 46 insertions(+), 1 deletion(-)
New commits:
commit 054213e86b8f3b1084474b0447cc7ffaf82178c5
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue May 27 14:47:24 2014 -0400
fdo#78976: Correct way to determine the end position for matrix check.
Change-Id: Ifd6acd85a9bf33742cb62327a3b8a4320f35d0f3
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 485f5e8..7d6ebb1 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -154,7 +154,7 @@ sal_uInt16 ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sal_uInt16 n
}
size_t nRowsToRead = nRow2 - nRow + 1;
- size_t nEnd = std::min(it->size, nRowsToRead);
+ size_t nEnd = std::min(it->size, nOffset+nRowsToRead); // last row + 1
sc::formula_block::const_iterator itCell = sc::formula_block::begin(*it->data);
std::advance(itCell, nOffset);
for (size_t i = nOffset; i < nEnd; ++itCell, ++i)
commit 175519643daa87ba3e65eb4b52df3c8a2f60ac64
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue May 27 14:47:05 2014 -0400
fdo#78976: Test for this.
Change-Id: I454e29c2cdf0857d329d84000d79973489cebb41
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index aa7ac1a..3396446 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 39862ee..73181ee 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);
More information about the Libreoffice-commits
mailing list