summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-26 17:13:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-28 07:34:27 +0100
commite2cb154195fdc2ffccdb6f5e87cae8b29640b3eb (patch)
tree7c3d53d78e0867aa879b98d84211d1e73602520f /sc/qa
parent0ea41fea75cd1ac1d81fa57c4411e75a6b4001f0 (diff)
convert COL_ constants to be of type Color
Change-Id: I0e25c8950ac26b851ff42f71e1471fcbe4770d48 Reviewed-on: https://gerrit.libreoffice.org/50373 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/new_cond_format.cxx16
-rw-r--r--sc/qa/unit/helper/qahelper.cxx6
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx4
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx28
4 files changed, 30 insertions, 24 deletions
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index ee0a0e60e6b1..b6587e6059e7 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -23,6 +23,12 @@
using namespace css;
+inline std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
+{
+ rStrm << "Color: R:" << static_cast<int>(rColor.GetRed()) << " G:" << static_cast<int>(rColor.GetGreen()) << " B: " << static_cast<int>(rColor.GetBlue());
+ return rStrm;
+}
+
namespace sc_apitest {
class ScConditionalFormatTest : public CalcUnoApiTest
@@ -350,10 +356,10 @@ void ScConditionalFormatTest::testDataBarProperties()
namespace {
void testColorScaleEntry(uno::Reference<sheet::XColorScaleEntry> const & xEntry,
- sal_Int32 nType, const OUString& rString, sal_uInt32 nColor)
+ sal_Int32 nType, const OUString& rString, Color nColor)
{
CPPUNIT_ASSERT_EQUAL(nType, xEntry->getType());
- CPPUNIT_ASSERT_EQUAL(nColor, sal_uInt32(xEntry->getColor()));
+ CPPUNIT_ASSERT_EQUAL(nColor, Color(xEntry->getColor()));
switch (nType)
{
case sheet::ColorScaleEntryType::COLORSCALE_VALUE:
@@ -370,9 +376,9 @@ void testColorScaleEntry(uno::Reference<sheet::XColorScaleEntry> const & xEntry,
}
void testColorScaleEntries(uno::Reference<beans::XPropertySet> const & xPropSet, sal_Int32 nEntries,
- sal_Int32 nMinType, const OUString& rMinString, sal_uInt32 nMinColor,
- sal_Int32 nMediumType, const OUString& rMediumString, sal_uInt32 nMediumColor,
- sal_Int32 nMaxType, const OUString& rMaxString, sal_uInt32 nMaxColor)
+ sal_Int32 nMinType, const OUString& rMinString, Color nMinColor,
+ sal_Int32 nMediumType, const OUString& rMediumString, Color nMediumColor,
+ sal_Int32 nMaxType, const OUString& rMaxString, Color nMaxColor)
{
uno::Any aAny = xPropSet->getPropertyValue("ColorScaleEntries");
CPPUNIT_ASSERT(aAny.hasValue());
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 90f37a89db56..f99d23df203e 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -179,7 +179,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
vcl::Font aFont;
pPattern->GetFont(aFont,SC_AUTOCOL_RAW);
CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", 200l, aFont.GetFontSize().getHeight());
- CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, aFont.GetColor().GetColor());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, aFont.GetColor());
pPattern = pDoc->GetPattern(0,1,1);
pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 12", 240l, aFont.GetFontSize().getHeight());
@@ -191,7 +191,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight());
pPattern = pDoc->GetPattern(1,0,1);
pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aFont.GetColor().GetColor());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aFont.GetColor());
pPattern = pDoc->GetPattern(1,1,1);
pPattern->GetFont(aFont, SC_AUTOCOL_RAW);
CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be striked out with a single line", STRIKEOUT_SINGLE, aFont.GetStrikeout());
@@ -224,7 +224,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
}
pPattern = pDoc->GetPattern(1,4,1);
Color aColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor();
- CPPUNIT_ASSERT_EQUAL_MESSAGE("background color should be green", Color(COL_LIGHTGREEN), aColor);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("background color should be green", COL_LIGHTGREEN, aColor);
pPattern = pDoc->GetPattern(2,0,1);
SvxCellHorJustify eHorJustify = pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue();
CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned centre horizontally", SvxCellHorJustify::Center, eHorJustify);
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 8899e6861811..47ed37c4ee76 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -1178,7 +1178,7 @@ void ScExportTest::testMiscRowHeightExport()
namespace {
-void setAttribute( ScFieldEditEngine& rEE, sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt16 nType, sal_uInt32 nColor = COL_BLACK )
+void setAttribute( ScFieldEditEngine& rEE, sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt16 nType, Color nColor = COL_BLACK )
{
ESelection aSel;
aSel.nStartPara = aSel.nEndPara = nPara;
@@ -1438,7 +1438,7 @@ void ScExportTest::testRichTextExportODS()
return false;
}
- static bool isColor(const editeng::Section& rAttr, sal_uInt32 nColor)
+ static bool isColor(const editeng::Section& rAttr, Color nColor)
{
if (rAttr.maAttributes.empty())
return false;
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 38a3950df7fc..be17f2ad3f50 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -989,7 +989,7 @@ void ScFiltersTest::testBorderODS()
CPPUNIT_ASSERT(pRight);
CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pRight->GetBorderLineStyle());
CPPUNIT_ASSERT_EQUAL(5L, pRight->GetWidth());
- CPPUNIT_ASSERT_EQUAL(Color(COL_BLUE), pRight->GetColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLUE, pRight->GetColor());
xDocSh->DoClose();
}
@@ -2179,7 +2179,7 @@ void ScFiltersTest::testCondFormatThemeColorXLSX()
CPPUNIT_ASSERT_EQUAL(Color(157, 195, 230), pDataBarFormatData->maPositiveColor);
CPPUNIT_ASSERT(pDataBarFormatData->mpNegativeColor.get());
- CPPUNIT_ASSERT_EQUAL(Color(COL_LIGHTRED), *pDataBarFormatData->mpNegativeColor.get());
+ CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, *pDataBarFormatData->mpNegativeColor.get());
CPPUNIT_ASSERT_EQUAL(size_t(1), rDoc.GetCondFormList(1)->size());
pFormat = rDoc.GetCondFormat(0, 0, 1);
@@ -3563,17 +3563,17 @@ void ScFiltersTest::testBackgroundColorStandardXLSXML()
const std::vector<Check> aChecks =
{
- { OUString("Background Color"), Color(COL_BLACK), Color(COL_TRANSPARENT) },
- { OUString("Dark Red"), Color(COL_WHITE), Color(192, 0, 0) },
- { OUString("Red"), Color(COL_WHITE), Color(255, 0, 0) },
- { OUString("Orange"), Color(COL_WHITE), Color(255, 192, 0) },
- { OUString("Yellow"), Color(COL_WHITE), Color(255, 255, 0) },
- { OUString("Light Green"), Color(COL_WHITE), Color(146, 208, 80) },
- { OUString("Green"), Color(COL_WHITE), Color( 0, 176, 80) },
- { OUString("Light Blue"), Color(COL_WHITE), Color( 0, 176, 240) },
- { OUString("Blue"), Color(COL_WHITE), Color( 0, 112, 192) },
- { OUString("Dark Blue"), Color(COL_WHITE), Color( 0, 32, 96) },
- { OUString("Purple"), Color(COL_WHITE), Color(112, 48, 160) },
+ { OUString("Background Color"), COL_BLACK, COL_TRANSPARENT },
+ { OUString("Dark Red"), COL_WHITE, Color(192, 0, 0) },
+ { OUString("Red"), COL_WHITE, Color(255, 0, 0) },
+ { OUString("Orange"), COL_WHITE, Color(255, 192, 0) },
+ { OUString("Yellow"), COL_WHITE, Color(255, 255, 0) },
+ { OUString("Light Green"), COL_WHITE, Color(146, 208, 80) },
+ { OUString("Green"), COL_WHITE, Color( 0, 176, 80) },
+ { OUString("Light Blue"), COL_WHITE, Color( 0, 176, 240) },
+ { OUString("Blue"), COL_WHITE, Color( 0, 112, 192) },
+ { OUString("Dark Blue"), COL_WHITE, Color( 0, 32, 96) },
+ { OUString("Purple"), COL_WHITE, Color(112, 48, 160) },
};
for (size_t nRow = 0; nRow < aChecks.size(); ++nRow)
@@ -3728,7 +3728,7 @@ void ScFiltersTest::testBorderDirectionsXLSXML()
return false;
}
- if (Color(COL_BLACK) != pLine->GetColor())
+ if (COL_BLACK != pLine->GetColor())
{
std::cout << "Border color was expected to be black, but is not." << std::endl;
return false;