Kaydet (Commit) d2d57d25 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Tweak unit test for 1bpp images a bit for robustness

Seems we're suffering gamma correction issue on a number of target
platforms, so let's compare colors a bit more fuzzily.

Fixup for eb5c0ccd

Change-Id: Ieace78d1054efa6f49d42f1878774604e85c1965
Reviewed-on: https://gerrit.libreoffice.org/53259Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 6a3d2dea
...@@ -62,9 +62,12 @@ void BitmapRenderTest::testTdf104141() ...@@ -62,9 +62,12 @@ void BitmapRenderTest::testTdf104141()
BitmapEx aBitmap = aGraphic.GetBitmapEx(); BitmapEx aBitmap = aGraphic.GetBitmapEx();
pVDev->DrawBitmapEx(Point(20, 20), aBitmap); pVDev->DrawBitmapEx(Point(20, 20), aBitmap);
// Check drawing resuts: ensure that it contains transparent (green) pixels // Check drawing resuts: ensure that it contains transparent
// (greenish) pixels
#if !defined MACOSX //TODO: on Mac colors are drifted, so exact compare fails #if !defined MACOSX //TODO: on Mac colors are drifted, so exact compare fails
CPPUNIT_ASSERT_EQUAL(COL_GREEN, pVDev->GetPixel(Point(21, 21))); const Color aColor = pVDev->GetPixel(Point(21, 21));
CPPUNIT_ASSERT(aColor.GetGreen() > 10 * aColor.GetRed()
&& aColor.GetGreen() > 10 * aColor.GetBlue());
#endif #endif
} }
...@@ -84,9 +87,13 @@ void BitmapRenderTest::testTdf113918() ...@@ -84,9 +87,13 @@ void BitmapRenderTest::testTdf113918()
BitmapEx aBitmap = aGraphic.GetBitmapEx(); BitmapEx aBitmap = aGraphic.GetBitmapEx();
pVDev->DrawBitmapEx(Point(0, 0), aBitmap); pVDev->DrawBitmapEx(Point(0, 0), aBitmap);
// Ensure that image is drawn with gray color from palette // Ensure that image is drawn with white background color from palette
CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(21, 21))); CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(21, 21)));
CPPUNIT_ASSERT_EQUAL(Color(0x979797), pVDev->GetPixel(Point(1298, 1368)));
// Ensure that image is drawn with gray text color from palette
const Color aColor = pVDev->GetPixel(Point(1298, 1368));
CPPUNIT_ASSERT(aColor.GetGreen() == aColor.GetRed() && aColor.GetGreen() == aColor.GetBlue());
CPPUNIT_ASSERT(aColor.GetGreen() > 100);
} }
CPPUNIT_TEST_SUITE_REGISTRATION(BitmapRenderTest); CPPUNIT_TEST_SUITE_REGISTRATION(BitmapRenderTest);
......
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