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

Side by Side Diff: ui/gfx/image/image_unittest.cc

Issue 271653003: Scrub deprecated Skia APIs. (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
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "third_party/skia/include/core/SkCanvas.h" 6 #include "third_party/skia/include/core/SkCanvas.h"
7 #include "third_party/skia/include/core/SkPaint.h" 7 #include "third_party/skia/include/core/SkPaint.h"
8 #include "ui/gfx/image/image.h" 8 #include "ui/gfx/image/image.h"
9 #include "ui/gfx/image/image_png_rep.h" 9 #include "ui/gfx/image/image_png_rep.h"
10 #include "ui/gfx/image/image_skia.h" 10 #include "ui/gfx/image/image_skia.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 const SkBitmap* bitmap = image.ToSkBitmap(); 465 const SkBitmap* bitmap = image.ToSkBitmap();
466 SkAutoLockPixels auto_lock(*bitmap); 466 SkAutoLockPixels auto_lock(*bitmap);
467 gt::CheckColors(bitmap->getColor(10, 10), SK_ColorGREEN); 467 gt::CheckColors(bitmap->getColor(10, 10), SK_ColorGREEN);
468 } 468 }
469 469
470 TEST_F(ImageTest, SkBitmapConversionPreservesOrientation) { 470 TEST_F(ImageTest, SkBitmapConversionPreservesOrientation) {
471 const int width = 50; 471 const int width = 50;
472 const int height = 50; 472 const int height = 50;
473 SkBitmap bitmap; 473 SkBitmap bitmap;
474 bitmap.allocN32Pixels(width, height); 474 bitmap.allocN32Pixels(width, height);
475 bitmap.eraseRGB(0, 255, 0); 475 bitmap.eraseARGB(255, 0, 255, 0);
476 476
477 // Paint the upper half of the image in red (lower half is in green). 477 // Paint the upper half of the image in red (lower half is in green).
478 SkCanvas canvas(bitmap); 478 SkCanvas canvas(bitmap);
479 SkPaint red; 479 SkPaint red;
480 red.setColor(SK_ColorRED); 480 red.setColor(SK_ColorRED);
481 canvas.drawRect(SkRect::MakeWH(width, height / 2), red); 481 canvas.drawRect(SkRect::MakeWH(width, height / 2), red);
482 { 482 {
483 SCOPED_TRACE("Checking color of the initial SkBitmap"); 483 SCOPED_TRACE("Checking color of the initial SkBitmap");
484 gt::CheckColors(bitmap.getColor(10, 10), SK_ColorRED); 484 gt::CheckColors(bitmap.getColor(10, 10), SK_ColorRED);
485 gt::CheckColors(bitmap.getColor(10, 40), SK_ColorGREEN); 485 gt::CheckColors(bitmap.getColor(10, 40), SK_ColorGREEN);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 gfx::ImageSkiaRep(bitmap, 1.0f))); 662 gfx::ImageSkiaRep(bitmap, 1.0f)));
663 } 663 }
664 EXPECT_TRUE(!image.ToSkBitmap()->isNull()); 664 EXPECT_TRUE(!image.ToSkBitmap()->isNull());
665 } 665 }
666 666
667 // Integration tests with UI toolkit frameworks require linking against the 667 // Integration tests with UI toolkit frameworks require linking against the
668 // Views library and cannot be here (ui_unittests doesn't include it). They 668 // Views library and cannot be here (ui_unittests doesn't include it). They
669 // instead live in /chrome/browser/ui/tests/ui_gfx_image_unittest.cc. 669 // instead live in /chrome/browser/ui/tests/ui_gfx_image_unittest.cc.
670 670
671 } // namespace 671 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698