xref: /aosp_15_r20/frameworks/minikin/tests/unittest/HyphenatorTest.cpp (revision 834a2baab5fdfc28e9a428ee87c7ea8f6a06a53d)
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <gtest/gtest.h>
18 
19 #include "FeatureFlags.h"
20 #include "FileUtils.h"
21 #include "minikin/Hyphenator.h"
22 
23 #ifndef NELEM
24 #define NELEM(x) ((sizeof(x) / sizeof((x)[0])))
25 #endif
26 
27 namespace minikin {
28 
29 const char* usHyph = "/system/usr/hyphen-data/hyph-en-us.hyb";
30 const char* ptHyph = "/system/usr/hyphen-data/hyph-pt.hyb";
31 const char* malayalamHyph = "/system/usr/hyphen-data/hyph-ml.hyb";
32 
33 const uint16_t HYPHEN_MINUS = 0x002D;
34 const uint16_t SOFT_HYPHEN = 0x00AD;
35 const uint16_t MIDDLE_DOT = 0x00B7;
36 const uint16_t GREEK_LOWER_ALPHA = 0x03B1;
37 const uint16_t ARMENIAN_AYB = 0x0531;
38 const uint16_t HEBREW_ALEF = 0x05D0;
39 const uint16_t ARABIC_ALEF = 0x0627;
40 const uint16_t ARABIC_BEH = 0x0628;
41 const uint16_t ARABIC_ZWARAKAY = 0x0659;
42 const uint16_t MALAYALAM_KA = 0x0D15;
43 const uint16_t UCAS_E = 0x1401;
44 const uint16_t HYPHEN = 0x2010;
45 const uint16_t EN_DASH = 0x2013;
46 
47 typedef std::function<Hyphenator*(const uint8_t*, size_t, size_t, size_t, const std::string&)>
48         Generator;
49 
50 class HyphenatorTest : public testing::TestWithParam<Generator> {};
51 
52 INSTANTIATE_TEST_SUITE_P(HyphenatorInstantiation, HyphenatorTest,
53                          testing::Values(HyphenatorCXX::loadBinary, Hyphenator::loadBinaryForRust),
__anon3b361fc70102(const testing::TestParamInfo<HyphenatorTest::ParamType>& info) 54                          [](const testing::TestParamInfo<HyphenatorTest::ParamType>& info) {
55                              switch (info.index) {
56                                  case 0:
57                                      return "CXX";
58                                  case 1:
59                                      return "Rust";
60                                  default:
61                                      return "Unknown";
62                              }
63                          });
64 
65 // Simple test for US English. This tests "table", which happens to be the in the exceptions list.
TEST_P(HyphenatorTest,usEnglishAutomaticHyphenation)66 TEST_P(HyphenatorTest, usEnglishAutomaticHyphenation) {
67     std::vector<uint8_t> patternData = readWholeFile(usHyph);
68     Hyphenator* hyphenator = GetParam()(patternData.data(), patternData.size(), 2, 3, "en");
69     const uint16_t word[] = {'t', 'a', 'b', 'l', 'e'};
70     std::vector<HyphenationType> result;
71     hyphenator->hyphenate(word, &result);
72     EXPECT_EQ((size_t)5, result.size());
73     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
74     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
75     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[2]);
76     EXPECT_EQ(HyphenationType::DONT_BREAK, result[3]);
77     EXPECT_EQ(HyphenationType::DONT_BREAK, result[4]);
78 }
79 
80 // Catalan l·l should break as l-/l
TEST_P(HyphenatorTest,catalanMiddleDot)81 TEST_P(HyphenatorTest, catalanMiddleDot) {
82     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "ca");
83     const uint16_t word[] = {'l', 'l', MIDDLE_DOT, 'l', 'l'};
84     std::vector<HyphenationType> result;
85     hyphenator->hyphenate(word, &result);
86     EXPECT_EQ((size_t)5, result.size());
87     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
88     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
89     EXPECT_EQ(HyphenationType::DONT_BREAK, result[2]);
90     EXPECT_EQ(HyphenationType::BREAK_AND_REPLACE_WITH_HYPHEN, result[3]);
91     EXPECT_EQ(HyphenationType::DONT_BREAK, result[4]);
92 }
93 
94 // Catalan l·l should not break if the word is too short.
TEST_P(HyphenatorTest,catalanMiddleDotShortWord)95 TEST_P(HyphenatorTest, catalanMiddleDotShortWord) {
96     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "ca");
97     const uint16_t word[] = {'l', MIDDLE_DOT, 'l'};
98     std::vector<HyphenationType> result;
99     hyphenator->hyphenate(word, &result);
100     EXPECT_EQ((size_t)3, result.size());
101     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
102     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
103     EXPECT_EQ(HyphenationType::DONT_BREAK, result[2]);
104 }
105 
106 // If we break on a hyphen in Polish, the hyphen should be repeated on the next line.
TEST_P(HyphenatorTest,polishHyphen)107 TEST_P(HyphenatorTest, polishHyphen) {
108     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "pl");
109     const uint16_t word[] = {'x', HYPHEN, 'y'};
110     std::vector<HyphenationType> result;
111     hyphenator->hyphenate(word, &result);
112     EXPECT_EQ((size_t)3, result.size());
113     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
114     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
115     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN_AT_NEXT_LINE, result[2]);
116 }
117 
118 // If the language is Polish but the script is not Latin, don't use Polish rules for hyphenation.
TEST_P(HyphenatorTest,polishHyphenButNonLatinWord)119 TEST_P(HyphenatorTest, polishHyphenButNonLatinWord) {
120     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "pl");
121     const uint16_t word[] = {GREEK_LOWER_ALPHA, HYPHEN, GREEK_LOWER_ALPHA};
122     std::vector<HyphenationType> result;
123     hyphenator->hyphenate(word, &result);
124     EXPECT_EQ((size_t)3, result.size());
125     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
126     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
127     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[2]);
128 }
129 
130 // Polish en dash doesn't repeat on next line (as far as we know), but just provides a break
131 // opportunity.
TEST_P(HyphenatorTest,polishEnDash)132 TEST_P(HyphenatorTest, polishEnDash) {
133     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "pl");
134     const uint16_t word[] = {'x', EN_DASH, 'y'};
135     std::vector<HyphenationType> result;
136     hyphenator->hyphenate(word, &result);
137     EXPECT_EQ((size_t)3, result.size());
138     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
139     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
140     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[2]);
141 }
142 
143 // If we break on a hyphen in Slovenian, the hyphen should be repeated on the next line. (Same as
144 // Polish.)
TEST_P(HyphenatorTest,slovenianHyphen)145 TEST_P(HyphenatorTest, slovenianHyphen) {
146     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "sl");
147     const uint16_t word[] = {'x', HYPHEN, 'y'};
148     std::vector<HyphenationType> result;
149     hyphenator->hyphenate(word, &result);
150     EXPECT_EQ((size_t)3, result.size());
151     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
152     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
153     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN_AT_NEXT_LINE, result[2]);
154 }
155 
156 // In Latin script text, soft hyphens should insert a visible hyphen if broken at.
TEST_P(HyphenatorTest,latinSoftHyphen)157 TEST_P(HyphenatorTest, latinSoftHyphen) {
158     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
159     const uint16_t word[] = {'x', SOFT_HYPHEN, 'y'};
160     std::vector<HyphenationType> result;
161     hyphenator->hyphenate(word, &result);
162     EXPECT_EQ((size_t)3, result.size());
163     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
164     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
165     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[2]);
166 }
167 
168 // Soft hyphens at the beginning of a word are not useful in linebreaking.
TEST_P(HyphenatorTest,latinSoftHyphenStartingTheWord)169 TEST_P(HyphenatorTest, latinSoftHyphenStartingTheWord) {
170     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
171     const uint16_t word[] = {SOFT_HYPHEN, 'y'};
172     std::vector<HyphenationType> result;
173     hyphenator->hyphenate(word, &result);
174     EXPECT_EQ((size_t)2, result.size());
175     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
176     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
177 }
178 
179 // In Malayalam script text, soft hyphens should not insert a visible hyphen if broken at.
TEST_P(HyphenatorTest,malayalamSoftHyphen)180 TEST_P(HyphenatorTest, malayalamSoftHyphen) {
181     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
182     const uint16_t word[] = {MALAYALAM_KA, SOFT_HYPHEN, MALAYALAM_KA};
183     std::vector<HyphenationType> result;
184     hyphenator->hyphenate(word, &result);
185     EXPECT_EQ((size_t)3, result.size());
186     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
187     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
188     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[2]);
189 }
190 
191 // In automatically hyphenated Malayalam script text, we should not insert a visible hyphen.
TEST_P(HyphenatorTest,malayalamAutomaticHyphenation)192 TEST_P(HyphenatorTest, malayalamAutomaticHyphenation) {
193     std::vector<uint8_t> patternData = readWholeFile(malayalamHyph);
194     Hyphenator* hyphenator = GetParam()(patternData.data(), patternData.size(), 2, 2, "en");
195     const uint16_t word[] = {MALAYALAM_KA, MALAYALAM_KA, MALAYALAM_KA, MALAYALAM_KA, MALAYALAM_KA};
196     std::vector<HyphenationType> result;
197     hyphenator->hyphenate(word, &result);
198     EXPECT_EQ((size_t)5, result.size());
199     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
200     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
201     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[2]);
202     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[3]);
203     EXPECT_EQ(HyphenationType::DONT_BREAK, result[4]);
204 }
205 
206 // In Armenian script text, soft hyphens should insert an Armenian hyphen if broken at.
TEST_P(HyphenatorTest,aremenianSoftHyphen)207 TEST_P(HyphenatorTest, aremenianSoftHyphen) {
208     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
209     const uint16_t word[] = {ARMENIAN_AYB, SOFT_HYPHEN, ARMENIAN_AYB};
210     std::vector<HyphenationType> result;
211     hyphenator->hyphenate(word, &result);
212     EXPECT_EQ((size_t)3, result.size());
213     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
214     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
215     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_ARMENIAN_HYPHEN, result[2]);
216 }
217 
218 // In Hebrew script text, soft hyphens should insert a normal hyphen if broken at, for now.
219 // We may need to change this to maqaf later.
TEST_P(HyphenatorTest,hebrewSoftHyphen)220 TEST_P(HyphenatorTest, hebrewSoftHyphen) {
221     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
222     const uint16_t word[] = {HEBREW_ALEF, SOFT_HYPHEN, HEBREW_ALEF};
223     std::vector<HyphenationType> result;
224     hyphenator->hyphenate(word, &result);
225     EXPECT_EQ((size_t)3, result.size());
226     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
227     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
228     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[2]);
229 }
230 
231 // Soft hyphen between two Arabic letters that join should keep the joining
232 // behavior when broken across lines.
TEST_P(HyphenatorTest,arabicSoftHyphenConnecting)233 TEST_P(HyphenatorTest, arabicSoftHyphenConnecting) {
234     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
235     const uint16_t word[] = {ARABIC_BEH, SOFT_HYPHEN, ARABIC_BEH};
236     std::vector<HyphenationType> result;
237     hyphenator->hyphenate(word, &result);
238     EXPECT_EQ((size_t)3, result.size());
239     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
240     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
241     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN_AND_ZWJ, result[2]);
242 }
243 
244 // Arabic letters may be joining on one side, but if it's the wrong side, we
245 // should use the normal hyphen.
TEST_P(HyphenatorTest,arabicSoftHyphenNonConnecting)246 TEST_P(HyphenatorTest, arabicSoftHyphenNonConnecting) {
247     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
248     const uint16_t word[] = {ARABIC_ALEF, SOFT_HYPHEN, ARABIC_BEH};
249     std::vector<HyphenationType> result;
250     hyphenator->hyphenate(word, &result);
251     EXPECT_EQ((size_t)3, result.size());
252     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
253     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
254     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[2]);
255 }
256 
257 // Skip transparent characters until you find a non-transparent one.
TEST_P(HyphenatorTest,arabicSoftHyphenSkipTransparents)258 TEST_P(HyphenatorTest, arabicSoftHyphenSkipTransparents) {
259     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
260     const uint16_t word[] = {ARABIC_BEH, ARABIC_ZWARAKAY, SOFT_HYPHEN, ARABIC_ZWARAKAY, ARABIC_BEH};
261     std::vector<HyphenationType> result;
262     hyphenator->hyphenate(word, &result);
263     EXPECT_EQ((size_t)5, result.size());
264     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
265     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
266     EXPECT_EQ(HyphenationType::DONT_BREAK, result[2]);
267     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN_AND_ZWJ, result[3]);
268     EXPECT_EQ(HyphenationType::DONT_BREAK, result[4]);
269 }
270 
271 // Skip transparent characters until you find a non-transparent one. If we get to one end without
272 // finding anything, we are still non-joining.
TEST_P(HyphenatorTest,arabicSoftHyphenTransparentsAtEnd)273 TEST_P(HyphenatorTest, arabicSoftHyphenTransparentsAtEnd) {
274     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
275     const uint16_t word[] = {ARABIC_BEH, ARABIC_ZWARAKAY, SOFT_HYPHEN, ARABIC_ZWARAKAY};
276     std::vector<HyphenationType> result;
277     hyphenator->hyphenate(word, &result);
278     EXPECT_EQ((size_t)4, result.size());
279     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
280     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
281     EXPECT_EQ(HyphenationType::DONT_BREAK, result[2]);
282     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[3]);
283 }
284 
285 // Skip transparent characters until you find a non-transparent one. If we get to one end without
286 // finding anything, we are still non-joining.
TEST_P(HyphenatorTest,arabicSoftHyphenTransparentsAtStart)287 TEST_P(HyphenatorTest, arabicSoftHyphenTransparentsAtStart) {
288     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
289     const uint16_t word[] = {ARABIC_ZWARAKAY, SOFT_HYPHEN, ARABIC_ZWARAKAY, ARABIC_BEH};
290     std::vector<HyphenationType> result;
291     hyphenator->hyphenate(word, &result);
292     EXPECT_EQ((size_t)4, result.size());
293     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
294     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
295     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[2]);
296     EXPECT_EQ(HyphenationType::DONT_BREAK, result[3]);
297 }
298 
299 // In Unified Canadian Aboriginal script (UCAS) text, soft hyphens should insert a UCAS hyphen.
TEST_P(HyphenatorTest,ucasSoftHyphen)300 TEST_P(HyphenatorTest, ucasSoftHyphen) {
301     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
302     const uint16_t word[] = {UCAS_E, SOFT_HYPHEN, UCAS_E};
303     std::vector<HyphenationType> result;
304     hyphenator->hyphenate(word, &result);
305     EXPECT_EQ((size_t)3, result.size());
306     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
307     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
308     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_UCAS_HYPHEN, result[2]);
309 }
310 
311 // Presently, soft hyphen looks at the character after it to determine hyphenation type. This is a
312 // little arbitrary, but let's test it anyway.
TEST_P(HyphenatorTest,mixedScriptSoftHyphen)313 TEST_P(HyphenatorTest, mixedScriptSoftHyphen) {
314     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
315     const uint16_t word[] = {'a', SOFT_HYPHEN, UCAS_E};
316     std::vector<HyphenationType> result;
317     hyphenator->hyphenate(word, &result);
318     EXPECT_EQ((size_t)3, result.size());
319     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
320     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
321     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_UCAS_HYPHEN, result[2]);
322 }
323 
324 // Hard hyphens provide a breaking opportunity with nothing extra inserted.
TEST_P(HyphenatorTest,hardHyphen)325 TEST_P(HyphenatorTest, hardHyphen) {
326     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
327     const uint16_t word[] = {'x', HYPHEN, 'y'};
328     std::vector<HyphenationType> result;
329     hyphenator->hyphenate(word, &result);
330     EXPECT_EQ((size_t)3, result.size());
331     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
332     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
333     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[2]);
334 }
335 
336 // Hyphen-minuses also provide a breaking opportunity with nothing extra inserted.
TEST_P(HyphenatorTest,hyphenMinus)337 TEST_P(HyphenatorTest, hyphenMinus) {
338     Hyphenator* hyphenator = GetParam()(nullptr, 0, 2, 2, "en");
339     const uint16_t word[] = {'x', HYPHEN_MINUS, 'y'};
340     std::vector<HyphenationType> result;
341     hyphenator->hyphenate(word, &result);
342     EXPECT_EQ((size_t)3, result.size());
343     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
344     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
345     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[2]);
346 }
347 
348 // If the word starts with a hard hyphen or hyphen-minus, it doesn't make sense to break
349 // it at that point.
TEST_P(HyphenatorTest,startingHyphenMinus)350 TEST_P(HyphenatorTest, startingHyphenMinus) {
351     Hyphenator* hyphenator = Hyphenator::loadBinary(nullptr, 0, 2, 2, "en");
352     const uint16_t word[] = {HYPHEN_MINUS, 'y'};
353     std::vector<HyphenationType> result;
354     hyphenator->hyphenate(word, &result);
355     EXPECT_EQ((size_t)2, result.size());
356     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
357     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
358 }
359 
TEST_P(HyphenatorTest,hyphenationWithHyphen)360 TEST_P(HyphenatorTest, hyphenationWithHyphen) {
361     std::vector<uint8_t> patternData = readWholeFile(ptHyph);
362     Hyphenator* hyphenator = GetParam()(patternData.data(), patternData.size(), 2, 3, "pt");
363     const uint16_t word[] = {'b', 'o', 'a', 's', '-', 'v', 'i', 'n', 'd', 'a', 's'};
364     std::vector<HyphenationType> result;
365     hyphenator->hyphenate(word, &result);
366     EXPECT_EQ((size_t)11, result.size());
367     EXPECT_EQ(HyphenationType::DONT_BREAK, result[0]);
368     EXPECT_EQ(HyphenationType::DONT_BREAK, result[1]);
369     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[2]);
370     EXPECT_EQ(HyphenationType::DONT_BREAK, result[3]);
371     EXPECT_EQ(HyphenationType::BREAK_AND_DONT_INSERT_HYPHEN, result[4]);
372     EXPECT_EQ(HyphenationType::DONT_BREAK, result[5]);
373     EXPECT_EQ(HyphenationType::DONT_BREAK, result[6]);
374     EXPECT_EQ(HyphenationType::DONT_BREAK, result[7]);
375     EXPECT_EQ(HyphenationType::BREAK_AND_INSERT_HYPHEN, result[8]);
376     EXPECT_EQ(HyphenationType::DONT_BREAK, result[9]);
377     EXPECT_EQ(HyphenationType::DONT_BREAK, result[10]);
378     EXPECT_EQ(HyphenationType::DONT_BREAK, result[11]);
379 }
380 
381 }  // namespace minikin
382