| OLD | NEW |
| 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 Loading... |
| 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 class FontCacheAvailabilityTest : public ::testing::Test { | |
| 39 protected: | |
| 40 void SetUp() override | |
| 41 { | |
| 42 m_fontCache = FontCache::fontCache(); | |
| 43 ASSERT_TRUE(m_fontCache); | |
| 44 m_fontDescription.setGenericFamily(FontDescription::StandardFamily); | |
| 45 } | |
| 46 | |
| 47 void TearDown() override | |
| 48 { | |
| 49 EXPECT_TRUE(m_availableFonts); | |
| 50 EXPECT_GE(m_availableFonts->size(), 1u); | |
| 51 } | |
| 52 | |
| 53 FontCache* m_fontCache; | |
| 54 EmptyPlatform m_emptyPlatform; | |
| 55 FontDescription m_fontDescription; | |
| 56 const Vector<AtomicString>* m_availableFonts; | |
| 57 }; | |
| 58 | |
| 59 TEST_F(FontCacheAvailabilityTest, availableSymbolsFonts) | |
| 60 { | |
| 61 m_availableFonts = m_fontCache->fontListForFallbackPriority( | |
| 62 m_fontDescription, | |
| 63 FontFallbackPriority::Symbols); | |
| 64 } | |
| 65 | |
| 66 TEST_F(FontCacheAvailabilityTest, availableMathFonts) | |
| 67 { | |
| 68 m_availableFonts = m_fontCache->fontListForFallbackPriority( | |
| 69 m_fontDescription, | |
| 70 FontFallbackPriority::Math); | |
| 71 } | |
| 72 | |
| 73 TEST_F(FontCacheAvailabilityTest, availableEmojiTextFonts) | |
| 74 { | |
| 75 m_availableFonts = m_fontCache->fontListForFallbackPriority( | |
| 76 m_fontDescription, | |
| 77 FontFallbackPriority::EmojiText); | |
| 78 } | |
| 79 | |
| 80 TEST_F(FontCacheAvailabilityTest, availableEmojiEmojiFonts) | |
| 81 { | |
| 82 m_availableFonts = m_fontCache->fontListForFallbackPriority( | |
| 83 m_fontDescription, | |
| 84 FontFallbackPriority::EmojiEmoji); | |
| 85 } | |
| 86 | |
| 87 } // namespace blink | 38 } // namespace blink |
| OLD | NEW |