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

Unified Diff: third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp

Issue 2441343003: Allow the default generic font family settings to find the first available font (Closed)
Patch Set: msw review 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
Index: third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp b/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
index 5eeaa67825c3a4ce757ea3384c856d2bd03f4be7..8f2dc92fdd4cc426ba4019d967d3142cba85a34f 100644
--- a/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp
@@ -35,4 +35,24 @@ TEST(FontCache, getLastResortFallbackFont) {
EXPECT_TRUE(fontData);
}
+TEST(FontCache, firstAvailableOrFirst) {
+ EXPECT_TRUE(FontCache::firstAvailableOrFirst("").isEmpty());
+ EXPECT_TRUE(FontCache::firstAvailableOrFirst(String()).isEmpty());
+
+ EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst("Arial"));
+ EXPECT_EQ("not exist", FontCache::firstAvailableOrFirst("not exist"));
+
+ EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst("Arial, not exist"));
+ EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst("not exist, Arial"));
+ EXPECT_EQ("Arial",
+ FontCache::firstAvailableOrFirst("not exist, Arial, not exist"));
+
+ EXPECT_EQ("not exist",
+ FontCache::firstAvailableOrFirst("not exist, not exist 2"));
+
+ EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst(", not exist, Arial"));
+ EXPECT_EQ("not exist",
+ FontCache::firstAvailableOrFirst(", not exist, not exist"));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698