diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-09-07 19:16:13 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-09-09 14:33:35 +0200 |
commit | 8da96df8bfb225aa71a9c9fc6b11a63ec5a4dc28 (patch) | |
tree | fe0c3b1724a299d776c6ec6aa55c388f856f632f /sc | |
parent | 824ee35a3d4ed022ee1d7a181241934ab7b32993 (diff) |
add test for cond format copy&paste whole sheet
Conflicts:
sc/qa/unit/ucalc.cxx
sc/qa/unit/ucalc.hxx
Change-Id: I6e15bec2e1a2593b965df4c105758dc4bf22061f
Diffstat (limited to 'sc')
-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 73745e070c34..83866123996c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4968,6 +4968,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::testMixData() { m_pDoc->InsertTab(0, "Test"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index f2a2ba8f2b18..f6ede8277e6d 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -302,6 +302,7 @@ public: void testCondFormatInsertRow(); void testCondFormatInsertCol(); void testCondCopyPasteSheetBetweenDoc(); + void testCondCopyPasteSheet(); CPPUNIT_TEST_SUITE(Test); #if CALC_TEST_PERF @@ -414,6 +415,7 @@ public: CPPUNIT_TEST(testEditTextIterator); CPPUNIT_TEST(testCondFormatINSDEL); CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc); + CPPUNIT_TEST(testCondCopyPasteSheet); CPPUNIT_TEST_SUITE_END(); private: |