Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: third_party/WebKit/Source/platform/text/LocaleToScriptMappingTest.cpp

Issue 2192703002: More LayoutLocale refactor with additional Chinese support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment updated as per drott review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "platform/text/LocaleToScriptMapping.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "wtf/text/WTFString.h"
9
10 namespace blink {
11
12 TEST(LocaleToScriptMappingTest, scriptCodeForHanFromLocaleTest)
13 {
14 struct {
15 const char* locale;
16 UScriptCode script;
17 } tests[] = {
18 { "ja-JP", USCRIPT_KATAKANA_OR_HIRAGANA },
19 { "ko-KR", USCRIPT_HANGUL },
20 { "zh-CN", USCRIPT_SIMPLIFIED_HAN },
21 { "zh-TW", USCRIPT_TRADITIONAL_HAN },
22 { "zh-HK", USCRIPT_TRADITIONAL_HAN },
23
24 // icu::Locale::getDefault() returns other combinations if, for instnace ,
25 // English Windows with the display language set to Japanese.
26 { "ja", USCRIPT_KATAKANA_OR_HIRAGANA },
27 { "ja-US", USCRIPT_KATAKANA_OR_HIRAGANA },
28 { "ko", USCRIPT_HANGUL },
29 { "ko-US", USCRIPT_HANGUL },
30
31 { "zh-hant", USCRIPT_TRADITIONAL_HAN },
32
33 { "en-CN", USCRIPT_SIMPLIFIED_HAN },
34 { "en-JP", USCRIPT_KATAKANA_OR_HIRAGANA },
35 { "en-KR", USCRIPT_HANGUL },
36 { "en-HK", USCRIPT_TRADITIONAL_HAN },
37 { "en-TW", USCRIPT_TRADITIONAL_HAN },
38
39 { "en-HanS", USCRIPT_SIMPLIFIED_HAN },
40 { "en-HanT", USCRIPT_TRADITIONAL_HAN },
41
42 { "en-HanS-JP", USCRIPT_SIMPLIFIED_HAN },
43 { "en-HanT-JP", USCRIPT_TRADITIONAL_HAN },
44 { "en-US-JP", USCRIPT_KATAKANA_OR_HIRAGANA },
45
46 { "en-US", USCRIPT_COMMON },
47 };
48
49 for (auto test : tests) {
50 String str(test.locale);
51 EXPECT_EQ(test.script, scriptCodeForHanFromLocale(str));
52
53 str = str.replace('-', '_');
54 EXPECT_EQ(test.script, scriptCodeForHanFromLocale(str, '_'));
55 }
56 }
57
58 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698