From f0b0c7a23f2d36437d845b7f53defe25dfe8cef0 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 7 Sep 2014 13:19:14 +0200 Subject: add test for duplicated conditional formats Change-Id: If6d24cba87eebf6ddbb0d5392d653890ff99ef04 --- sc/qa/unit/ucalc.cxx | 22 ++++++++++++++++++++++ sc/qa/unit/ucalc.hxx | 2 ++ 2 files changed, 24 insertions(+) (limited to 'sc') diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f90c544f20ec..3f88cf5cf81d 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -7096,6 +7096,28 @@ void Test::testCondCopyPasteSingleCell() m_pDoc->DeleteTab(0); } +void Test::testCopySheetCondFormat() +{ + 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); + + ScDocument aDoc; + aDoc.TransferTab(m_pDoc, 0, 0, true); + + ScConditionalFormatList* pList = aDoc.GetCondFormList(0); + CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size()); + + 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 ec9542c4bc66..2bb3afbb0cfe 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -377,6 +377,7 @@ public: void testCondFormatInsertDeleteSheets(); void testCondCopyPaste(); void testCondCopyPasteSingleCell(); //e.g. fdo#82503 + void testCopySheetCondFormat(); void testIconSet(); void testImportStream(); @@ -558,6 +559,7 @@ public: CPPUNIT_TEST(testCondFormatInsertDeleteSheets); CPPUNIT_TEST(testCondCopyPaste); CPPUNIT_TEST(testCondCopyPasteSingleCell); + CPPUNIT_TEST(testCopySheetCondFormat); CPPUNIT_TEST(testIconSet); CPPUNIT_TEST(testImportStream); CPPUNIT_TEST(testDeleteContents); -- cgit