| 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 "platform/Logging.h" | 7 #include "platform/Logging.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 23 matching lines...) Expand all Loading... |
| 34 // Test combinations of BCP 47 locales. | 34 // Test combinations of BCP 47 locales. |
| 35 // https://tools.ietf.org/html/bcp47 | 35 // https://tools.ietf.org/html/bcp47 |
| 36 struct { | 36 struct { |
| 37 const char* locale; | 37 const char* locale; |
| 38 UScriptCode script; | 38 UScriptCode script; |
| 39 bool hasScriptForHan; | 39 bool hasScriptForHan; |
| 40 UScriptCode scriptForHan; | 40 UScriptCode scriptForHan; |
| 41 } tests[] = { | 41 } tests[] = { |
| 42 { "en-US", USCRIPT_LATIN }, | 42 { "en-US", USCRIPT_LATIN }, |
| 43 | 43 |
| 44 // Common lang-script. |
| 45 { "en-Latn", USCRIPT_LATIN }, |
| 46 { "ar-Arab", USCRIPT_ARABIC }, |
| 47 |
| 44 // Common lang-region in East Asia. | 48 // Common lang-region in East Asia. |
| 45 { "ja-JP", USCRIPT_KATAKANA_OR_HIRAGANA, true }, | 49 { "ja-JP", USCRIPT_KATAKANA_OR_HIRAGANA, true }, |
| 46 { "ko-KR", USCRIPT_HANGUL, true }, | 50 { "ko-KR", USCRIPT_HANGUL, true }, |
| 47 { "zh", USCRIPT_SIMPLIFIED_HAN, true }, | 51 { "zh", USCRIPT_SIMPLIFIED_HAN, true }, |
| 48 { "zh-CN", USCRIPT_SIMPLIFIED_HAN, true }, | 52 { "zh-CN", USCRIPT_SIMPLIFIED_HAN, true }, |
| 49 { "zh-HK", USCRIPT_TRADITIONAL_HAN, true }, | 53 { "zh-HK", USCRIPT_TRADITIONAL_HAN, true }, |
| 50 { "zh-MO", USCRIPT_TRADITIONAL_HAN, true }, | 54 { "zh-MO", USCRIPT_TRADITIONAL_HAN, true }, |
| 51 { "zh-SG", USCRIPT_SIMPLIFIED_HAN, true }, | 55 { "zh-SG", USCRIPT_SIMPLIFIED_HAN, true }, |
| 52 { "zh-TW", USCRIPT_TRADITIONAL_HAN, true }, | 56 { "zh-TW", USCRIPT_TRADITIONAL_HAN, true }, |
| 53 | 57 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (!test.hasScriptForHan) | 107 if (!test.hasScriptForHan) |
| 104 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->scriptForHan()) << test.lo
cale; | 108 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->scriptForHan()) << test.lo
cale; |
| 105 else if (test.scriptForHan) | 109 else if (test.scriptForHan) |
| 106 EXPECT_EQ(test.scriptForHan, locale->scriptForHan()) << test.locale; | 110 EXPECT_EQ(test.scriptForHan, locale->scriptForHan()) << test.locale; |
| 107 else | 111 else |
| 108 EXPECT_EQ(test.script, locale->scriptForHan()) << test.locale; | 112 EXPECT_EQ(test.script, locale->scriptForHan()) << test.locale; |
| 109 } | 113 } |
| 110 } | 114 } |
| 111 | 115 |
| 112 } // namespace blink | 116 } // namespace blink |
| OLD | NEW |