From c8a5f46b6121106d3efc0a4d45922bf910f6f94c Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Mon, 26 Sep 2016 22:28:20 +0200 Subject: OOPS, we were actually testing the wrong method Change-Id: I29adf81d3da56d7150e5182025d931ee62598e63 --- sc/qa/unit/ucalc.cxx | 13 +++++++++++++ sc/qa/unit/ucalc.hxx | 1 + sc/qa/unit/ucalc_condformat.cxx | 5 ++--- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'sc') 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 aCondFormatIndices; for(SCROW nRow = 4; nRow <= 8; ++nRow) -- cgit v1.2.3