diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-07 14:22:49 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-07 14:25:05 -0500 |
commit | 9d54a7f67196cac2a5701c06d8dc55f102d0af60 (patch) | |
tree | 78c290ab52eae9f70ede8506cfc87a576ac1fa49 | |
parent | b901f7699dae0c9985e80c22d4b9824b8386bdc1 (diff) |
fdo#75718: Write unit test for this.
Change-Id: I1f1fe515485209b67f14a1407ee20a88e71c08c9
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index bf691c689d27..a49b6d2fae21 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4220,6 +4220,42 @@ void Test::testAutoFill() aTestValue = m_pDoc->GetString( 0, i, 0 ); CPPUNIT_ASSERT_EQUAL( aTestValue, OUString("January") ); } + + // Clear column A for a new test. + clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0)); + m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows. + + // Fill A1:A6 with 1,2,3,4,5,6. + ScDocFunc& rFunc = getDocShell().GetDocFunc(); + m_pDoc->SetValue(ScAddress(0,0,0), 1.0); + ScRange aRange(0,0,0,0,5,0); + aMarkData.SetMarkArea(aRange); + rFunc.FillSeries(aRange, &aMarkData, FILL_TO_BOTTOM, FILL_AUTO, FILL_DAY, MAXDOUBLE, 1.0, MAXDOUBLE, true, true); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,0,0))); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0,1,0))); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,2,0))); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0,3,0))); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0,4,0))); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,5,0))); + + // Undo should clear the area except for the top cell. + SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); + CPPUNIT_ASSERT(pUndoMgr); + pUndoMgr->Undo(); + + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,0,0))); + for (SCROW i = 1; i <= 5; ++i) + CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(0,i,0)) == CELLTYPE_NONE); + + // Redo should put the serial values back in. + pUndoMgr->Redo(); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,0,0))); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0,1,0))); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,2,0))); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0,3,0))); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0,4,0))); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,5,0))); + m_pDoc->DeleteTab(0); } |