diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-11 21:44:09 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-11 22:03:25 +0200 |
commit | a6a0ea2f352f98b801bb6aade04caeb07e180403 (patch) | |
tree | f176cd334a630a5e41d7aea83d32190e9f3a2fb2 /sc/qa/unit | |
parent | f61cbce529d039bb0e208e81cf66974cc4428420 (diff) |
add unit test for autofill
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
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); } |