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

Unified Diff: ui/gfx/font_list_unittest.cc

Issue 18848002: Shows Japanese and English mixed queries correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds a unit test. Created 7 years, 5 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
Index: ui/gfx/font_list_unittest.cc
diff --git a/ui/gfx/font_list_unittest.cc b/ui/gfx/font_list_unittest.cc
index ed34a0d4dc8cfea7b2464d68e0397e09bdd6b439..8394e8bed5c126af02a51a692b0c58c658fe43e1 100644
--- a/ui/gfx/font_list_unittest.cc
+++ b/ui/gfx/font_list_unittest.cc
@@ -232,4 +232,30 @@ TEST(FontListTest, Fonts_DeriveFontListWithSize) {
EXPECT_EQ("Sans serif|5", FontToString(derived_fonts[1]));
}
+TEST(FontListTest, Fonts_GetHeight_GetBaseline) {
+ // If the font list has only one font, the height and baseline must be
+ // the same.
+ Font font_arial10("Arial", 10);
+ FontList font_list_arial10("Arial, 10px");
+ EXPECT_EQ(font_arial10.GetHeight(), font_list_arial10.GetHeight());
+ EXPECT_EQ(font_arial10.GetBaseline(), font_list_arial10.GetBaseline());
+
+ Font font_helvetica20("Helvetica", 20);
+ FontList font_list_helvetica20("Helvetica, 20px");
+ EXPECT_EQ(font_helvetica20.GetHeight(), font_list_helvetica20.GetHeight());
+ EXPECT_EQ(font_helvetica20.GetBaseline(),
+ font_list_helvetica20.GetBaseline());
+
+ // If there are two different fonts, the font list returns the max value.
+ std::vector<Font> font_set_mix;
+ font_set_mix.push_back(font_arial10);
+ font_set_mix.push_back(font_helvetica20);
+ FontList font_list_mix(font_set_mix);
+ // Helvetica 20px must be larger than Arial 10px.
+ EXPECT_GT(font_helvetica20.GetHeight(), font_arial10.GetHeight());
+ EXPECT_EQ(font_helvetica20.GetHeight(), font_list_mix.GetHeight());
+ EXPECT_GT(font_helvetica20.GetBaseline(), font_arial10.GetBaseline());
+ EXPECT_EQ(font_helvetica20.GetBaseline(), font_list_mix.GetBaseline());
+}
+
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698