| 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/SimpleFontData.h" | 7 #include "platform/fonts/SimpleFontData.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 TEST(FontCacheAndroid, fallbackFontForCharacter) { | 12 TEST(FontCacheAndroid, fallbackFontForCharacter) { |
| 13 // A Latin character in the common locale system font, but not in the | 13 // A Latin character in the common locale system font, but not in the |
| 14 // Chinese locale-preferred font. | 14 // Chinese locale-preferred font. |
| 15 const UChar32 kTestChar = 228; | 15 const UChar32 kTestChar = 228; |
| 16 | 16 |
| 17 FontDescription font_description; | 17 FontDescription font_description; |
| 18 font_description.SetLocale(LayoutLocale::Get("zh")); | 18 font_description.SetLocale(LayoutLocale::Get("zh")); |
| 19 ASSERT_EQ(USCRIPT_SIMPLIFIED_HAN, font_description.Script()); | 19 ASSERT_EQ(USCRIPT_SIMPLIFIED_HAN, font_description.GetScript()); |
| 20 font_description.SetGenericFamily(FontDescription::kStandardFamily); | 20 font_description.SetGenericFamily(FontDescription::kStandardFamily); |
| 21 | 21 |
| 22 FontCache* font_cache = FontCache::GetFontCache(); | 22 FontCache* font_cache = FontCache::GetFontCache(); |
| 23 ASSERT_TRUE(font_cache); | 23 ASSERT_TRUE(font_cache); |
| 24 RefPtr<SimpleFontData> font_data = | 24 RefPtr<SimpleFontData> font_data = |
| 25 font_cache->FallbackFontForCharacter(font_description, kTestChar, 0); | 25 font_cache->FallbackFontForCharacter(font_description, kTestChar, 0); |
| 26 EXPECT_TRUE(font_data); | 26 EXPECT_TRUE(font_data); |
| 27 } | 27 } |
| 28 | 28 |
| 29 TEST(FontCacheAndroid, genericFamilyNameForScript) { | 29 TEST(FontCacheAndroid, genericFamilyNameForScript) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 48 // monospace. | 48 // monospace. |
| 49 EXPECT_NE(FontFamilyNames::webkit_standard, | 49 EXPECT_NE(FontFamilyNames::webkit_standard, |
| 50 FontCache::GetGenericFamilyNameForScript( | 50 FontCache::GetGenericFamilyNameForScript( |
| 51 FontFamilyNames::webkit_standard, chinese)); | 51 FontFamilyNames::webkit_standard, chinese)); |
| 52 EXPECT_EQ(FontFamilyNames::webkit_monospace, | 52 EXPECT_EQ(FontFamilyNames::webkit_monospace, |
| 53 FontCache::GetGenericFamilyNameForScript( | 53 FontCache::GetGenericFamilyNameForScript( |
| 54 FontFamilyNames::webkit_monospace, chinese)); | 54 FontFamilyNames::webkit_monospace, chinese)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace blink | 57 } // namespace blink |
| OLD | NEW |