summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-11 21:44:09 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-11 22:03:25 +0200
commita6a0ea2f352f98b801bb6aade04caeb07e180403 (patch)
treef176cd334a630a5e41d7aea83d32190e9f3a2fb2 /sc
parentf61cbce529d039bb0e208e81cf66974cc4428420 (diff)
add unit test for autofill
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/qa/unit/ucalc.cxx35
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);
}