From d2d57d25aa71b71606c2112914831f25279fa279 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Sat, 21 Apr 2018 16:32:43 +0200 Subject: 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 eb5c0ccd47330fc726f4b4f854cf4cc518ac21cd Change-Id: Ieace78d1054efa6f49d42f1878774604e85c1965 Reviewed-on: https://gerrit.libreoffice.org/53259 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'vcl') diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index 2ee32a812d55..2f9274ddb7bc 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -62,9 +62,12 @@ void BitmapRenderTest::testTdf104141() BitmapEx aBitmap = aGraphic.GetBitmapEx(); 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 - 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 } @@ -84,9 +87,13 @@ void BitmapRenderTest::testTdf113918() BitmapEx aBitmap = aGraphic.GetBitmapEx(); 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(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); -- cgit