OLD | NEW |
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 "skia/ext/skia_utils_mac.mm" | 5 #include "skia/ext/skia_utils_mac.mm" |
| 6 |
| 7 #include "base/mac/scoped_nsobject.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
7 | 9 |
8 namespace { | 10 namespace { |
9 | 11 |
10 class SkiaUtilsMacTest : public testing::Test { | 12 class SkiaUtilsMacTest : public testing::Test { |
11 public: | 13 public: |
12 // Creates a red or blue bitmap. | 14 // Creates a red or blue bitmap. |
13 SkBitmap CreateSkBitmap(int width, int height, bool isred, bool tfbit); | 15 SkBitmap CreateSkBitmap(int width, int height, bool isred, bool tfbit); |
14 | 16 |
15 // Creates a red or blue image. | 17 // Creates a red or blue image. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 52 |
51 if (isred) | 53 if (isred) |
52 bitmap.eraseRGB(0xff, 0, 0); | 54 bitmap.eraseRGB(0xff, 0, 0); |
53 else | 55 else |
54 bitmap.eraseRGB(0, 0, 0xff); | 56 bitmap.eraseRGB(0, 0, 0xff); |
55 | 57 |
56 return bitmap; | 58 return bitmap; |
57 } | 59 } |
58 | 60 |
59 NSImage* SkiaUtilsMacTest::CreateNSImage(int width, int height, bool isred) { | 61 NSImage* SkiaUtilsMacTest::CreateNSImage(int width, int height, bool isred) { |
60 scoped_nsobject<NSImage> image( | 62 base::scoped_nsobject<NSImage> image( |
61 [[NSImage alloc] initWithSize:NSMakeSize(width, height)]); | 63 [[NSImage alloc] initWithSize:NSMakeSize(width, height)]); |
62 [image lockFocus]; | 64 [image lockFocus]; |
63 if (isred) | 65 if (isred) |
64 [[NSColor colorWithDeviceRed:1.0 green:0.0 blue:0.0 alpha:1.0] set]; | 66 [[NSColor colorWithDeviceRed:1.0 green:0.0 blue:0.0 alpha:1.0] set]; |
65 else | 67 else |
66 [[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:1.0] set]; | 68 [[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:1.0] set]; |
67 NSRectFill(NSMakeRect(0, 0, width, height)); | 69 NSRectFill(NSMakeRect(0, 0, width, height)); |
68 [image unlockFocus]; | 70 [image unlockFocus]; |
69 return [image.release() autorelease]; | 71 return [image.release() autorelease]; |
70 } | 72 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 TEST_F(SkiaUtilsMacTest, BitLocker_ClipNoBits) { | 237 TEST_F(SkiaUtilsMacTest, BitLocker_ClipNoBits) { |
236 RunBitLockerTest(SkiaUtilsMacTest::TestClipNoBits); | 238 RunBitLockerTest(SkiaUtilsMacTest::TestClipNoBits); |
237 } | 239 } |
238 | 240 |
239 TEST_F(SkiaUtilsMacTest, BitLocker_XClipNoBits) { | 241 TEST_F(SkiaUtilsMacTest, BitLocker_XClipNoBits) { |
240 RunBitLockerTest(SkiaUtilsMacTest::TestXClipNoBits); | 242 RunBitLockerTest(SkiaUtilsMacTest::TestXClipNoBits); |
241 } | 243 } |
242 | 244 |
243 } // namespace | 245 } // namespace |
244 | 246 |
OLD | NEW |