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 "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 Loading... |
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 |
OLD | NEW |