[Libreoffice-commits] core.git: Branch 'feature/sc-notes-storage' - 2 commits - sc/qa sc/source

Laurent Godard lgodard.libre at laposte.net
Wed Oct 2 03:22:55 PDT 2013


 sc/qa/unit/ucalc.cxx           |   43 +++++++++++++++++++----------------------
 sc/source/core/data/column.cxx |    1 
 2 files changed, 20 insertions(+), 24 deletions(-)

New commits:
commit 4f501ea9fbee49a74e18b3eb567887f60723eae9
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Wed Oct 2 12:20:48 2013 +0200

    testMoveBlock rework
    
    - still not functional
    
    Change-Id: Icc2f6fd844a67d9aecaeb1faad158bf7e3e1dcc2

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 3c8d330..3f45bef 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3070,69 +3070,66 @@ void Test::testCopyPasteTranspose()
 
 void Test::testMoveBlock()
 {
+    m_pDoc->InsertTab(0, "SheetNotes");
 
-    ScDocument* pDoc = getDocShell().GetDocument();
-
-    pDoc->InsertTab(0, "SheetNotes");
-
-    pDoc->SetValue(0, 0, 0, 1);
-    pDoc->SetString(1, 0, 0, OUString("=A1+1"));
-    pDoc->SetString(2, 0, 0, OUString("test"));
+    m_pDoc->SetValue(0, 0, 0, 1);
+    m_pDoc->SetString(1, 0, 0, OUString("=A1+1"));
+    m_pDoc->SetString(2, 0, 0, OUString("test"));
 
     // add notes to A1:C1
     ScAddress aAddrA1 (0, 0, 0);
     OUString aHelloA1("Hello world in A1");
-    ScPostIt* pNoteA1 = pDoc->GetOrCreateNote(aAddrA1);
+    ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAddrA1);
     pNoteA1->SetText(aAddrA1, aHelloA1);
     ScAddress aAddrB1 (1, 0, 0);
     OUString aHelloB1("Hello world in B1");
-    ScPostIt* pNoteB1 = pDoc->GetOrCreateNote(aAddrB1);
+    ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAddrB1);
     pNoteB1->SetText(aAddrB1, aHelloB1);
     ScAddress aAddrC1 (2, 0, 0);
     OUString aHelloC1("Hello world in C1");
-    ScPostIt* pNoteC1 = pDoc->GetOrCreateNote(aAddrC1);
+    ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAddrC1);
     pNoteC1->SetText(aAddrC1, aHelloC1);
     ScAddress aAddrD1 (3, 0, 0);
 
-    std::cout << "B1 note before moveblock: " << pNoteB1->GetText() << std::endl;
+    std::cout << "B1 note before moveblock: " << m_pDoc->GetNote(aAddrB1)->GetText() << std::endl;
     std::cout << "B1 note before moveblock should be: " << aHelloB1 << std::endl;
 
     // previous tests on cell note content are ok. this one fails !!! :(
-//    CPPUNIT_ASSERT_MESSAGE("Note content in B1", pNoteB1->GetText() == aHelloB1);
+    //CPPUNIT_ASSERT_MESSAGE("Note content in B1 before move block", m_pDoc->GetNote(aAddrB1)->GetText() == aHelloB1);
 
     // move notes to B1:D1
     bool bCut = true;
     ScDocFunc& rDocFunc = getDocShell().GetDocFunc();
     bool bMoveDone = rDocFunc.MoveBlock(ScRange(0, 0 ,0 ,2 ,0 ,0), ScAddress(1, 0, 0), bCut, false, false, false);
 
-    std::cout << "B1 note after moveblock: " << pDoc->GetNote(aAddrB1)->GetText() << std::endl;
+    std::cout << "B1 note after moveblock: " << m_pDoc->GetNote(aAddrB1)->GetText() << std::endl;
 
     CPPUNIT_ASSERT_MESSAGE("Cells not moved", bMoveDone);
 
     //check cell content
-    OUString aString = pDoc->GetString(3, 0, 0);
+    OUString aString = m_pDoc->GetString(3, 0, 0);
     CPPUNIT_ASSERT_MESSAGE("Cell D1 should contain: test", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test")));
     m_pDoc->GetFormula(2, 0, 0, aString);
     CPPUNIT_ASSERT_MESSAGE("Cell C1 should contain an updated formula", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("=B1+1")));
-    double fValue = pDoc->GetValue(aAddrB1);
+    double fValue = m_pDoc->GetValue(aAddrB1);
     ASSERT_DOUBLES_EQUAL_MESSAGE("Cell B1 should contain 1", fValue, 1);
 
     // cell notes has been moved 1 cell right (event when overlapping)
-    CPPUNIT_ASSERT_MESSAGE("There should be NO note on A1", !pDoc->HasNote(aAddrA1));
-    CPPUNIT_ASSERT_MESSAGE("There should be a note on B1", pDoc->HasNote(aAddrB1));
-    CPPUNIT_ASSERT_MESSAGE("There should be a note on C1", pDoc->HasNote(aAddrC1));
-    CPPUNIT_ASSERT_MESSAGE("There should be a note on D1", pDoc->HasNote(aAddrD1));
+    CPPUNIT_ASSERT_MESSAGE("There should be NO note on A1", !m_pDoc->HasNote(aAddrA1));
+    CPPUNIT_ASSERT_MESSAGE("There should be a note on B1", m_pDoc->HasNote(aAddrB1));
+    CPPUNIT_ASSERT_MESSAGE("There should be a note on C1", m_pDoc->HasNote(aAddrC1));
+    CPPUNIT_ASSERT_MESSAGE("There should be a note on D1", m_pDoc->HasNote(aAddrD1));
 /* still failing, wrong content ???
     OUString sNoteText;
-    sNoteText =  pDoc->GetNote(aAddrB1)->GetText();
+    sNoteText =  m_pDoc->GetNote(aAddrB1)->GetText();
     CPPUNIT_ASSERT_MESSAGE("Note content in B1", sNoteText == aHelloA1);
-    sNoteText =  pDoc->GetNote(aAddrC1)->GetText();
+    sNoteText =  m_pDoc->GetNote(aAddrC1)->GetText();
     CPPUNIT_ASSERT_MESSAGE("Note content in C1", sNoteText == aHelloB1);
-    sNoteText =  pDoc->GetNote(aAddrD1)->GetText();
+    sNoteText =  m_pDoc->GetNote(aAddrD1)->GetText();
     CPPUNIT_ASSERT_MESSAGE("Note content in D1", sNoteText == aHelloC1);
 */
 
-    pDoc->DeleteTab(0);
+    m_pDoc->DeleteTab(0);
 }
 
 void Test::testCopyPasteRelativeFormula()
commit 0922811023a008e95322ae5115c2e4eeba1044c8
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Wed Oct 2 10:30:12 2013 +0200

    cleaning comment
    
    Change-Id: Icf16db609d009192f4f7b2dfe14d5f8f1204a11d

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index a9d0c18..3de3fdb 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1426,7 +1426,6 @@ void ScColumn::CopyToClip(
     pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray,
                           rCxt.isKeepScenarioFlags() ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL );
 
-  //  CopyToClipHandler aFunc(*this, rColumn, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol), rCxt.isCloneNotes());
     CopyToClipHandler aFunc(*this, rColumn, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol), rCxt.isCloneNotes());
     sc::ParseBlock(maCells.begin(), maCells, aFunc, nRow1, nRow2);
 


More information about the Libreoffice-commits mailing list