[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Mon Feb 10 22:04:13 PST 2014


 sc/qa/unit/ucalc.cxx           |   46 ++++++++++++++++++++++++++++++++++++++++-
 sc/qa/unit/ucalc.hxx           |    2 +
 sc/source/ui/undo/undoblk3.cxx |    1 
 3 files changed, 48 insertions(+), 1 deletion(-)

New commits:
commit 182ac74065d8724bf74003cb72928b2cfa7388e9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Feb 11 01:08:15 2014 -0500

    fdo#74014: Broadcast here....
    
    Change-Id: Ib3c1e6b18af2c96c8c38237ab65f868ffec5f139

diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 95949b8..5c44dd8 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -142,6 +142,7 @@ void ScUndoDeleteContents::DoChange( const sal_Bool bUndo )
         aCopyRange.aEnd.SetTab(nTabCount-1);
 
         pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, bMulti, pDoc, &aMarkData );
+        BroadcastChanges(aCopyRange);
 
         DoSdrUndoAction( pDrawUndo, pDoc );
 
commit aa03bdcb5216ff82de22fc02ffa0746902f64972
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Feb 11 01:07:00 2014 -0500

    fdo#74014: Additional test.
    
    Though this one passes in unit test, but fails in real life session.  No
    idea why.
    
    Change-Id: I657ed5aa8b1aa0046458d26badf3cb22e3778d41

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index fc539d9..c06f82d 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5422,7 +5422,7 @@ void Test::testImportStream()
 
     m_pDoc->InsertTab(0, "Test");
 
-    m_pDoc->SetString(ScAddress(0,1,0), "=SUM(A1:C1)");
+    m_pDoc->SetString(ScAddress(0,1,0), "=SUM(A1:C1)"); // A2
 
     CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(0,1,0)));
 
@@ -5430,6 +5430,7 @@ void Test::testImportStream()
     ScAsciiOptions aOpt;
     aOpt.SetFieldSeps(",");
 
+    // Import values to A1:C1.
     ScImportExport aObj(m_pDoc, ScAddress(0,0,0));
     aObj.SetImportBroadcast(true);
     aObj.SetExtOptions(aOpt);
@@ -5463,6 +5464,49 @@ void Test::testImportStream()
     CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,1,0))); // formula
 
     pUndoMgr->Clear();
+
+    m_pDoc->DeleteTab(0);
+}
+
+void Test::testDeleteContents()
+{
+    sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc.
+    sc::UndoSwitch aUndoSwitch(*m_pDoc, true); // enable undo.
+
+    m_pDoc->InsertTab(0, "Test");
+
+    m_pDoc->SetValue(ScAddress(3,1,0), 1.0);
+    m_pDoc->SetValue(ScAddress(3,2,0), 1.0);
+    m_pDoc->SetValue(ScAddress(3,3,0), 1.0);
+    m_pDoc->SetValue(ScAddress(3,4,0), 1.0);
+    m_pDoc->SetValue(ScAddress(3,5,0), 1.0);
+    m_pDoc->SetValue(ScAddress(3,6,0), 1.0);
+    m_pDoc->SetValue(ScAddress(3,7,0), 1.0);
+    m_pDoc->SetValue(ScAddress(3,8,0), 1.0);
+    m_pDoc->SetString(ScAddress(3,15,0), "=SUM(D2:D15)");
+
+    CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(3,15,0))); // formula
+
+    // Delete D2:D6.
+    ScRange aRange(3,1,0,3,5,0);
+    ScMarkData aMark;
+    aMark.SelectOneTable(0);
+    aMark.SetMarkArea(aRange);
+
+    ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
+    pUndoDoc->InitUndo(m_pDoc, 0, 0);
+    m_pDoc->CopyToDocument(aRange, IDF_CONTENTS, false, pUndoDoc, &aMark);
+    ScUndoDeleteContents aUndo(&getDocShell(), aMark, aRange, pUndoDoc, false, IDF_CONTENTS, true);
+
+    clearRange(m_pDoc, aRange);
+    CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(3,15,0))); // formula
+
+    aUndo.Undo();
+    CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(3,15,0))); // formula
+
+    aUndo.Redo();
+    CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(3,15,0))); // formula
+
     m_pDoc->DeleteTab(0);
 }
 
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 64fde25..f94ac91 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -316,6 +316,7 @@ public:
     void testCondCopyPaste();
 
     void testImportStream();
+    void testDeleteContents();
     void testTransliterateText();
 
     void testColumnFindEditCells();
@@ -448,6 +449,7 @@ public:
     CPPUNIT_TEST(testCondFormatInsertCol);
     CPPUNIT_TEST(testCondCopyPaste);
     CPPUNIT_TEST(testImportStream);
+    CPPUNIT_TEST(testDeleteContents);
     CPPUNIT_TEST(testTransliterateText);
     CPPUNIT_TEST(testColumnFindEditCells);
     CPPUNIT_TEST_SUITE_END();


More information about the Libreoffice-commits mailing list