sc/qa/unit/ucalc.cxx | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
New commits: commit c64570164e3c8161fa28368d609b7b7bdc039811 Author: Laurent Godard <lgodard.li...@laposte.net> Date: Mon Sep 23 10:17:42 2013 +0200 enhance transposed copy/paste unit test Change-Id: Ie0819a2af45e658430f8bb35bbbe7138582dafab diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d34d2c9..e5ef868 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -3000,7 +3000,7 @@ void Test::testCopyPasteTranspose() m_pDoc->InsertTab(1, OUString("Sheet2")); m_pDoc->SetValue(0, 0, 0, 1); - m_pDoc->SetValue(1, 0, 0, 2); + m_pDoc->SetString(1, 0, 0, OUString("=A1+1")); m_pDoc->SetString(2, 0, 0, OUString("test")); // add notes to A1:C1 @@ -3031,27 +3031,30 @@ void Test::testCopyPasteTranspose() ScRange aDestRange = ScRange(3,1,1,3,3,1);//target: Sheet2.D2:D4 ScMarkData aMark; - aMark.SetMarkArea(aSrcRange); + aMark.SetMarkArea(aDestRange); m_pDoc->CopyFromClip(aDestRange, aMark, IDF_ALL, NULL, pTransposedClip); - //check values after transposed copy/paste -/* + //check cell content after transposed copy/paste OUString aString = m_pDoc->GetString(3, 3, 1); - CPPUNIT_ASSERT_MESSAGE("Cell Sheet3.D4 should contain: test", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test"))); + CPPUNIT_ASSERT_MESSAGE("Cell Sheet2.D4 should contain: test", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test"))); + double fValue = m_pDoc->GetValue(ScAddress(3,1,1)); + ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied cell should return 1", fValue, 1); + fValue = m_pDoc->GetValue(ScAddress(3,2,1)); + ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula should return 2", fValue, 2); + m_pDoc->GetFormula(3, 2, 1, aString); + CPPUNIT_ASSERT_MESSAGE("transposed formula should point on Sheet2.D2", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("=D2+1"))); // check notes after transposed copy/paste CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D2", m_pDoc->HasNote(ScAddress(3, 1, 1))); CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D3", m_pDoc->HasNote(ScAddress(3, 2, 1))); CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D4", m_pDoc->HasNote(ScAddress(3, 3, 1))); + CPPUNIT_ASSERT_MESSAGE("Content of cell note on Sheet2.D2", + m_pDoc->GetNote(ScAddress(3, 1, 1))->GetText() == m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText()); + CPPUNIT_ASSERT_MESSAGE("Content of cell note on Sheet2.D3", + m_pDoc->GetNote(ScAddress(3, 2, 1))->GetText() == m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText()); + CPPUNIT_ASSERT_MESSAGE("Content of cell note on Sheet2.D2", + m_pDoc->GetNote(ScAddress(3, 3, 1))->GetText() == m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText()); - - double fValue = m_pDoc->GetValue(ScAddress(3,1,1)); - m_pDoc->GetFormula(3,1,1, aString); - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula should return 2", fValue, 2); - // CPPUNIT_ASSERT_MESSAGE("transposed formula string was not copied correctly", aString == aFormulaString); - fValue = m_pDoc->GetValue(ScAddress(3,2,1)); - CPPUNIT_ASSERT_MESSAGE("transposed copied value should be 1", fValue == 1); -*/ m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits