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

Side by Side Diff: third_party/WebKit/Source/platform/LayoutLocaleTest.cpp

Issue 2222283002: Fix scriptCodeForHanFromSubtags() may return non-Han scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/LayoutLocale.cpp ('k') | third_party/WebKit/Source/platform/fonts/FontDescription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698