[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Fri Mar 17 02:32:08 UTC 2017
sc/qa/unit/ucalc.hxx | 2 ++
sc/qa/unit/ucalc_condformat.cxx | 33 +++++++++++++++++++++++++++++++++
sc/source/core/data/table7.cxx | 4 ++--
3 files changed, 37 insertions(+), 2 deletions(-)
New commits:
commit 36d7e21c00d59eead018ad8ef339847a782b9734
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Mar 16 21:35:05 2017 +0100
add test for tdf#106242
Change-Id: I11f67c118617c78fa86b87afed87fcddba4e69e1
Reviewed-on: https://gerrit.libreoffice.org/35295
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index c48a25f126af..fb2390c1f5da 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -468,6 +468,7 @@ public:
void testCondCopyPaste();
void testCondCopyPasteSingleCell(); //e.g. fdo#82503
void testCondCopyPasteSingleCellToRange(); //e.g. fdo#82503
+ void testCondCopyPasteSingleRowToRange(); //e.g. tdf#106242
void testCondCopyPasteSheetBetweenDoc();
void testCondCopyPasteSheet();
void testIconSet();
@@ -745,6 +746,7 @@ public:
CPPUNIT_TEST(testCondCopyPaste);
CPPUNIT_TEST(testCondCopyPasteSingleCell);
CPPUNIT_TEST(testCondCopyPasteSingleCellToRange);
+ CPPUNIT_TEST(testCondCopyPasteSingleRowToRange);
CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc);
CPPUNIT_TEST(testCondCopyPasteSheet);
CPPUNIT_TEST(testCondFormatEndsWithStr);
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index ee0d8abee066..0b0a8a2af97b 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -378,6 +378,39 @@ void Test::testCondCopyPasteSingleCellToRange()
m_pDoc->DeleteTab(0);
}
+void Test::testCondCopyPasteSingleRowToRange()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+ ScRange aCondFormatRange(0,0,0,0,0,0);
+ ScRangeList aRangeList(aCondFormatRange);
+ pFormat->SetRange(aRangeList);
+
+ ScCondFormatEntry* pEntry = new ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT));
+ pFormat->AddEntry(pEntry);
+ m_pDoc->AddCondFormat(pFormat, 0);
+
+ ScDocument aClipDoc(SCDOCMODE_CLIP);
+ copyToClip(m_pDoc, ScRange(0,0,0,MAXCOL,0,0), &aClipDoc);
+ ScRange aTargetRange(0,4,0,MAXCOL,4,0);
+ pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
+
+ std::set<sal_uLong> aCondFormatIndices;
+
+ ScConditionalFormat* pNewFormat = m_pDoc->GetCondFormat(0, 4, 0);
+ CPPUNIT_ASSERT(pNewFormat);
+ CPPUNIT_ASSERT(pNewFormat->GetKey() != pFormat->GetKey());
+
+ for (SCCOL nCol = 1; nCol <= MAXCOL; ++nCol)
+ {
+ ScConditionalFormat* pNewFormat2 = m_pDoc->GetCondFormat(nCol, 4, 0);
+ CPPUNIT_ASSERT(!pNewFormat2);
+ }
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testCondCopyPasteSheetBetweenDoc()
{
m_pDoc->InsertTab(0, "Test");
commit d4bdac90c3b12d1de74b99786f2e830ee2ae18dc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Mar 16 21:46:57 2017 +0100
CopyOneCellFromClip also copies one row ranges, tdf#106242
Change-Id: I1750d411766ba2b4128fc1c00769a8b2e56e7547
Reviewed-on: https://gerrit.libreoffice.org/35294
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index a84942912aa5..72595dae9b77 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -65,10 +65,10 @@ void ScTable::CopyOneCellFromClip(
assert(nColOffset >= 0);
aCol[nCol].CopyOneCellFromClip(rCxt, nRow1, nRow2, nColOffset);
- if (rCxt.getInsertFlag() & InsertDeleteFlags::ATTRIB)
+ if ((rCxt.getInsertFlag() & InsertDeleteFlags::ATTRIB) && (nColOffset == 0))
{
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
- CopyConditionalFormat(nCol, nRow, nCol, nRow, nCol - aSrcRange.aStart.Col(),
+ CopyConditionalFormat(nCol, nRow, nCol + nSrcColSize - 1, nRow, nCol - aSrcRange.aStart.Col(),
nRow - nSrcRow, pSrcTab);
}
}
More information about the Libreoffice-commits
mailing list