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

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

Issue 2715153003: Implement 'normal', 'strict', and 'loose' of the 'line-break' property (Closed)
Patch Set: Rebase Created 3 years, 9 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/LayoutLocale.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
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 EXPECT_EQ(test.hasScriptForHan, locale->hasScriptForHan()) << test.locale; 105 EXPECT_EQ(test.hasScriptForHan, locale->hasScriptForHan()) << test.locale;
106 if (!test.hasScriptForHan) 106 if (!test.hasScriptForHan)
107 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->scriptForHan()) << test.locale; 107 EXPECT_EQ(USCRIPT_SIMPLIFIED_HAN, locale->scriptForHan()) << test.locale;
108 else if (test.scriptForHan) 108 else if (test.scriptForHan)
109 EXPECT_EQ(test.scriptForHan, locale->scriptForHan()) << test.locale; 109 EXPECT_EQ(test.scriptForHan, locale->scriptForHan()) << test.locale;
110 else 110 else
111 EXPECT_EQ(test.script, locale->scriptForHan()) << test.locale; 111 EXPECT_EQ(test.script, locale->scriptForHan()) << test.locale;
112 } 112 }
113 } 113 }
114 114
115 TEST(LayoutLocaleTest, BreakKeyword) {
116 struct {
117 const char* expected;
118 const char* locale;
119 LineBreakIteratorMode mode;
120 } tests[] = {
121 {nullptr, nullptr, LineBreakIteratorMode::Default},
122 {"", "", LineBreakIteratorMode::Default},
123 {nullptr, nullptr, LineBreakIteratorMode::Strict},
124 {"", "", LineBreakIteratorMode::Strict},
125 {"ja", "ja", LineBreakIteratorMode::Default},
126 {"ja@lb=normal", "ja", LineBreakIteratorMode::Normal},
127 {"ja@lb=strict", "ja", LineBreakIteratorMode::Strict},
128 {"ja@lb=loose", "ja", LineBreakIteratorMode::Loose},
129 };
130 for (const auto& test : tests) {
131 RefPtr<LayoutLocale> locale = LayoutLocale::createForTesting(test.locale);
132 EXPECT_EQ(test.expected, locale->localeWithBreakKeyword(test.mode))
133 << String::format("'%s' with line-break %d should be '%s'", test.locale,
134 static_cast<int>(test.mode), test.expected);
135 }
136 }
137
115 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/LayoutLocale.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698