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

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

Issue 10867076: Enable gfx::Image to be created from empty platform images. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « ui/gfx/image/image.cc ('k') | no next file » | 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 73e98363256ee8e8c4c80461ee17e2908dd7250d..967bb3a7581f2583ee33aa88fa203c7d181ba196 100644
--- a/ui/gfx/image/image_unittest.cc
+++ b/ui/gfx/image/image_unittest.cc
@@ -47,6 +47,28 @@ TEST_F(ImageTest, EmptyImage) {
EXPECT_TRUE(image2.IsEmpty());
}
+// Test constructing a gfx::Image from an empty PlatformImage.
+TEST_F(ImageTest, EmptyImageFromEmptyPlatformImage) {
+#if defined(OS_MACOSX) || defined(TOOLKIT_GTK)
+ gfx::Image image1(NULL);
+ EXPECT_TRUE(image1.IsEmpty());
+ EXPECT_EQ(0U, image1.RepresentationCount());
+#endif
+
+ // SkBitmap and gfx::ImageSkia are available on all platforms.
+ SkBitmap bitmap;
+ EXPECT_TRUE(bitmap.empty());
+ gfx::Image image2(bitmap);
+ EXPECT_TRUE(image2.IsEmpty());
+ EXPECT_EQ(0U, image2.RepresentationCount());
+
+ gfx::ImageSkia image_skia;
+ EXPECT_TRUE(image_skia.isNull());
+ gfx::Image image3(image_skia);
+ EXPECT_TRUE(image3.IsEmpty());
+ EXPECT_EQ(0U, image3.RepresentationCount());
+}
+
TEST_F(ImageTest, SkiaToSkia) {
gfx::Image image(gt::CreateBitmap(25, 25));
const SkBitmap* bitmap = image.ToSkBitmap();
« no previous file with comments | « ui/gfx/image/image.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698