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/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 << "needed for unittests. Check if " << kSymbolFontName | 155 << "needed for unittests. Check if " << kSymbolFontName |
156 << " font is installed.\n" | 156 << " font is installed.\n" |
157 << "********"; | 157 << "********"; |
158 | 158 |
159 const char* const invalid_font_name = "no_such_font_name"; | 159 const char* const invalid_font_name = "no_such_font_name"; |
160 Font fallback_font(invalid_font_name, 16); | 160 Font fallback_font(invalid_font_name, 16); |
161 EXPECT_NE(invalid_font_name, | 161 EXPECT_NE(invalid_font_name, |
162 base::ToLowerASCII(fallback_font.GetActualFontNameForTesting())); | 162 base::ToLowerASCII(fallback_font.GetActualFontNameForTesting())); |
163 } | 163 } |
164 | 164 |
165 TEST_F(FontTest, DeriveFont) { | 165 #if defined(OS_ANDROID) |
| 166 // https://crbug.com/642010 |
| 167 #define MAYBE_DeriveFont DISABLED_DeriveFont |
| 168 #else |
| 169 #define MAYBE_DeriveFont DeriveFont |
| 170 #endif |
| 171 TEST_F(FontTest, MAYBE_DeriveFont) { |
166 Font cf("Arial", 8); | 172 Font cf("Arial", 8); |
167 const int kSizeDelta = 2; | 173 const int kSizeDelta = 2; |
168 Font cf_underlined = | 174 Font cf_underlined = |
169 cf.Derive(0, cf.GetStyle() | gfx::Font::UNDERLINE, cf.GetWeight()); | 175 cf.Derive(0, cf.GetStyle() | gfx::Font::UNDERLINE, cf.GetWeight()); |
170 Font cf_underlined_resized = cf_underlined.Derive( | 176 Font cf_underlined_resized = cf_underlined.Derive( |
171 kSizeDelta, cf_underlined.GetStyle(), cf_underlined.GetWeight()); | 177 kSizeDelta, cf_underlined.GetStyle(), cf_underlined.GetWeight()); |
172 EXPECT_EQ(cf.GetStyle() | gfx::Font::UNDERLINE, | 178 EXPECT_EQ(cf.GetStyle() | gfx::Font::UNDERLINE, |
173 cf_underlined_resized.GetStyle()); | 179 cf_underlined_resized.GetStyle()); |
174 EXPECT_EQ(cf.GetFontSize() + kSizeDelta, cf_underlined_resized.GetFontSize()); | 180 EXPECT_EQ(cf.GetFontSize() + kSizeDelta, cf_underlined_resized.GetFontSize()); |
175 EXPECT_EQ(cf.GetWeight(), cf_underlined_resized.GetWeight()); | 181 EXPECT_EQ(cf.GetWeight(), cf_underlined_resized.GetWeight()); |
(...skipping 14 matching lines...) Expand all Loading... |
190 // The minimum font size is set to 5 in browser_main.cc. | 196 // The minimum font size is set to 5 in browser_main.cc. |
191 ScopedMinimumFontSizeCallback minimum_size(5); | 197 ScopedMinimumFontSizeCallback minimum_size(5); |
192 | 198 |
193 Font derived_font = cf.Derive(-2, cf.GetStyle(), cf.GetWeight()); | 199 Font derived_font = cf.Derive(-2, cf.GetStyle(), cf.GetWeight()); |
194 EXPECT_EQ(6, derived_font.GetFontSize()); | 200 EXPECT_EQ(6, derived_font.GetFontSize()); |
195 } | 201 } |
196 #endif // defined(OS_WIN) | 202 #endif // defined(OS_WIN) |
197 | 203 |
198 } // namespace | 204 } // namespace |
199 } // namespace gfx | 205 } // namespace gfx |
OLD | NEW |