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

Unified Diff: ui/gfx/font_list_unittest.cc

Issue 470053004: [Win, Linux] Always display the avatar button text at the same size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + review comments and moar better test Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« ui/gfx/font_list.h ('K') | « ui/gfx/font_list.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_list_unittest.cc
diff --git a/ui/gfx/font_list_unittest.cc b/ui/gfx/font_list_unittest.cc
index fc5f8392069f52c12be3c12bd508291e4c7771ff..3682bc3861df31aed0c2bb902f31c923c08b0768 100644
--- a/ui/gfx/font_list_unittest.cc
+++ b/ui/gfx/font_list_unittest.cc
@@ -286,4 +286,25 @@ TEST(FontListTest, Fonts_GetHeight_GetBaseline) {
font_list_mix.GetBaseline());
}
+TEST(FontListTest, Fonts_DeriveWithHeightUpperBound) {
+ std::vector<Font> fonts;
+
+ fonts.push_back(gfx::Font("Arial", 18));
+ fonts.push_back(gfx::Font("Sans serif", 18));
+ fonts.push_back(gfx::Font("Symbol", 18));
+ FontList font_list = FontList(fonts);
+
+ // A smaller upper bound should derive a font list with a smaller height.
+ const int height_1 = font_list.GetHeight() - 5;
+ FontList derived_1 = font_list.DeriveWithHeightUpperBound(height_1);
+ EXPECT_LE(derived_1.GetHeight(), height_1);
+ EXPECT_LT(derived_1.GetHeight(), font_list.GetHeight());
+
+ // A larger upper bound should not change the height of the font list.
+ const int height_2 = font_list.GetHeight() + 5;
+ FontList derived_2 = font_list.DeriveWithHeightUpperBound(height_2);
+ EXPECT_LE(derived_2.GetHeight(), height_2);
+ EXPECT_EQ(font_list.GetHeight(), derived_2.GetHeight());
msw 2014/08/29 17:25:59 nit: can you also EXPECT_EQ their GetFontSize() va
noms (inactive) 2014/08/29 18:03:20 Done.
+}
+
} // namespace gfx
« ui/gfx/font_list.h ('K') | « ui/gfx/font_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698