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

Unified Diff: ui/gfx/font_unittest.cc

Issue 2441343003: Allow the default generic font family settings to find the first available font (Closed)
Patch Set: Code shared in ui/gfx Created 4 years, 2 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.cc ('K') | « ui/gfx/font.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_unittest.cc
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc
index e123d96794ea7021bf27332d8dca9d15dc436969..6200064e2bd5b10eb2dfc428b50c15f58a115bd7 100644
--- a/ui/gfx/font_unittest.cc
+++ b/ui/gfx/font_unittest.cc
@@ -195,5 +195,23 @@ TEST_F(FontTest, DeriveKeepsOriginalSizeIfHeightOk) {
}
#endif // defined(OS_WIN)
+TEST_F(FontTest, FirstAvailableOrFirst) {
+ EXPECT_TRUE(Font::FirstAvailableOrFirst("").empty());
+ EXPECT_TRUE(Font::FirstAvailableOrFirst(std::string()).empty());
+
+ EXPECT_EQ("Arial", Font::FirstAvailableOrFirst("Arial"));
+ EXPECT_EQ("not exist", Font::FirstAvailableOrFirst("not exist"));
+
+ EXPECT_EQ("Arial", Font::FirstAvailableOrFirst("Arial, not exist"));
+ EXPECT_EQ("Arial", Font::FirstAvailableOrFirst("not exist, Arial"));
+ EXPECT_EQ("Arial",
+ Font::FirstAvailableOrFirst("not exist, Arial, not exist"));
+
+ EXPECT_EQ("not exist", Font::FirstAvailableOrFirst("not exist, not exist 2"));
+
+ EXPECT_EQ("Arial", Font::FirstAvailableOrFirst(", not exist, Arial"));
+ EXPECT_EQ("not exist", Font::FirstAvailableOrFirst(", not exist, not exist"));
+}
+
} // namespace
} // namespace gfx
« ui/gfx/font.cc ('K') | « ui/gfx/font.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698