| 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 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 TEST(FontCacheAndroid, genericFamilyNameForScript) { | 29 TEST(FontCacheAndroid, genericFamilyNameForScript) { |
| 30 FontDescription english; | 30 FontDescription english; |
| 31 english.setLocale(LayoutLocale::get("en")); | 31 english.setLocale(LayoutLocale::get("en")); |
| 32 FontDescription chinese; | 32 FontDescription chinese; |
| 33 chinese.setLocale(LayoutLocale::get("zh")); | 33 chinese.setLocale(LayoutLocale::get("zh")); |
| 34 | 34 |
| 35 if (FontFamilyNames::webkit_standard.isEmpty()) | 35 if (FontFamilyNames::webkit_standard.isEmpty()) |
| 36 FontFamilyNames::init(); | 36 FontFamilyNames::init(); |
| 37 | 37 |
| 38 // For non-CJK, getGenericFamilyNameForScript should return the given familyNa
me. | 38 // For non-CJK, getGenericFamilyNameForScript should return the given |
| 39 // familyName. |
| 39 EXPECT_EQ(FontFamilyNames::webkit_standard, | 40 EXPECT_EQ(FontFamilyNames::webkit_standard, |
| 40 FontCache::getGenericFamilyNameForScript( | 41 FontCache::getGenericFamilyNameForScript( |
| 41 FontFamilyNames::webkit_standard, english)); | 42 FontFamilyNames::webkit_standard, english)); |
| 42 EXPECT_EQ(FontFamilyNames::webkit_monospace, | 43 EXPECT_EQ(FontFamilyNames::webkit_monospace, |
| 43 FontCache::getGenericFamilyNameForScript( | 44 FontCache::getGenericFamilyNameForScript( |
| 44 FontFamilyNames::webkit_monospace, english)); | 45 FontFamilyNames::webkit_monospace, english)); |
| 45 | 46 |
| 46 // For CJK, getGenericFamilyNameForScript should return CJK fonts except monos
pace. | 47 // For CJK, getGenericFamilyNameForScript should return CJK fonts except |
| 48 // monospace. |
| 47 EXPECT_NE(FontFamilyNames::webkit_standard, | 49 EXPECT_NE(FontFamilyNames::webkit_standard, |
| 48 FontCache::getGenericFamilyNameForScript( | 50 FontCache::getGenericFamilyNameForScript( |
| 49 FontFamilyNames::webkit_standard, chinese)); | 51 FontFamilyNames::webkit_standard, chinese)); |
| 50 EXPECT_EQ(FontFamilyNames::webkit_monospace, | 52 EXPECT_EQ(FontFamilyNames::webkit_monospace, |
| 51 FontCache::getGenericFamilyNameForScript( | 53 FontCache::getGenericFamilyNameForScript( |
| 52 FontFamilyNames::webkit_monospace, chinese)); | 54 FontFamilyNames::webkit_monospace, chinese)); |
| 53 } | 55 } |
| 54 | 56 |
| 55 } // namespace blink | 57 } // namespace blink |
| OLD | NEW |