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

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Dec 1 20:41:53 PST 2013


 sc/qa/unit/ucalc.cxx           |   35 +++++++++++++++++++++++++++++++++++
 sc/qa/unit/ucalc.hxx           |    1 +
 sc/source/core/data/table2.cxx |    2 +-
 3 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit a14cfd3d77104aee3e3c3d981a135161295197df
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 2 07:37:15 2013 +0100

    add test for fdo#72149
    
    Change-Id: I303bbfe14c258f45985a6ed7a4130d1d0fe2dcd8

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 809b4c6..2fc7702 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4678,6 +4678,41 @@ void Test::testCondFormatInsertRow()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testCondCopyPaste()
+{
+    m_pDoc->InsertTab(0, "Test");
+
+    ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+    ScRange aCondFormatRange(0,0,0,3,3,0);
+    ScRangeList aRangeList(aCondFormatRange);
+    pFormat->AddRange(aRangeList);
+
+    ScCondFormatEntry* pEntry = new ScCondFormatEntry(SC_COND_DIRECT,"=B2","",m_pDoc,ScAddress(0,0,0),ScGlobal::GetRscString(STR_STYLENAME_RESULT));
+    pFormat->AddEntry(pEntry);
+    sal_uLong nIndex = m_pDoc->AddCondFormat(pFormat, 0);
+
+    ScDocument aClipDoc(SCDOCMODE_CLIP);
+    copyToClip(m_pDoc, aCondFormatRange, &aClipDoc);
+
+    ScRange aTargetRange(4,4,0,7,7,0);
+    pasteFromClip(m_pDoc, aTargetRange, &aClipDoc);
+
+    ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(7,7,0);
+    CPPUNIT_ASSERT(pPastedFormat);
+
+    CPPUNIT_ASSERT_EQUAL(ScRangeList(aTargetRange), pPastedFormat->GetRange());
+    CPPUNIT_ASSERT( nIndex != pPastedFormat->GetKey());
+    const SfxPoolItem* pItem = m_pDoc->GetAttr( 7, 7, 0, ATTR_CONDITIONAL );
+    const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem);
+
+    CPPUNIT_ASSERT(pCondFormatItem);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size());
+    CPPUNIT_ASSERT( nIndex != pCondFormatItem->GetCondFormatData().at(0) );
+
+
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testMixData()
 {
     m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 1298e73..6538efc 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -285,6 +285,7 @@ public:
     void testCondFormatINSDEL();
     void testCondFormatInsertRow();
     void testCondFormatInsertCol();
+    void testCondCopyPaste();
 
     CPPUNIT_TEST_SUITE(Test);
 #if CALC_TEST_PERF
commit 7c2936757ca10ccb692b05e6564783313f3576d1
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 2 06:05:19 2013 +0100

    we want to delete anytime that attribs are overwritten, fdo#72149
    
    Change-Id: I1ed50e6daf5b363c46e31d1a0efacf7728621b1a

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d7fca4f..30771ab 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -662,7 +662,7 @@ void ScTable::CopyFromClip(
         for ( SCCOL i = nCol1; i <= nCol2; i++)
             aCol[i].CopyFromClip(rCxt, nRow1, nRow2, nDy, pTable->aCol[i - nDx]); // notes are handles at column level
 
-        if (rCxt.getInsertFlag() == IDF_ATTRIB)
+        if (rCxt.getInsertFlag() & IDF_ATTRIB)
         {
             // make sure that there are no old references to the cond formats
             sal_uInt16 nWhichArray[2];


More information about the Libreoffice-commits mailing list