diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 14:44:31 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 14:44:31 +0000 |
commit | 2a4f026f209e6e6509a982796621a9d1f713907e (patch) | |
tree | 32c2f5cdd6c84e5ba61b5b469c62ffd52d9e18d7 /ui/gfx/image_unittest.cc | |
parent | 3bb0702483dc98b3324f7645777b986911e8289b (diff) | |
download | chromium_src-2a4f026f209e6e6509a982796621a9d1f713907e.zip chromium_src-2a4f026f209e6e6509a982796621a9d1f713907e.tar.gz chromium_src-2a4f026f209e6e6509a982796621a9d1f713907e.tar.bz2 |
C++ readability review for Robert Sesek <rsesek@google.com>.
R=smo
OCL=http://codereview.chromium.org/6312159/
BUG=http://b/3477621
TEST=none
Review URL: http://codereview.chromium.org/6538096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/image_unittest.cc')
-rw-r--r-- | ui/gfx/image_unittest.cc | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/ui/gfx/image_unittest.cc b/ui/gfx/image_unittest.cc index 37bfa98..6f41bfe 100644 --- a/ui/gfx/image_unittest.cc +++ b/ui/gfx/image_unittest.cc @@ -2,11 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/gfx/image.h" - #include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image.h" #include "ui/gfx/image_unittest.h" #if defined(OS_LINUX) @@ -19,8 +18,6 @@ namespace { -using namespace gfx::test; - #if defined(TOOLKIT_VIEWS) const bool kUsesSkiaNatively = true; #else @@ -34,8 +31,10 @@ class ImageTest : public testing::Test { } }; +namespace gt = gfx::test; + TEST_F(ImageTest, SkiaToSkia) { - gfx::Image image(CreateBitmap()); + gfx::Image image(gt::CreateBitmap()); const SkBitmap* bitmap = static_cast<const SkBitmap*>(image); EXPECT_TRUE(bitmap); EXPECT_FALSE(bitmap->isNull()); @@ -49,11 +48,11 @@ TEST_F(ImageTest, SkiaToSkia) { EXPECT_TRUE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); if (!kUsesSkiaNatively) - EXPECT_FALSE(image.HasRepresentation(GetPlatformRepresentationType())); + EXPECT_FALSE(image.HasRepresentation(gt::GetPlatformRepresentationType())); } TEST_F(ImageTest, SkiaToSkiaRef) { - gfx::Image image(CreateBitmap()); + gfx::Image image(gt::CreateBitmap()); const SkBitmap& bitmap = static_cast<const SkBitmap&>(image); EXPECT_FALSE(bitmap.isNull()); @@ -65,18 +64,18 @@ TEST_F(ImageTest, SkiaToSkiaRef) { EXPECT_TRUE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); if (!kUsesSkiaNatively) - EXPECT_FALSE(image.HasRepresentation(GetPlatformRepresentationType())); + EXPECT_FALSE(image.HasRepresentation(gt::GetPlatformRepresentationType())); } TEST_F(ImageTest, SkiaToPlatform) { - gfx::Image image(CreateBitmap()); + gfx::Image image(gt::CreateBitmap()); const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U; EXPECT_TRUE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); if (!kUsesSkiaNatively) - EXPECT_FALSE(image.HasRepresentation(GetPlatformRepresentationType())); + EXPECT_FALSE(image.HasRepresentation(gt::GetPlatformRepresentationType())); - EXPECT_TRUE(static_cast<PlatformImage>(image)); + EXPECT_TRUE(static_cast<gt::PlatformImage>(image)); EXPECT_EQ(kRepCount, GetRepCount(image)); const SkBitmap& bitmap = static_cast<const SkBitmap&>(image); @@ -84,14 +83,14 @@ TEST_F(ImageTest, SkiaToPlatform) { EXPECT_EQ(kRepCount, GetRepCount(image)); EXPECT_TRUE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); - EXPECT_TRUE(image.HasRepresentation(GetPlatformRepresentationType())); + EXPECT_TRUE(image.HasRepresentation(gt::GetPlatformRepresentationType())); } TEST_F(ImageTest, PlatformToSkia) { - gfx::Image image(CreatePlatformImage()); + gfx::Image image(gt::CreatePlatformImage()); const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U; - EXPECT_TRUE(image.HasRepresentation(GetPlatformRepresentationType())); + EXPECT_TRUE(image.HasRepresentation(gt::GetPlatformRepresentationType())); if (!kUsesSkiaNatively) EXPECT_FALSE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); @@ -100,28 +99,28 @@ TEST_F(ImageTest, PlatformToSkia) { EXPECT_FALSE(bitmap->isNull()); EXPECT_EQ(kRepCount, GetRepCount(image)); - EXPECT_TRUE(static_cast<PlatformImage>(image)); + EXPECT_TRUE(static_cast<gt::PlatformImage>(image)); EXPECT_EQ(kRepCount, GetRepCount(image)); EXPECT_TRUE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); } TEST_F(ImageTest, PlatformToPlatform) { - gfx::Image image(CreatePlatformImage()); - EXPECT_TRUE(static_cast<PlatformImage>(image)); + gfx::Image image(gt::CreatePlatformImage()); + EXPECT_TRUE(static_cast<gt::PlatformImage>(image)); EXPECT_EQ(1U, GetRepCount(image)); // Make sure double conversion doesn't happen. - EXPECT_TRUE(static_cast<PlatformImage>(image)); + EXPECT_TRUE(static_cast<gt::PlatformImage>(image)); EXPECT_EQ(1U, GetRepCount(image)); - EXPECT_TRUE(image.HasRepresentation(GetPlatformRepresentationType())); + EXPECT_TRUE(image.HasRepresentation(gt::GetPlatformRepresentationType())); if (!kUsesSkiaNatively) EXPECT_FALSE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); } TEST_F(ImageTest, CheckSkiaColor) { - gfx::Image image(CreatePlatformImage()); + gfx::Image image(gt::CreatePlatformImage()); const SkBitmap& bitmap(image); SkAutoLockPixels auto_lock(bitmap); @@ -132,19 +131,19 @@ TEST_F(ImageTest, CheckSkiaColor) { TEST_F(ImageTest, SwapRepresentations) { const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U; - gfx::Image image1(CreateBitmap()); + gfx::Image image1(gt::CreateBitmap()); const SkBitmap* bitmap1 = image1; EXPECT_EQ(1U, GetRepCount(image1)); - gfx::Image image2(CreatePlatformImage()); + gfx::Image image2(gt::CreatePlatformImage()); const SkBitmap* bitmap2 = image2; - PlatformImage platform_image = static_cast<PlatformImage>(image2); + gt::PlatformImage platform_image = static_cast<gt::PlatformImage>(image2); EXPECT_EQ(kRepCount, GetRepCount(image2)); image1.SwapRepresentations(&image2); EXPECT_EQ(bitmap2, static_cast<const SkBitmap*>(image1)); - EXPECT_EQ(platform_image, static_cast<PlatformImage>(image1)); + EXPECT_EQ(platform_image, static_cast<gt::PlatformImage>(image1)); EXPECT_EQ(bitmap1, static_cast<const SkBitmap*>(image2)); EXPECT_EQ(kRepCount, GetRepCount(image1)); EXPECT_EQ(1U, GetRepCount(image2)); |