add test for fdo#72149

Change-Id: I303bbfe14c258f45985a6ed7a4130d1d0fe2dcd8
This commit is contained in:
Markus Mohrhard
2013-12-02 07:37:15 +01:00
parent 7c2936757c
commit a14cfd3d77
2 changed files with 36 additions and 0 deletions

View File

@@ -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");

View File

@@ -285,6 +285,7 @@ public:
void testCondFormatINSDEL();
void testCondFormatInsertRow();
void testCondFormatInsertCol();
void testCondCopyPaste();
CPPUNIT_TEST_SUITE(Test);
#if CALC_TEST_PERF