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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/image/image_skia_rep.cc ('k') | no next file » | no next file with comments »
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 "ui/gfx/image/image_skia.h" 5 #include "ui/gfx/image/image_skia.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/threading/simple_thread.h" 8 #include "base/threading/simple_thread.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 EXPECT_TRUE(threadsafe_on_thread.can_read()); 368 EXPECT_TRUE(threadsafe_on_thread.can_read());
369 EXPECT_FALSE(threadsafe_on_thread.can_modify()); 369 EXPECT_FALSE(threadsafe_on_thread.can_modify());
370 EXPECT_TRUE(image.CanRead()); 370 EXPECT_TRUE(image.CanRead());
371 EXPECT_FALSE(image.CanModify()); 371 EXPECT_FALSE(image.CanModify());
372 } 372 }
373 #endif // ENABLE_NON_THREAD_SAFE 373 #endif // ENABLE_NON_THREAD_SAFE
374 374
375 // Just in case we ever get lumped together with other compilation units. 375 // Just in case we ever get lumped together with other compilation units.
376 #undef ENABLE_NON_THREAD_SAFE 376 #undef ENABLE_NON_THREAD_SAFE
377 377
378 TEST(ImageSkiaTest, Unscaled) {
379 SkBitmap bitmap;
380
381 // An ImageSkia created with 1x bitmap is unscaled.
382 ImageSkia image_skia = ImageSkia::CreateFrom1xBitmap(bitmap);
383 EXPECT_TRUE(image_skia.GetRepresentation(1.0f).unscaled());
384 ImageSkiaRep rep_2x(Size(100, 100), 2.0f);
385
386 // When reps for other scales are added, the unscaled image
387 // becomes scaled.
388 image_skia.AddRepresentation(rep_2x);
389 EXPECT_FALSE(image_skia.GetRepresentation(1.0f).unscaled());
390 EXPECT_FALSE(image_skia.GetRepresentation(2.0f).unscaled());
391 }
392
378 } // namespace gfx 393 } // namespace gfx
OLDNEW
« 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