Kaydet (Commit) 31719b05 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

initial test for databar length calculation

Change-Id: I6fb47b7987733e4047008430a62f77d58cc592ad
üst a8fc2868
......@@ -5879,6 +5879,53 @@ void Test::testIconSet()
m_pDoc->DeleteTab(0);
}
void Test::testDataBarLength()
{
m_pDoc->InsertTab(0, "Test");
ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
ScRangeList aRangeList(ScRange(0,0,0,0,7,0));
pFormat->SetRange(aRangeList);
ScDataBarFormat* pDatabar = new ScDataBarFormat(m_pDoc);
pFormat->AddEntry(pDatabar);
ScDataBarFormatData* pFormatData = new ScDataBarFormatData();
pFormatData->mpLowerLimit.reset(new ScColorScaleEntry());
pFormatData->mpLowerLimit->SetValue(3);
pFormatData->mpLowerLimit->SetType(COLORSCALE_VALUE);
pFormatData->mpUpperLimit.reset(new ScColorScaleEntry());
pFormatData->mpUpperLimit->SetValue(7);
pFormatData->mpUpperLimit->SetType(COLORSCALE_VALUE);
pDatabar->SetDataBarData(pFormatData);
struct {
double nVal; double nLength;
} aValues[] = {
{ 2, 0 },
{ 3, 0 },
{ 4, 25.0 },
{ 5, 50.0 },
{ 6, 75.0 },
{ 7, 100.0 },
{ 8, 100.0 }
};
for (size_t i = 0; i < SAL_N_ELEMENTS(aValues); ++i)
{
m_pDoc->SetValue(0, i, 0, aValues[i].nVal);
}
for (size_t i = 0; i < SAL_N_ELEMENTS(aValues); ++i)
{
ScDataBarInfo* pInfo = pDatabar->GetDataBarInfo(ScAddress(0, i, 0));
CPPUNIT_ASSERT(pInfo);
ASSERT_DOUBLES_EQUAL(aValues[i].nLength, pInfo->mnLength);
}
delete pFormat;
m_pDoc->DeleteTab(0);
}
void Test::testImportStream()
{
sc::AutoCalcSwitch aAC(*m_pDoc, true); // turn on auto calc.
......
......@@ -419,6 +419,7 @@ public:
void testCondCopyPasteSheetBetweenDoc();
void testCondCopyPasteSheet();
void testIconSet();
void testDataBarLength();
void testImportStream();
void testDeleteContents();
......@@ -631,6 +632,7 @@ public:
CPPUNIT_TEST(testCondCopyPasteSheetBetweenDoc);
CPPUNIT_TEST(testCondCopyPasteSheet);
CPPUNIT_TEST(testIconSet);
CPPUNIT_TEST(testDataBarLength);
CPPUNIT_TEST(testImportStream);
CPPUNIT_TEST(testDeleteContents);
CPPUNIT_TEST(testTransliterateText);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment