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 "ui/gfx/font.h" | 5 #include "ui/gfx/font.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 11 #if defined(OS_LINUX) && !defined(USE_OZONE) |
12 #include <pango/pango.h> | 12 #include <pango/pango.h> |
13 #elif defined(OS_WIN) | 13 #elif defined(OS_WIN) |
14 #include "ui/gfx/platform_font_win.h" | 14 #include "ui/gfx/platform_font_win.h" |
15 #endif | 15 #endif |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 namespace { | 18 namespace { |
19 | 19 |
20 class FontTest : public testing::Test { | 20 class FontTest : public testing::Test { |
21 public: | 21 public: |
22 // Fulfills the memory management contract as outlined by the comment at | 22 // Fulfills the memory management contract as outlined by the comment at |
23 // gfx::Font::GetNativeFont(). | 23 // gfx::Font::GetNativeFont(). |
24 void FreeIfNecessary(NativeFont font) { | 24 void FreeIfNecessary(NativeFont font) { |
25 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 25 #if defined(OS_LINUX) && !defined(USE_OZONE) |
26 pango_font_description_free(font); | 26 pango_font_description_free(font); |
27 #endif | 27 #endif |
28 } | 28 } |
29 }; | 29 }; |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 class ScopedMinimumFontSizeCallback { | 32 class ScopedMinimumFontSizeCallback { |
33 public: | 33 public: |
34 explicit ScopedMinimumFontSizeCallback(int minimum_size) { | 34 explicit ScopedMinimumFontSizeCallback(int minimum_size) { |
35 minimum_size_ = minimum_size; | 35 minimum_size_ = minimum_size; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // The minimum font size is set to 5 in browser_main.cc. | 138 // The minimum font size is set to 5 in browser_main.cc. |
139 ScopedMinimumFontSizeCallback minimum_size(5); | 139 ScopedMinimumFontSizeCallback minimum_size(5); |
140 | 140 |
141 Font derived_font = cf.DeriveFont(-2); | 141 Font derived_font = cf.DeriveFont(-2); |
142 EXPECT_EQ(6, derived_font.GetFontSize()); | 142 EXPECT_EQ(6, derived_font.GetFontSize()); |
143 } | 143 } |
144 #endif // defined(OS_WIN) | 144 #endif // defined(OS_WIN) |
145 | 145 |
146 } // namespace | 146 } // namespace |
147 } // namespace gfx | 147 } // namespace gfx |
OLD | NEW |