Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Side by Side Diff: ui/gfx/font_list_unittest.cc

Issue 2441343003: Allow the default generic font family settings to find the first available font (Closed)
Patch Set: msw review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/font_list.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ui/gfx/font_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698