OLD | NEW |
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
9 | 9 |
10 #import "base/chrome_application_mac.h" | 10 #import "base/chrome_application_mac.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 CFDictionarySetValue(dict.get(), CFSTR("key"), CFSTR("value")); | 158 CFDictionarySetValue(dict.get(), CFSTR("key"), CFSTR("value")); |
159 | 159 |
160 EXPECT_TRUE(CFEqual(CFSTR("value"), | 160 EXPECT_TRUE(CFEqual(CFSTR("value"), |
161 GetValueFromDictionary( | 161 GetValueFromDictionary( |
162 dict, CFSTR("key"), CFStringGetTypeID()))); | 162 dict, CFSTR("key"), CFStringGetTypeID()))); |
163 EXPECT_FALSE(GetValueFromDictionary(dict, CFSTR("key"), CFNumberGetTypeID())); | 163 EXPECT_FALSE(GetValueFromDictionary(dict, CFSTR("key"), CFNumberGetTypeID())); |
164 EXPECT_FALSE(GetValueFromDictionary( | 164 EXPECT_FALSE(GetValueFromDictionary( |
165 dict, CFSTR("no-exist"), CFStringGetTypeID())); | 165 dict, CFSTR("no-exist"), CFStringGetTypeID())); |
166 } | 166 } |
167 | 167 |
| 168 TEST_F(MacUtilTest, CopyNSImageToCGImage) { |
| 169 scoped_nsobject<NSImage> nsImage( |
| 170 [[NSImage alloc] initWithSize:NSMakeSize(20, 20)]); |
| 171 [nsImage lockFocus]; |
| 172 [[NSColor redColor] set]; |
| 173 NSRect rect = NSZeroRect; |
| 174 rect.size = [nsImage size]; |
| 175 NSRectFill(rect); |
| 176 [nsImage unlockFocus]; |
| 177 |
| 178 scoped_cftyperef<CGImageRef> cgImage( |
| 179 mac_util::CopyNSImageToCGImage(nsImage.get())); |
| 180 EXPECT_TRUE(cgImage.get()); |
| 181 } |
| 182 |
168 } // namespace | 183 } // namespace |
169 | 184 |
170 } // namespace mac_util | 185 } // namespace mac_util |
OLD | NEW |