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

Side by Side Diff: ui/gfx/image/image_unittest.cc

Issue 10946031: Modifies GetPlatformImageColor() to check the color of a given point. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix compile. Created 8 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/image/image_unittest_util.h » ('j') | ui/gfx/image/image_unittest_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/gfx/image/image.h" 6 #include "ui/gfx/image/image.h"
7 #include "ui/gfx/image/image_skia.h" 7 #include "ui/gfx/image/image_skia.h"
8 #include "ui/gfx/image/image_unittest_util.h" 8 #include "ui/gfx/image/image_unittest_util.h"
9 9
10 #if defined(TOOLKIT_GTK) 10 #if defined(TOOLKIT_GTK)
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 SkAutoLockPixels auto_lock(*bitmap); 173 SkAutoLockPixels auto_lock(*bitmap);
174 gt::CheckColor(bitmap->getColor(10, 10), true); 174 gt::CheckColor(bitmap->getColor(10, 10), true);
175 } 175 }
176 176
177 // TODO(rohitrao): This test needs an iOS implementation of 177 // TODO(rohitrao): This test needs an iOS implementation of
178 // GetPlatformImageColor(). 178 // GetPlatformImageColor().
179 #if !defined(OS_IOS) 179 #if !defined(OS_IOS)
180 TEST_F(ImageTest, PNGDecodeToPlatformFailure) { 180 TEST_F(ImageTest, PNGDecodeToPlatformFailure) {
181 std::vector<unsigned char> png(100, 0); 181 std::vector<unsigned char> png(100, 0);
182 gfx::Image image(&png.front(), png.size()); 182 gfx::Image image(&png.front(), png.size());
183 gt::CheckColor(gt::GetPlatformImageColor(gt::ToPlatformType(image)), true); 183 gt::CheckColor(gt::GetPlatformImageColor(gt::ToPlatformType(image), 10, 10),
184 true);
184 } 185 }
185 #endif 186 #endif
186 187
187 TEST_F(ImageTest, SkiaToPlatform) { 188 TEST_F(ImageTest, SkiaToPlatform) {
188 gfx::Image image(gt::CreateBitmap(25, 25)); 189 gfx::Image image(gt::CreateBitmap(25, 25));
189 const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U; 190 const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U;
190 191
191 EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepSkia)); 192 EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepSkia));
192 if (!kUsesSkiaNatively) 193 if (!kUsesSkiaNatively)
193 EXPECT_FALSE(image.HasRepresentation(gt::GetPlatformRepresentationType())); 194 EXPECT_FALSE(image.HasRepresentation(gt::GetPlatformRepresentationType()));
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 image = gfx::Image(gfx::ImageSkiaRep(bitmap, ui::SCALE_FACTOR_100P)); 418 image = gfx::Image(gfx::ImageSkiaRep(bitmap, ui::SCALE_FACTOR_100P));
418 } 419 }
419 EXPECT_TRUE(!image.ToSkBitmap()->isNull()); 420 EXPECT_TRUE(!image.ToSkBitmap()->isNull());
420 } 421 }
421 422
422 // Integration tests with UI toolkit frameworks require linking against the 423 // Integration tests with UI toolkit frameworks require linking against the
423 // Views library and cannot be here (ui_unittests doesn't include it). They 424 // Views library and cannot be here (ui_unittests doesn't include it). They
424 // instead live in /chrome/browser/ui/tests/ui_gfx_image_unittest.cc. 425 // instead live in /chrome/browser/ui/tests/ui_gfx_image_unittest.cc.
425 426
426 } // namespace 427 } // namespace
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/image/image_unittest_util.h » ('j') | ui/gfx/image/image_unittest_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698