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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp

Issue 1615923004: Add FontCache API for retrieving prioritized fallback fonts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments addressed Created 4 years, 10 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 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 fontDescription; 28 FontDescription fontDescription;
29 fontDescription.setGenericFamily(FontDescription::StandardFamily); 29 fontDescription.setGenericFamily(FontDescription::StandardFamily);
30 RefPtr<SimpleFontData> fontData = fontCache->getLastResortFallbackFont(fontD escription, Retain); 30 RefPtr<SimpleFontData> fontData = fontCache->getLastResortFallbackFont(fontD escription, 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, availablePriorityFallbackFonts)
39 {
40 FontCache* fontCache = FontCache::fontCache();
41 ASSERT_TRUE(fontCache);
42
43 EmptyPlatform platform;
44
45 FontDescription fontDescription;
46 fontDescription.setGenericFamily(FontDescription::StandardFamily);
47
48 for (FontFallbackPriority fallbackPriority :
49 { FontFallbackPriority::Symbols,
50 FontFallbackPriority::Math,
51 FontFallbackPriority::EmojiText,
52 FontFallbackPriority::EmojiEmoji }) {
53
54 const Vector<AtomicString> availableFallbackPriorityFonts =
55 fontCache->fontListForFallbackPriority(fontDescription,
56 fallbackPriority);
57 EXPECT_GE(availableFallbackPriorityFonts.size(), 1u);
58 }
59 }
60
38 } // namespace blink 61 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698