OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/LayoutLocale.h" | 5 #include "platform/LayoutLocale.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Region should not affect script, but it can influence scriptForHan. | 88 // Region should not affect script, but it can influence scriptForHan. |
89 {"en-CN", USCRIPT_LATIN, false}, | 89 {"en-CN", USCRIPT_LATIN, false}, |
90 {"en-HK", USCRIPT_LATIN, true, USCRIPT_TRADITIONAL_HAN}, | 90 {"en-HK", USCRIPT_LATIN, true, USCRIPT_TRADITIONAL_HAN}, |
91 {"en-MO", USCRIPT_LATIN, true, USCRIPT_TRADITIONAL_HAN}, | 91 {"en-MO", USCRIPT_LATIN, true, USCRIPT_TRADITIONAL_HAN}, |
92 {"en-SG", USCRIPT_LATIN, false}, | 92 {"en-SG", USCRIPT_LATIN, false}, |
93 {"en-TW", USCRIPT_LATIN, true, USCRIPT_TRADITIONAL_HAN}, | 93 {"en-TW", USCRIPT_LATIN, true, USCRIPT_TRADITIONAL_HAN}, |
94 {"en-JP", USCRIPT_LATIN, true, USCRIPT_KATAKANA_OR_HIRAGANA}, | 94 {"en-JP", USCRIPT_LATIN, true, USCRIPT_KATAKANA_OR_HIRAGANA}, |
95 {"en-KR", USCRIPT_LATIN, true, USCRIPT_HANGUL}, | 95 {"en-KR", USCRIPT_LATIN, true, USCRIPT_HANGUL}, |
96 | 96 |
97 // Multiple regions are invalid, but it can still give hints for the font
selection. | 97 // Multiple regions are invalid, but it can still give hints for the font |
| 98 // selection. |
98 {"en-US-JP", USCRIPT_LATIN, true, USCRIPT_KATAKANA_OR_HIRAGANA}, | 99 {"en-US-JP", USCRIPT_LATIN, true, USCRIPT_KATAKANA_OR_HIRAGANA}, |
99 }; | 100 }; |
100 | 101 |
101 for (const auto& test : tests) { | 102 for (const auto& test : tests) { |
102 RefPtr<LayoutLocale> locale = LayoutLocale::createForTesting(test.locale); | 103 RefPtr<LayoutLocale> locale = LayoutLocale::createForTesting(test.locale); |
103 EXPECT_EQ(test.script, locale->script()) << test.locale; | 104 EXPECT_EQ(test.script, locale->script()) << test.locale; |
104 EXPECT_EQ(test.hasScriptForHan, locale->hasScriptForHan()) << test.locale; | 105 EXPECT_EQ(test.hasScriptForHan, locale->hasScriptForHan()) << test.locale; |
105 if (!test.hasScriptForHan) | 106 if (!test.hasScriptForHan) |
106 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->scriptForHan()) << test.locale; | 107 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->scriptForHan()) << test.locale; |
107 else if (test.scriptForHan) | 108 else if (test.scriptForHan) |
108 EXPECT_EQ(test.scriptForHan, locale->scriptForHan()) << test.locale; | 109 EXPECT_EQ(test.scriptForHan, locale->scriptForHan()) << test.locale; |
109 else | 110 else |
110 EXPECT_EQ(test.script, locale->scriptForHan()) << test.locale; | 111 EXPECT_EQ(test.script, locale->scriptForHan()) << test.locale; |
111 } | 112 } |
112 } | 113 } |
113 | 114 |
114 } // namespace blink | 115 } // namespace blink |
OLD | NEW |