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

Side by Side Diff: ui/gfx/platform_font_pango_unittest.cc

Issue 10406014: Add a ScopedPangoFontDescription helper class and use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/platform_font_pango.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/gfx/platform_font_pango.h" 5 #include "ui/gfx/platform_font_pango.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/gfx/pango_util.h" 11 #include "ui/gfx/pango_util.h"
12 12
13 namespace gfx {
14
13 // Fails on Chrome OS: http://crbug.com/124451 15 // Fails on Chrome OS: http://crbug.com/124451
14 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
15 #define MAYBE_FamilyList FAILS_FamilyList 17 #define MAYBE_FamilyList FAILS_FamilyList
16 #else 18 #else
17 #define MAYBE_FamilyList FamilyList 19 #define MAYBE_FamilyList FamilyList
18 #endif 20 #endif
19 21
20 // Test that PlatformFontPango is able to cope with PangoFontDescriptions 22 // Test that PlatformFontPango is able to cope with PangoFontDescriptions
21 // containing multiple font families. The first family should be preferred. 23 // containing multiple font families. The first family should be preferred.
22 TEST(PlatformFontPangoTest, MAYBE_FamilyList) { 24 TEST(PlatformFontPangoTest, MAYBE_FamilyList) {
23 PangoFontDescription* desc = 25 ScopedPangoFontDescription desc(
24 pango_font_description_from_string("Arial,Times New Roman, 13px"); 26 pango_font_description_from_string("Arial,Times New Roman, 13px"));
25 scoped_refptr<gfx::PlatformFontPango> font(new gfx::PlatformFontPango(desc)); 27 scoped_refptr<gfx::PlatformFontPango> font(
26 pango_font_description_free(desc); 28 new gfx::PlatformFontPango(desc.get()));
27 EXPECT_EQ("Arial", font->GetFontName()); 29 EXPECT_EQ("Arial", font->GetFontName());
28 EXPECT_EQ(13, font->GetFontSize()); 30 EXPECT_EQ(13, font->GetFontSize());
29 31
30 desc = pango_font_description_from_string("Times New Roman,Arial, 15px"); 32 ScopedPangoFontDescription desc2(
31 scoped_refptr<gfx::PlatformFontPango> font2(new gfx::PlatformFontPango(desc)); 33 pango_font_description_from_string("Times New Roman,Arial, 15px"));
32 pango_font_description_free(desc); 34 scoped_refptr<gfx::PlatformFontPango> font2(
35 new gfx::PlatformFontPango(desc2.get()));
33 EXPECT_EQ("Times New Roman", font2->GetFontName()); 36 EXPECT_EQ("Times New Roman", font2->GetFontName());
34 EXPECT_EQ(15, font2->GetFontSize()); 37 EXPECT_EQ(15, font2->GetFontSize());
35 } 38 }
39
40 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/platform_font_pango.cc ('k') | ui/gfx/render_text_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698