sc/qa/unit/ucalc.cxx | 33 +++++++++++++++++++++++++++++---- sc/source/core/data/column.cxx | 2 +- 2 files changed, 30 insertions(+), 5 deletions(-)
New commits: commit 1e3ef350d730bc54a3e9c393c2df6fd1f839a3a8 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Sat Feb 8 09:42:46 2014 -0500 fdo#74414: No need to incremenet nRow here... It's just plain wrong. Change-Id: Iecdbb3eba46ddf2f2bc4f2334c7d45a4e2d801c8 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 7d10c20..8e3d365 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1928,7 +1928,7 @@ public: std::vector<EditTextObject*> aCloned; aCloned.reserve(nDataSize); - for (; it != itEnd; ++it, ++nRow) + for (; it != itEnd; ++it) aCloned.push_back(ScEditUtil::Clone(**it, mrDestCol.GetDoc())); maDestPos.miCellPos = mrDestCol.GetCellStore().set( commit 22cdd528d26d9e332df72135394f8d57bf227d03 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Sat Feb 8 09:35:11 2014 -0500 fdo#74414: Add a bit more check in existing test to catch this. Change-Id: I4ab844fe686e8c38968c34305936907380a1fe7b diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index b91255e..83498b3 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2042,15 +2042,27 @@ void Test::testCellCopy() void Test::testSheetCopy() { m_pDoc->InsertTab(0, "TestTab"); - m_pDoc->SetString(ScAddress(0,0,0), "copy me"); CPPUNIT_ASSERT_MESSAGE("document should have one sheet to begin with.", m_pDoc->GetTableCount() == 1); + + // Insert text in A1. + m_pDoc->SetString(ScAddress(0,0,0), "copy me"); + + // Insert edit cells in B1:B3. + ScFieldEditEngine& rEE = m_pDoc->GetEditEngine(); + rEE.SetText("Edit 1"); + m_pDoc->SetEditText(ScAddress(1,0,0), rEE.CreateTextObject()); + rEE.SetText("Edit 2"); + m_pDoc->SetEditText(ScAddress(1,1,0), rEE.CreateTextObject()); + rEE.SetText("Edit 3"); + m_pDoc->SetEditText(ScAddress(1,2,0), rEE.CreateTextObject()); + SCROW nRow1, nRow2; bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden && nRow1 == 0 && nRow2 == MAXROW); // insert a note - ScAddress aAdrA1 (0, 0, 0); // empty cell content - OUString aHelloA1("Hello world in A1"); + ScAddress aAdrA1 (0,2,0); // empty cell content. + OUString aHelloA1("Hello world in A3"); ScPostIt *pNoteA1 = m_pDoc->GetOrCreateNote(aAdrA1); pNoteA1->SetText(aAdrA1, aHelloA1); @@ -2059,7 +2071,20 @@ void Test::testSheetCopy() CPPUNIT_ASSERT_MESSAGE("document now should have two sheets.", m_pDoc->GetTableCount() == 2); bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("copied sheet should also have all rows visible as the original.", !bHidden && nRow1 == 0 && nRow2 == MAXROW); - CPPUNIT_ASSERT_MESSAGE("There should be note on A1 in new sheet", m_pDoc->HasNote(ScAddress (0, 0, 1))); + CPPUNIT_ASSERT_MESSAGE("There should be note on A3 in new sheet", m_pDoc->HasNote(ScAddress(0,2,1))); + CPPUNIT_ASSERT_EQUAL(OUString("copy me"), m_pDoc->GetString(ScAddress(0,0,1))); + + // Check the copied edit cells. + const EditTextObject* pEditObj = m_pDoc->GetEditText(ScAddress(1,0,1)); + CPPUNIT_ASSERT_MESSAGE("There should be an edit cell in B1.", pEditObj); + CPPUNIT_ASSERT_EQUAL(OUString("Edit 1"), pEditObj->GetText(0)); + pEditObj = m_pDoc->GetEditText(ScAddress(1,1,1)); + CPPUNIT_ASSERT_MESSAGE("There should be an edit cell in B2.", pEditObj); + CPPUNIT_ASSERT_EQUAL(OUString("Edit 2"), pEditObj->GetText(0)); + pEditObj = m_pDoc->GetEditText(ScAddress(1,2,1)); + CPPUNIT_ASSERT_MESSAGE("There should be an edit cell in B3.", pEditObj); + CPPUNIT_ASSERT_EQUAL(OUString("Edit 3"), pEditObj->GetText(0)); + m_pDoc->DeleteTab(1); m_pDoc->SetRowHidden(5, 10, 0, true); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits