Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: ui/gfx/image/image_unittest.cc

Issue 10823012: Fix the errors of ui unittests caused by packing colors for Android (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/skbitmap_operations_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_unittest.cc
diff --git a/ui/gfx/image/image_unittest.cc b/ui/gfx/image/image_unittest.cc
index 93a8b612c0095ca24acd5d2ee1b84614532986ad..51d5b664735c1d542323fafeebaf0a14e14773f8 100644
--- a/ui/gfx/image/image_unittest.cc
+++ b/ui/gfx/image/image_unittest.cc
@@ -194,13 +194,19 @@ TEST_F(ImageTest, SkiaToCocoaCopy) {
}
#endif
+inline uint32_t SetPackedColor(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
+ return (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) |
+ (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT);
+}
+#define ColorRed SetPackedColor(0xFF, 0xFF, 0x00, 0x00)
Robert Sesek 2012/07/25 15:36:53 Since you only use this once, is there a point to
yongsheng 2012/07/26 01:24:18 ok, got it. thanks.
+
TEST_F(ImageTest, CheckSkiaColor) {
gfx::Image image(gt::CreatePlatformImage());
const SkBitmap* bitmap = image.ToSkBitmap();
SkAutoLockPixels auto_lock(*bitmap);
uint32_t* pixel = bitmap->getAddr32(10, 10);
- EXPECT_EQ(SK_ColorRED, *pixel);
+ EXPECT_EQ(ColorRed, *pixel);
}
TEST_F(ImageTest, SwapRepresentations) {
« no previous file with comments | « no previous file | ui/gfx/skbitmap_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698