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