diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 17:41:48 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 17:41:48 +0000 |
commit | 3acdf835f850997396ef30c61688a9a2f55fb594 (patch) | |
tree | 78c28d802849b39a08ca07bb3e7db0f13a6ff37f /skia | |
parent | d017adbbbfcedc1d927aa0737476ed3c601446bb (diff) | |
download | chromium_src-3acdf835f850997396ef30c61688a9a2f55fb594.zip chromium_src-3acdf835f850997396ef30c61688a9a2f55fb594.tar.gz chromium_src-3acdf835f850997396ef30c61688a9a2f55fb594.tar.bz2 |
Mac: Fix color space usage in SkiaUtilsMacTest
BUG=47885
TEST=test passes on 10.6
Review URL: http://codereview.chromium.org/2873041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51735 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/skia_utils_mac_unittest.mm | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/skia/ext/skia_utils_mac_unittest.mm b/skia/ext/skia_utils_mac_unittest.mm index c29a249..1726c4a 100644 --- a/skia/ext/skia_utils_mac_unittest.mm +++ b/skia/ext/skia_utils_mac_unittest.mm @@ -42,18 +42,24 @@ void SkiaUtilsMacTest::ShapeHelper(int width, int height, NSColor* color = NSReadPixel(NSMakePoint(x, y)); CGFloat red = 0, green = 0, blue = 0, alpha = 0; [image unlockFocus]; + + // SkBitmapToNSImage returns a bitmap in the calibrated color space (sRGB), + // while NSReadPixel returns a color in the device color space. Convert back + // to the calibrated color space before testing. + color = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + [color getRed:&red green:&green blue:&blue alpha:&alpha]; - // Be tolerant of floating point rounding, gamma, etc. + // Be tolerant of floating point rounding and lossy color space conversions. if (isred) { - EXPECT_GT(red, 0.8); - EXPECT_LT(blue, 0.2); + EXPECT_GT(red, 0.95); + EXPECT_LT(blue, 0.05); } else { - EXPECT_LT(red, 0.2); - EXPECT_GT(blue, 0.8); + EXPECT_LT(red, 0.05); + EXPECT_GT(blue, 0.95); } - EXPECT_LT(green, 0.2); - EXPECT_GT(alpha, 0.9); + EXPECT_LT(green, 0.05); + EXPECT_GT(alpha, 0.95); } TEST_F(SkiaUtilsMacTest, BitmapToNSImage_RedSquare64x64) { |