diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-04-29 12:30:04 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-05-01 02:31:57 +0200 |
commit | e9a9adf0bdc05bf2d80632a56db794c7fa12209e (patch) | |
tree | 01a5f85683a938868e03e82685d964b470678467 | |
parent | 03e771f268895a3c79138dd52556d51baaad86e0 (diff) |
add unit test for fdo#77984
Change-Id: Iab081d779a959c9ebe8a2721b146ebe0b3e97099
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 38 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 |
2 files changed, 40 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 48e25b6f79f9..70e7f7b6a6c5 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -46,6 +46,8 @@ #include "columniterator.hxx" #include "types.hxx" #include "conditio.hxx" +#include "colorscale.hxx" +#include "fillinfo.hxx" #include "globstr.hrc" #include "tokenarray.hxx" #include "scopetools.hxx" @@ -5728,6 +5730,42 @@ void Test::testCondCopyPaste() m_pDoc->DeleteTab(0); } +void Test::testIconSet() +{ + m_pDoc->InsertTab(0, "Test"); + ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0); + + ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc); + ScRangeList aRangeList(ScRange(0,0,0,0,0,0)); + pFormat->AddRange(aRangeList); + + ScIconSetFormat* pEntry = new ScIconSetFormat(m_pDoc); + ScIconSetFormatData* pData = new ScIconSetFormatData; + pData->maEntries.push_back(new ScColorScaleEntry(0, COL_BLUE)); + pData->maEntries.push_back(new ScColorScaleEntry(1, COL_GREEN)); + pData->maEntries.push_back(new ScColorScaleEntry(2, COL_RED)); + pEntry->SetIconSetData(pData); + + m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1); + pList->InsertNew(pFormat); + + struct { + double nVal; sal_Int32 nIndex; + } aTests[] = { + { -1.0, 0 }, + { 0.0, 0 }, + { 1.0, 1 }, + { 2.0, 2 }, + { 3.0, 2 } + }; + for(size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + { + m_pDoc->SetValue(0,0,0,aTests[i].nVal); + ScIconSetInfo* pInfo = pEntry->GetIconSetInfo(ScAddress(0,0,0)); + CPPUNIT_ASSERT_EQUAL(aTests[i].nIndex, pInfo->nIconIndex); + } +} + void Test::testImportStream() { sc::AutoCalcSwitch aAC(*m_pDoc, true); // turn on auto calc. diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 06bab38c01a1..c26a433160ec 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -341,6 +341,7 @@ public: void testCondFormatInsertRow(); void testCondFormatInsertCol(); void testCondCopyPaste(); + void testIconSet(); void testImportStream(); void testDeleteContents(); @@ -494,6 +495,7 @@ public: CPPUNIT_TEST(testCondFormatInsertRow); CPPUNIT_TEST(testCondFormatInsertCol); CPPUNIT_TEST(testCondCopyPaste); + CPPUNIT_TEST(testIconSet); CPPUNIT_TEST(testImportStream); CPPUNIT_TEST(testDeleteContents); CPPUNIT_TEST(testTransliterateText); |