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

Unified Diff: base/mac_util_unittest.mm

Issue 3072005: Move NSImage-to-CGImageRef conversion code into a common helper function in base/mac_util.h. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix test Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac_util.mm ('k') | chrome/browser/cocoa/animatable_image.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac_util_unittest.mm
diff --git a/base/mac_util_unittest.mm b/base/mac_util_unittest.mm
index aebb731ae1505eead6a2b489462211eb00d71bb3..f590ac1439d2730bad91d5458d2271a66ea2d2ec 100644
--- a/base/mac_util_unittest.mm
+++ b/base/mac_util_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -165,6 +165,21 @@ TEST_F(MacUtilTest, TestGetValueFromDictionary) {
dict, CFSTR("no-exist"), CFStringGetTypeID()));
}
+TEST_F(MacUtilTest, CopyNSImageToCGImage) {
+ scoped_nsobject<NSImage> nsImage(
+ [[NSImage alloc] initWithSize:NSMakeSize(20, 20)]);
+ [nsImage lockFocus];
+ [[NSColor redColor] set];
+ NSRect rect = NSZeroRect;
+ rect.size = [nsImage size];
+ NSRectFill(rect);
+ [nsImage unlockFocus];
+
+ scoped_cftyperef<CGImageRef> cgImage(
+ mac_util::CopyNSImageToCGImage(nsImage.get()));
+ EXPECT_TRUE(cgImage.get());
+}
+
} // namespace
} // namespace mac_util
« no previous file with comments | « base/mac_util.mm ('k') | chrome/browser/cocoa/animatable_image.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698