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" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class EmptyPlatform : public TestingPlatformSupport { | |
16 public: | |
17 EmptyPlatform() {} | |
18 ~EmptyPlatform() override {} | |
19 }; | |
20 | |
21 TEST(FontCache, getLastResortFallbackFont) { | 15 TEST(FontCache, getLastResortFallbackFont) { |
22 FontCache* fontCache = FontCache::fontCache(); | 16 FontCache* fontCache = FontCache::fontCache(); |
23 ASSERT_TRUE(fontCache); | 17 ASSERT_TRUE(fontCache); |
24 | 18 |
25 EmptyPlatform platform; | |
26 | |
27 FontDescription fontDescription; | 19 FontDescription fontDescription; |
28 fontDescription.setGenericFamily(FontDescription::StandardFamily); | 20 fontDescription.setGenericFamily(FontDescription::StandardFamily); |
29 RefPtr<SimpleFontData> fontData = | 21 RefPtr<SimpleFontData> fontData = |
30 fontCache->getLastResortFallbackFont(fontDescription, Retain); | 22 fontCache->getLastResortFallbackFont(fontDescription, Retain); |
31 EXPECT_TRUE(fontData); | 23 EXPECT_TRUE(fontData); |
32 | 24 |
33 fontDescription.setGenericFamily(FontDescription::SansSerifFamily); | 25 fontDescription.setGenericFamily(FontDescription::SansSerifFamily); |
34 fontData = fontCache->getLastResortFallbackFont(fontDescription, Retain); | 26 fontData = fontCache->getLastResortFallbackFont(fontDescription, Retain); |
35 EXPECT_TRUE(fontData); | 27 EXPECT_TRUE(fontData); |
36 } | 28 } |
(...skipping 12 matching lines...) Expand all Loading... |
49 | 41 |
50 EXPECT_EQ("not exist", | 42 EXPECT_EQ("not exist", |
51 FontCache::firstAvailableOrFirst("not exist, not exist 2")); | 43 FontCache::firstAvailableOrFirst("not exist, not exist 2")); |
52 | 44 |
53 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst(", not exist, Arial")); | 45 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst(", not exist, Arial")); |
54 EXPECT_EQ("not exist", | 46 EXPECT_EQ("not exist", |
55 FontCache::firstAvailableOrFirst(", not exist, not exist")); | 47 FontCache::firstAvailableOrFirst(", not exist, not exist")); |
56 } | 48 } |
57 | 49 |
58 } // namespace blink | 50 } // namespace blink |
OLD | NEW |