summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-02 07:37:15 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-02 07:41:17 +0100
commita14cfd3d77104aee3e3c3d981a135161295197df (patch)
treeab5241cbf5592c4a18bd5b4bd38d0f9fbd3af42a
parent7c2936757ca10ccb692b05e6564783313f3576d1 (diff)
add test for fdo#72149
Change-Id: I303bbfe14c258f45985a6ed7a4130d1d0fe2dcd8
-rw-r--r--sc/qa/unit/ucalc.cxx35
-rw-r--r--sc/qa/unit/ucalc.hxx1
2 files changed, 36 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 809b4c6b7311..2fc7702ba3a0 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 1298e73e62a8..6538efca75b8 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