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_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ |
msw
2013/11/04 23:10:46
nit: can you change "#if defined(OS_POSIX) && !def
sadrul
2013/11/05 02:42:27
Done.
| |
12 !defined(USE_OZONE) | |
12 #include <pango/pango.h> | 13 #include <pango/pango.h> |
13 #elif defined(OS_WIN) | 14 #elif defined(OS_WIN) |
14 #include "ui/gfx/platform_font_win.h" | 15 #include "ui/gfx/platform_font_win.h" |
15 #endif | 16 #endif |
16 | 17 |
17 namespace gfx { | 18 namespace gfx { |
18 namespace { | 19 namespace { |
19 | 20 |
20 class FontTest : public testing::Test { | 21 class FontTest : public testing::Test { |
21 public: | 22 public: |
22 // Fulfills the memory management contract as outlined by the comment at | 23 // Fulfills the memory management contract as outlined by the comment at |
23 // gfx::Font::GetNativeFont(). | 24 // gfx::Font::GetNativeFont(). |
24 void FreeIfNecessary(NativeFont font) { | 25 void FreeIfNecessary(NativeFont font) { |
25 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 26 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ |
27 !defined(USE_OZONE) | |
26 pango_font_description_free(font); | 28 pango_font_description_free(font); |
27 #endif | 29 #endif |
28 } | 30 } |
29 }; | 31 }; |
30 | 32 |
31 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
32 class ScopedMinimumFontSizeCallback { | 34 class ScopedMinimumFontSizeCallback { |
33 public: | 35 public: |
34 explicit ScopedMinimumFontSizeCallback(int minimum_size) { | 36 explicit ScopedMinimumFontSizeCallback(int minimum_size) { |
35 minimum_size_ = minimum_size; | 37 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. | 140 // The minimum font size is set to 5 in browser_main.cc. |
139 ScopedMinimumFontSizeCallback minimum_size(5); | 141 ScopedMinimumFontSizeCallback minimum_size(5); |
140 | 142 |
141 Font derived_font = cf.DeriveFont(-2); | 143 Font derived_font = cf.DeriveFont(-2); |
142 EXPECT_EQ(6, derived_font.GetFontSize()); | 144 EXPECT_EQ(6, derived_font.GetFontSize()); |
143 } | 145 } |
144 #endif // defined(OS_WIN) | 146 #endif // defined(OS_WIN) |
145 | 147 |
146 } // namespace | 148 } // namespace |
147 } // namespace gfx | 149 } // namespace gfx |
OLD | NEW |