| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 TEST_F(FontTest, DeriveKeepsOriginalSizeIfHeightOk) { | 188 TEST_F(FontTest, DeriveKeepsOriginalSizeIfHeightOk) { |
| 189 Font cf("Arial", 8); | 189 Font cf("Arial", 8); |
| 190 // The minimum font size is set to 5 in browser_main.cc. | 190 // The minimum font size is set to 5 in browser_main.cc. |
| 191 ScopedMinimumFontSizeCallback minimum_size(5); | 191 ScopedMinimumFontSizeCallback minimum_size(5); |
| 192 | 192 |
| 193 Font derived_font = cf.Derive(-2, cf.GetStyle(), cf.GetWeight()); | 193 Font derived_font = cf.Derive(-2, cf.GetStyle(), cf.GetWeight()); |
| 194 EXPECT_EQ(6, derived_font.GetFontSize()); | 194 EXPECT_EQ(6, derived_font.GetFontSize()); |
| 195 } | 195 } |
| 196 #endif // defined(OS_WIN) | 196 #endif // defined(OS_WIN) |
| 197 | 197 |
| 198 TEST_F(FontTest, FirstAvailableOrFirst) { |
| 199 EXPECT_TRUE(Font::FirstAvailableOrFirst("").empty()); |
| 200 EXPECT_TRUE(Font::FirstAvailableOrFirst(std::string()).empty()); |
| 201 |
| 202 EXPECT_EQ("Arial", Font::FirstAvailableOrFirst("Arial")); |
| 203 EXPECT_EQ("not exist", Font::FirstAvailableOrFirst("not exist")); |
| 204 |
| 205 EXPECT_EQ("Arial", Font::FirstAvailableOrFirst("Arial, not exist")); |
| 206 EXPECT_EQ("Arial", Font::FirstAvailableOrFirst("not exist, Arial")); |
| 207 EXPECT_EQ("Arial", |
| 208 Font::FirstAvailableOrFirst("not exist, Arial, not exist")); |
| 209 |
| 210 EXPECT_EQ("not exist", Font::FirstAvailableOrFirst("not exist, not exist 2")); |
| 211 |
| 212 EXPECT_EQ("Arial", Font::FirstAvailableOrFirst(", not exist, Arial")); |
| 213 EXPECT_EQ("not exist", Font::FirstAvailableOrFirst(", not exist, not exist")); |
| 214 } |
| 215 |
| 198 } // namespace | 216 } // namespace |
| 199 } // namespace gfx | 217 } // namespace gfx |
| OLD | NEW |