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

Side by Side Diff: chrome/common/font_loader_mac_unittest.mm

Issue 2131005: Mac: Infrastructure for serialization of OS fonts over IPC. (Closed)
Patch Set: Better error logging Created 10 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
« no previous file with comments | « chrome/common/font_loader_mac.mm ('k') | chrome/common/sandbox_mac_diraccess_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/font_loader_mac.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "base/basictypes.h"
10 #include "base/scoped_cftyperef.h"
11 #include "base/string_util.h"
12 #include "testing/platform_test.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace {
16
17 class FontLoaderMacTest : public PlatformTest {
18 };
19
20 TEST_F(FontLoaderMacTest, LoadFont) {
21 base::SharedMemory font_data;
22 uint32 font_data_size = 0;
23
24 // Font we use for testing must not be in a .dfont container on 10.5 or 10.6
25 // see comment about font formats in font_loader_mac.h .
26 ASSERT_TRUE(FontLoader::LoadFontIntoBuffer(ASCIIToUTF16("Geeza Pro"),
27 16.0, &font_data, &font_data_size));
28 EXPECT_GT(font_data_size, 0U);
29
30 font_data.Unmap();
31 base::SharedMemoryHandle font_data_handle = font_data.handle();
32 scoped_cftyperef<CGFontRef> cgfont;
33
34 CGFontRef tmp;
35 EXPECT_TRUE(FontLoader::CreateCGFontFromBuffer(font_data_handle,
36 font_data_size, &tmp));
37 ASSERT_TRUE(tmp != NULL);
38 cgfont.reset(tmp);
39
40 const NSFont* nsfont = reinterpret_cast<const NSFont*>(
41 CTFontCreateWithGraphicsFont(cgfont.get(), 16.0,
42 NULL, NULL));
43 [nsfont autorelease];
44
45 // Do something with the font to make sure it's loaded.
46 CGFloat cap_height = [nsfont capHeight];
47 EXPECT_GT(cap_height, 0.0);
48 }
49
50 } // namespace
OLDNEW
« no previous file with comments | « chrome/common/font_loader_mac.mm ('k') | chrome/common/sandbox_mac_diraccess_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698