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

Side by Side 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, 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "platform/fonts/FontCache.h" 5 #include "platform/fonts/FontCache.h"
6 6
7 #include "platform/fonts/FontDescription.h" 7 #include "platform/fonts/FontDescription.h"
8 #include "platform/fonts/SimpleFontData.h" 8 #include "platform/fonts/SimpleFontData.h"
9 #include "platform/testing/TestingPlatformSupport.h" 9 #include "platform/testing/TestingPlatformSupport.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 17 matching lines...) Expand all
28 fontDescription.setGenericFamily(FontDescription::StandardFamily); 28 fontDescription.setGenericFamily(FontDescription::StandardFamily);
29 RefPtr<SimpleFontData> fontData = 29 RefPtr<SimpleFontData> fontData =
30 fontCache->getLastResortFallbackFont(fontDescription, Retain); 30 fontCache->getLastResortFallbackFont(fontDescription, Retain);
31 EXPECT_TRUE(fontData); 31 EXPECT_TRUE(fontData);
32 32
33 fontDescription.setGenericFamily(FontDescription::SansSerifFamily); 33 fontDescription.setGenericFamily(FontDescription::SansSerifFamily);
34 fontData = fontCache->getLastResortFallbackFont(fontDescription, Retain); 34 fontData = fontCache->getLastResortFallbackFont(fontDescription, Retain);
35 EXPECT_TRUE(fontData); 35 EXPECT_TRUE(fontData);
36 } 36 }
37 37
38 TEST(FontCache, firstAvailableOrFirst) {
39 EXPECT_TRUE(FontCache::firstAvailableOrFirst("").isEmpty());
40 EXPECT_TRUE(FontCache::firstAvailableOrFirst(String()).isEmpty());
41
42 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst("Arial"));
43 EXPECT_EQ("not exist", FontCache::firstAvailableOrFirst("not exist"));
44
45 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst("Arial, not exist"));
46 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst("not exist, Arial"));
47 EXPECT_EQ("Arial",
48 FontCache::firstAvailableOrFirst("not exist, Arial, not exist"));
49
50 EXPECT_EQ("not exist",
51 FontCache::firstAvailableOrFirst("not exist, not exist 2"));
52
53 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst(", not exist, Arial"));
54 EXPECT_EQ("not exist",
55 FontCache::firstAvailableOrFirst(", not exist, not exist"));
56 }
57
38 } // namespace blink 58 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698