tdf#141908 Replace usage of sal_Int32 with Color in unit tests

Change-Id: Ifb5ff2e6d5ed28bcb9e190d7f2deaaa970693cbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138938
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
cutamar 2022-08-28 02:42:21 +02:00 committed by Stephan Bergmann
parent 4343432d42
commit 45394fcf7e
7 changed files with 16 additions and 21 deletions

View file

@ -1034,8 +1034,8 @@ void SdOOXMLExportTest2::testTdf105739()
com::sun::star::awt::Gradient aFillGradient;
aXBackgroundPropSet->getPropertyValue("FillGradient") >>= aFillGradient;
CPPUNIT_ASSERT_EQUAL(int(awt::GradientStyle_LINEAR), static_cast<int>(aFillGradient.Style));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), aFillGradient.StartColor);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00b050), aFillGradient.EndColor);
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(ColorTransparency, aFillGradient.StartColor));
CPPUNIT_ASSERT_EQUAL(Color(0x00b050), Color(ColorTransparency, aFillGradient.EndColor));
}
xShell->DoClose();

View file

@ -1531,8 +1531,8 @@ void SdOOXMLExportTest3::testTdf127372()
uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
awt::Gradient aTransparenceGradient;
xShape->getPropertyValue("FillTransparenceGradient") >>= aTransparenceGradient;
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aTransparenceGradient.StartColor);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aTransparenceGradient.EndColor);
CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aTransparenceGradient.StartColor));
CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aTransparenceGradient.EndColor));
}
void SdOOXMLExportTest3::testTdf127379()
@ -1558,8 +1558,8 @@ void SdOOXMLExportTest3::testTdf127379()
awt::Gradient aGradient;
CPPUNIT_ASSERT(aXBackgroundPropSet->getPropertyValue("FillGradient") >>= aGradient);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFF0000), aGradient.StartColor);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x2A6099), aGradient.EndColor);
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(ColorTransparency, aGradient.StartColor));
CPPUNIT_ASSERT_EQUAL(Color(0x2A6099), Color(ColorTransparency, aGradient.EndColor));
}
void SdOOXMLExportTest3::testTdf98603()

View file

@ -81,9 +81,9 @@ void TestParsing::testSimpleRectangle()
CPPUNIT_ASSERT_EQUAL(basegfx::B2DRange(10, 10, 110, 110), pDrawRect->maRectangle);
CPPUNIT_ASSERT_EQUAL(3.0, pDrawRect->mnStrokeWidth);
CPPUNIT_ASSERT(bool(pDrawRect->mpStrokeColor));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff0000), sal_Int32(Color(*pDrawRect->mpStrokeColor)));
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(*pDrawRect->mpStrokeColor));
CPPUNIT_ASSERT(bool(pDrawRect->mpFillColor));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00cc00), sal_Int32(Color(*pDrawRect->mpFillColor)));
CPPUNIT_ASSERT_EQUAL(Color(0x00cc00), Color(*pDrawRect->mpFillColor));
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.1, pDrawRect->mnOpacity, 1E-12);
}
@ -113,9 +113,9 @@ void TestParsing::testPath()
basegfx::utils::exportToSvgD(pDrawPath->maPolyPolygon, true, true, false));
CPPUNIT_ASSERT_EQUAL(0.0, pDrawPath->mnStrokeWidth);
CPPUNIT_ASSERT(bool(pDrawPath->mpStrokeColor));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), sal_Int32(Color(*pDrawPath->mpStrokeColor)));
CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(*pDrawPath->mpStrokeColor));
CPPUNIT_ASSERT(bool(pDrawPath->mpFillColor));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x007aff), sal_Int32(Color(*pDrawPath->mpFillColor)));
CPPUNIT_ASSERT_EQUAL(Color(0x007aff), Color(*pDrawPath->mpFillColor));
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.1, pDrawPath->mnOpacity, 1E-12);
}

View file

@ -343,9 +343,7 @@ void VclDrawModeTest::testDrawModeBitmapEx()
Bitmap::ScopedReadAccess pReadAccess(aResultBitmap);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x26), sal_Int32(rColor.GetRed()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x26), sal_Int32(rColor.GetGreen()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x26), sal_Int32(rColor.GetBlue()));
CPPUNIT_ASSERT_EQUAL(BitmapColor(0x26, 0x26, 0x26), rColor);
}
// any other operation other than DrawModeFlags::GrayBitmap is a noop
@ -355,9 +353,7 @@ void VclDrawModeTest::testDrawModeBitmapEx()
Bitmap::ScopedReadAccess pReadAccess(aResultBitmap);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x80), sal_Int32(rColor.GetRed()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00), sal_Int32(rColor.GetGreen()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00), sal_Int32(rColor.GetBlue()));
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_RED), rColor);
}
}

View file

@ -452,9 +452,7 @@ void VclOutdevTest::testDrawGrayBitmap()
{
Bitmap::ScopedReadAccess pReadAccess(aVDevBmp);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x26), sal_Int32(rColor.GetRed()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x26), sal_Int32(rColor.GetGreen()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x26), sal_Int32(rColor.GetBlue()));
CPPUNIT_ASSERT_EQUAL(BitmapColor(0x26, 0x26, 0x26), rColor);
}
}

View file

@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,writerperfect_import,\
cppu \
sal \
test \
tl \
unotest \
utl \
wpftqahelper \

View file

@ -83,9 +83,9 @@ void ImportTest::testWK3WithFM3()
CPPUNIT_ASSERT(xSheet.is());
uno::Reference<beans::XPropertySet> xCellProps(xSheet->getCellByPosition(1, 1), UNO_QUERY);
CPPUNIT_ASSERT(xCellProps.is());
sal_Int32 nCharColor = 0;
Color nCharColor;
CPPUNIT_ASSERT(xCellProps->getPropertyValue("CharColor") >>= nCharColor);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x0000ff), nCharColor); // blue text
CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, nCharColor); // blue text
}
WpftLoader ImportTest::createCalcLoader(std::u16string_view rFile) const