summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-09-26 22:28:20 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-09-27 00:22:32 +0200
commitc8a5f46b6121106d3efc0a4d45922bf910f6f94c (patch)
tree2439e5b34772acf3c4ce5140205fe833a57b4f24 /sc/qa
parentc55873f3e72a05cf94dabd7109c99e4b66c4f5a6 (diff)
OOPS, we were actually testing the wrong method
Change-Id: I29adf81d3da56d7150e5182025d931ee62598e63
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/ucalc.cxx13
-rw-r--r--sc/qa/unit/ucalc.hxx1
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx5
3 files changed, 16 insertions, 3 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 0db6a1c270be..f103f7d10306 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 b66110c7b7ff..cbc99810634f 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 93ce111cefd6..66f9a1254dc2 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)