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

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

Issue 277773002: Add ImageSkiaRep::unscaled that tells if the image is for unscaled image. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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_skia_rep.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_skia_unittest.cc
diff --git a/ui/gfx/image/image_skia_unittest.cc b/ui/gfx/image/image_skia_unittest.cc
index 0047822122bb67ee954d7e21f940dd7c149ff275..fd4f5eeb17b39621e7c3a73fa900fa01ef62c887 100644
--- a/ui/gfx/image/image_skia_unittest.cc
+++ b/ui/gfx/image/image_skia_unittest.cc
@@ -375,4 +375,19 @@ TEST(ImageSkiaTest, SourceOnThreadTest) {
// Just in case we ever get lumped together with other compilation units.
#undef ENABLE_NON_THREAD_SAFE
+TEST(ImageSkiaTest, Unscaled) {
+ SkBitmap bitmap;
+
+ // An ImageSkia created with 1x bitmap is unscaled.
+ ImageSkia image_skia = ImageSkia::CreateFrom1xBitmap(bitmap);
+ EXPECT_TRUE(image_skia.GetRepresentation(1.0f).unscaled());
+ ImageSkiaRep rep_2x(Size(100, 100), 2.0f);
+
+ // When reps for other scales are added, the unscaled image
+ // becomes scaled.
+ image_skia.AddRepresentation(rep_2x);
+ EXPECT_FALSE(image_skia.GetRepresentation(1.0f).unscaled());
+ EXPECT_FALSE(image_skia.GetRepresentation(2.0f).unscaled());
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/image/image_skia_rep.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698