diff options
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 35 |
2 files changed, 36 insertions, 1 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index bc96ea5d61cf..11e247e78ce4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1146,7 +1146,7 @@ public: void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); - void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SC_DLLPUBLIC void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScProgress* pProgress, const ScMarkData& rMark, sal_uLong nFillCount, FillDir eFillDir = FILL_TO_BOTTOM, FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY, diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index e9b4d9040f41..8f15b8d7f2a6 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -208,6 +208,8 @@ public: void testSetBackgroundColor(); void testRenameTable(); + void testAutoFill(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); CPPUNIT_TEST(testInput); @@ -246,6 +248,7 @@ public: CPPUNIT_TEST(testJumpToPrecedentsDependents); CPPUNIT_TEST(testSetBackgroundColor); CPPUNIT_TEST(testRenameTable); + CPPUNIT_TEST(testAutoFill); CPPUNIT_TEST_SUITE_END(); private: @@ -4151,6 +4154,38 @@ void Test::testJumpToPrecedentsDependents() m_pDoc->DeleteTab(0); } +void Test::testAutoFill() +{ + m_pDoc->InsertTab(0, "test"); + + m_pDoc->SetValue(0,0,0,1); + + ScMarkData aMarkData; + aMarkData.SelectTable(0, true); + + m_pDoc->Fill( 0, 0, 0, 0, NULL, aMarkData, 5); + for (SCROW i = 0; i< 6; ++i) + CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i+1.0), m_pDoc->GetValue(0, i, 0), 0.00000001); + + // check that hidden rows are not affected by autofill + // set values for hidden rows + m_pDoc->SetValue(0,1,0,10); + m_pDoc->SetValue(0,2,0,10); + + m_pDoc->SetRowHidden(1, 2, 0, true); + m_pDoc->Fill( 0, 0, 0, 0, NULL, aMarkData, 8); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,1,0), 1e-08); + CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,2,0), 1e-08); + for (SCROW i = 3; i< 8; ++i) + CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i-1.0), m_pDoc->GetValue(0, i, 0), 0.00000001); + + + + + m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } |