| 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_list.h" | 5 #include "ui/gfx/font_list.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 EXPECT_LT(derived_1.GetFontSize(), font_list.GetFontSize()); | 349 EXPECT_LT(derived_1.GetFontSize(), font_list.GetFontSize()); |
| 350 | 350 |
| 351 // A larger upper bound should not change the height of the font list. | 351 // A larger upper bound should not change the height of the font list. |
| 352 const int height_2 = font_list.GetHeight() + 5; | 352 const int height_2 = font_list.GetHeight() + 5; |
| 353 FontList derived_2 = font_list.DeriveWithHeightUpperBound(height_2); | 353 FontList derived_2 = font_list.DeriveWithHeightUpperBound(height_2); |
| 354 EXPECT_LE(derived_2.GetHeight(), height_2); | 354 EXPECT_LE(derived_2.GetHeight(), height_2); |
| 355 EXPECT_EQ(font_list.GetHeight(), derived_2.GetHeight()); | 355 EXPECT_EQ(font_list.GetHeight(), derived_2.GetHeight()); |
| 356 EXPECT_EQ(font_list.GetFontSize(), derived_2.GetFontSize()); | 356 EXPECT_EQ(font_list.GetFontSize(), derived_2.GetFontSize()); |
| 357 } | 357 } |
| 358 | 358 |
| 359 TEST(FontListTest, FirstAvailableOrFirst) { |
| 360 EXPECT_TRUE(FontList::FirstAvailableOrFirst("").empty()); |
| 361 EXPECT_TRUE(FontList::FirstAvailableOrFirst(std::string()).empty()); |
| 362 |
| 363 EXPECT_EQ("Arial", FontList::FirstAvailableOrFirst("Arial")); |
| 364 EXPECT_EQ("not exist", FontList::FirstAvailableOrFirst("not exist")); |
| 365 |
| 366 EXPECT_EQ("Arial", FontList::FirstAvailableOrFirst("Arial, not exist")); |
| 367 EXPECT_EQ("Arial", FontList::FirstAvailableOrFirst("not exist, Arial")); |
| 368 EXPECT_EQ("Arial", |
| 369 FontList::FirstAvailableOrFirst("not exist, Arial, not exist")); |
| 370 |
| 371 EXPECT_EQ("not exist", |
| 372 FontList::FirstAvailableOrFirst("not exist, not exist 2")); |
| 373 |
| 374 EXPECT_EQ("Arial", FontList::FirstAvailableOrFirst(", not exist, Arial")); |
| 375 EXPECT_EQ("not exist", |
| 376 FontList::FirstAvailableOrFirst(", not exist, not exist")); |
| 377 } |
| 378 |
| 359 } // namespace gfx | 379 } // namespace gfx |
| OLD | NEW |