| Index: ui/gfx/image/image_unittest.cc
|
| diff --git a/ui/gfx/image/image_unittest.cc b/ui/gfx/image/image_unittest.cc
|
| index 0cdc237fabb3c356077697b766f71facb7b98cb4..d4811bd9e924fe431bd69aed464f7ad390e29025 100644
|
| --- a/ui/gfx/image/image_unittest.cc
|
| +++ b/ui/gfx/image/image_unittest.cc
|
| @@ -93,6 +93,33 @@ TEST_F(ImageTest, SkiaToSkiaRef) {
|
| EXPECT_FALSE(image.HasRepresentation(gt::GetPlatformRepresentationType()));
|
| }
|
|
|
| +TEST_F(ImageTest, SkiaToPNGEncodeAndDecode) {
|
| + gfx::Image image(gt::CreateBitmap(25, 25));
|
| + const std::vector<unsigned char>* png = image.ToImagePNG();
|
| + EXPECT_TRUE(png);
|
| + EXPECT_FALSE(png->empty());
|
| + EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepPNG));
|
| +
|
| + gfx::Image from_png(*png);
|
| + EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepPNG));
|
| + EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepSkia));
|
| + EXPECT_TRUE(gt::IsEqual(from_png, image));
|
| +}
|
| +
|
| +TEST_F(ImageTest, PlatformToPNGEncodeAndDecode) {
|
| + gfx::Image image(gt::CreatePlatformImage());
|
| + const std::vector<unsigned char>* png = image.ToImagePNG();
|
| + EXPECT_TRUE(png);
|
| + EXPECT_FALSE(png->empty());
|
| + EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepPNG));
|
| +
|
| + gfx::Image from_png(*png);
|
| + EXPECT_TRUE(image.HasRepresentation(gfx::Image::kImageRepPNG));
|
| + EXPECT_TRUE(image.HasRepresentation(gt::GetPlatformRepresentationType()));
|
| + EXPECT_TRUE(gt::IsPlatformImageValid(gt::ToPlatformType(image)));
|
| +}
|
| +
|
| +
|
| TEST_F(ImageTest, SkiaToPlatform) {
|
| gfx::Image image(gt::CreateBitmap(25, 25));
|
| const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U;
|
|
|