summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2018-04-21 16:32:43 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-04-21 19:37:42 +0200
commitd2d57d25aa71b71606c2112914831f25279fa279 (patch)
tree176e89b2485b467f1a08b4538ebdc8c53aa13160 /vcl
parent6a3d2dea1da847f5bd6674b344162f087cceda8b (diff)
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 <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx15
1 files changed, 11 insertions, 4 deletions
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);