sc/qa/unit/ucalc.cxx | 30 ++++++++++++++++++++++++++++++ sc/qa/unit/ucalc.hxx | 2 ++ sc/source/core/data/table4.cxx | 10 +++++++--- 3 files changed, 39 insertions(+), 3 deletions(-)
New commits: commit e6304affe916ed7e310da7b348f7d2ff166718f5 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Dec 7 09:52:33 2014 +0100 add test case for fdo#86754 Change-Id: I0f57c1124e62d8946b68c614e3ff09d26b569e77 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d7d8cdb..d2c66bb 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4487,6 +4487,36 @@ void Test::testAutoFill() m_pDoc->DeleteTab(0); } +void Test::testAutoFillSimple() +{ + m_pDoc->InsertTab(0, "test"); + + m_pDoc->SetValue(0, 0, 0, 1); + m_pDoc->SetString(0, 1, 0, "=10"); + + ScMarkData aMarkData; + aMarkData.SelectTable(0, true); + + m_pDoc->Fill( 0, 0, 0, 1, NULL, aMarkData, 6, FILL_TO_BOTTOM, FILL_AUTO); + + for(SCROW nRow = 0; nRow < 8; ++nRow) + { + if (nRow % 2 == 0) + { + double nVal = m_pDoc->GetValue(0, nRow, 0); + CPPUNIT_ASSERT_EQUAL(double((nRow+2)/2), nVal); + } + else + { + OString aMsg = OString("wrong value in row: ") + OString::number(nRow); + double nVal = m_pDoc->GetValue(0, nRow, 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), 10.0, nVal); + } + } + + m_pDoc->DeleteTab(0); +} + void Test::testCopyPasteFormulas() { m_pDoc->InsertTab(0, "Sheet1"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index ed35ca1..9ab1199a 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -360,6 +360,7 @@ public: void testRenameTable(); void testAutoFill(); + void testAutoFillSimple(); void testCopyPasteFormulas(); void testCopyPasteFormulasExternalDoc(); @@ -564,6 +565,7 @@ public: CPPUNIT_TEST(testSetBackgroundColor); CPPUNIT_TEST(testRenameTable); CPPUNIT_TEST(testAutoFill); + CPPUNIT_TEST(testAutoFillSimple); CPPUNIT_TEST(testCopyPasteFormulas); CPPUNIT_TEST(testCopyPasteFormulasExternalDoc); CPPUNIT_TEST(testFindAreaPosVertical); commit 4cfca1b859bfb6b2dbe18d79a46f689fc6dbfbab Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Dec 7 09:17:50 2014 +0100 handle all fill cases correctly, fdo#86754 That special case only works if the whole source range contains formula cells. For now we just limit it to the special case of a single source cell. Change-Id: I71ccfde06edd97e5a9c78da22053583d05aac411 diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 68f9bd4..61a0be4 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1313,7 +1313,7 @@ void ScTable::FillAutoSimple( if (bVertical) // rInner&:=nRow, rOuter&:=nCol { aSrcCell = aCol[rCol].GetCellValue(nSource); - if (aSrcCell.meType == CELLTYPE_FORMULA) + if (nISrcStart == nISrcEnd && aSrcCell.meType == CELLTYPE_FORMULA) { FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, nIStart, nIEnd, pProgress, rProgress); return; commit dcd592731c632f05f851b87567acb417b53687b1 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sun Dec 7 08:25:16 2014 +0100 improve formatting Change-Id: Id652ff18023965cb2bcc7c10520f95a51e8ac15d diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 84bafad..68f9bd4 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1423,8 +1423,12 @@ void ScTable::FillAutoSimple( } } - if (rInner == nIEnd) break; - if (bPositive) ++rInner; else --rInner; + if (rInner == nIEnd) + break; + if (bPositive) + ++rInner; + else + --rInner; // Progress in inner loop only for expensive cells, // and even then not individually for each one _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits