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

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Sep 26 22:29:44 UTC 2016


 sc/qa/unit/ucalc.cxx               |   13 +++++++++++++
 sc/qa/unit/ucalc.hxx               |    1 +
 sc/qa/unit/ucalc_condformat.cxx    |    5 ++---
 sc/source/core/data/colorscale.cxx |    4 ----
 4 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit f3531bebd1746e2f3cec2a18d92322ab482ee2ab
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Sep 27 00:11:32 2016 +0200

    tdf#101104 this paranoid safety check actually causes a bug
    
    Change-Id: Id31f98f5f84eabf603045e4d9f7ebd448689eed5

diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 2f816b0..25707bf 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -944,10 +944,6 @@ ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const ScAddress& rAddr) const
     double nMin = GetMinValue();
     double nMax = GetMaxValue();
 
-    // this check is for safety
-    if(nMin > nMax)
-        return nullptr;
-
     sal_Int32 nIndex = 0;
     const_iterator itr = begin();
     ++itr;
commit c8a5f46b6121106d3efc0a4d45922bf910f6f94c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Sep 26 22:28:20 2016 +0200

    OOPS, we were actually testing the wrong method
    
    Change-Id: I29adf81d3da56d7150e5182025d931ee62598e63

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 0db6a1c..f103f7d 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -34,6 +34,7 @@
 #include "dbdata.hxx"
 #include "reftokenhelper.hxx"
 #include "userdat.hxx"
+#include "clipcontext.hxx"
 
 #include "docsh.hxx"
 #include "docfunc.hxx"
@@ -6135,6 +6136,18 @@ void Test::pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocu
     pDestDoc->CopyFromClip(rDestRange, aMark, InsertDeleteFlags::ALL, nullptr, pClipDoc);
 }
 
+void Test::pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc, InsertDeleteFlags eFlags)
+{
+    ScMarkData aMark;
+    aMark.SetMarkArea(rDestRange);
+    sc::CopyFromClipContext aCxt(*pDestDoc, nullptr, pClipDoc, eFlags, false, false);
+    aCxt.setDestRange(rDestRange.aStart.Col(), rDestRange.aStart.Row(),
+            rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
+    aCxt.setTabRange(rDestRange.aStart.Tab(), rDestRange.aEnd.Tab());
+    pDestDoc->CopyOneCellFromClip(aCxt, rDestRange.aStart.Col(), rDestRange.aStart.Row(),
+            rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
+}
+
 ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc)
 {
     ScDocument& rDoc = rDocSh.GetDocument();
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index b66110c..cbc9981 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -47,6 +47,7 @@ public:
     static void clearSheet(ScDocument* pDoc, SCTAB nTab);
     static void copyToClip(ScDocument* pSrcDoc, const ScRange& rRange, ScDocument* pClipDoc);
     static void pasteFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc);
+    static void pasteOneCellFromClip(ScDocument* pDestDoc, const ScRange& rDestRange, ScDocument* pClipDoc, InsertDeleteFlags eFlags = InsertDeleteFlags::ALL);
     static ScUndoPaste* createUndoPaste(ScDocShell& rDocSh, const ScRange& rRange, ScDocument* pUndoDoc);
 
     /**
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 93ce111..66f9a12 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -317,7 +317,7 @@ void Test::testCondCopyPasteSingleCell()
     copyToClip(m_pDoc, ScRange(0,0,0,0,0,0), &aClipDoc);
 
     ScRange aTargetRange(4,4,0,4,4,0);
-    pasteFromClip(m_pDoc, aTargetRange, &aClipDoc);
+    pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
 
     ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(4,4,0);
     CPPUNIT_ASSERT(pPastedFormat);
@@ -349,9 +349,8 @@ void Test::testCondCopyPasteSingleCellToRange()
 
     ScDocument aClipDoc(SCDOCMODE_CLIP);
     copyToClip(m_pDoc, ScRange(0,0,0,0,0,0), &aClipDoc);
-
     ScRange aTargetRange(4,4,0,5,8,0);
-    pasteFromClip(m_pDoc, aTargetRange, &aClipDoc);
+    pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
 
     std::set<sal_uLong> aCondFormatIndices;
     for(SCROW nRow = 4; nRow <= 8; ++nRow)


More information about the Libreoffice-commits mailing list