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

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

Issue 2815523002: Rename Script() returning UScriptCode to GetScript() (Closed)
Patch Set: Rebase Created 3 years, 8 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 "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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 97 // Multiple regions are invalid, but it can still give hints for the font
98 // selection. 98 // selection.
99 {"en-US-JP", USCRIPT_LATIN, true, USCRIPT_KATAKANA_OR_HIRAGANA}, 99 {"en-US-JP", USCRIPT_LATIN, true, USCRIPT_KATAKANA_OR_HIRAGANA},
100 }; 100 };
101 101
102 for (const auto& test : tests) { 102 for (const auto& test : tests) {
103 RefPtr<LayoutLocale> locale = LayoutLocale::CreateForTesting(test.locale); 103 RefPtr<LayoutLocale> locale = LayoutLocale::CreateForTesting(test.locale);
104 EXPECT_EQ(test.script, locale->Script()) << test.locale; 104 EXPECT_EQ(test.script, locale->GetScript()) << test.locale;
105 EXPECT_EQ(test.has_script_for_han, locale->HasScriptForHan()) 105 EXPECT_EQ(test.has_script_for_han, locale->HasScriptForHan())
106 << test.locale; 106 << test.locale;
107 if (!test.has_script_for_han) 107 if (!test.has_script_for_han) {
108 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->ScriptForHan()) << test.locale; 108 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->GetScriptForHan())
109 else if (test.script_for_han) 109 << test.locale;
110 EXPECT_EQ(test.script_for_han, locale->ScriptForHan()) << test.locale; 110 } else if (test.script_for_han) {
111 else 111 EXPECT_EQ(test.script_for_han, locale->GetScriptForHan()) << test.locale;
112 EXPECT_EQ(test.script, locale->ScriptForHan()) << test.locale; 112 } else {
113 EXPECT_EQ(test.script, locale->GetScriptForHan()) << test.locale;
114 }
113 } 115 }
114 } 116 }
115 117
116 TEST(LayoutLocaleTest, BreakKeyword) { 118 TEST(LayoutLocaleTest, BreakKeyword) {
117 struct { 119 struct {
118 const char* expected; 120 const char* expected;
119 const char* locale; 121 const char* locale;
120 LineBreakIteratorMode mode; 122 LineBreakIteratorMode mode;
121 } tests[] = { 123 } tests[] = {
122 {nullptr, nullptr, LineBreakIteratorMode::kDefault}, 124 {nullptr, nullptr, LineBreakIteratorMode::kDefault},
(...skipping 18 matching lines...) Expand all
141 "en@x=", "en@lb=xyz", "en@ =", 143 "en@x=", "en@lb=xyz", "en@ =",
142 }; 144 };
143 for (const auto& test : tests) { 145 for (const auto& test : tests) {
144 RefPtr<LayoutLocale> locale = LayoutLocale::CreateForTesting(test); 146 RefPtr<LayoutLocale> locale = LayoutLocale::CreateForTesting(test);
145 EXPECT_EQ(test, 147 EXPECT_EQ(test,
146 locale->LocaleWithBreakKeyword(LineBreakIteratorMode::kNormal)); 148 locale->LocaleWithBreakKeyword(LineBreakIteratorMode::kNormal));
147 } 149 }
148 } 150 }
149 151
150 } // namespace blink 152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698