diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-09-07 19:16:13 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-09-07 19:36:08 +0200 |
commit | eaca12bdc9c8cdeaf05fec53743456148bfd88f0 (patch) | |
tree | b72366738957d3cdf7a829d3c29f45545b6103f9 | |
parent | 14574226846ece3ccefbba14c55e1f15c0d5707c (diff) |
add test for cond format copy&paste whole sheet
Change-Id: I6e15bec2e1a2593b965df4c105758dc4bf22061f
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 33 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 |
2 files changed, 35 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d9fe623f598e..20117741c84c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -7118,6 +7118,39 @@ void Test::testCondCopyPasteSheetBetweenDoc() m_pDoc->DeleteTab(0); } +void Test::testCondCopyPasteSheet() +{ + 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); + m_pDoc->AddCondFormat(pFormat, 0); + + m_pDoc->CopyTab(0, SC_TAB_APPEND); + + ScConditionalFormatList* pList = m_pDoc->GetCondFormList(1); + CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size()); + + ScConditionalFormat& rFormat = *pList->begin(); + const ScRangeList& rRange = rFormat.GetRange(); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,1,3,3,1)), rRange); + sal_uInt32 nKey = rFormat.GetKey(); + const SfxPoolItem* pItem = m_pDoc->GetAttr( 2, 2, 1, ATTR_CONDITIONAL ); + const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); + + CPPUNIT_ASSERT(pCondFormatItem); + CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); + CPPUNIT_ASSERT( nKey == pCondFormatItem->GetCondFormatData().at(0) ); + + m_pDoc->DeleteTab(1); + m_pDoc->DeleteTab(0); +} + void Test::testIconSet() { m_pDoc->InsertTab(0, "Test"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index c207fd5ee396..3e48ff4600c6 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -378,6 +378,7 @@ public: void testCondCopyPaste(); void testCondCopyPasteSingleCell(); //e.g. fdo#82503 void testCondCopyPasteSheetBetweenDoc(); + void testCondCopyPasteSheet(); void testIconSet(); void testImportStream(); @@ -560,6 +561,7 @@ public: CPPUNIT_TEST(testCondCopyPaste); CPPUNIT_TEST(testCondCopyPasteSingleCell); CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc); + CPPUNIT_TEST(testCondCopyPasteSheet); CPPUNIT_TEST(testIconSet); CPPUNIT_TEST(testImportStream); CPPUNIT_TEST(testDeleteContents); |