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

Side by Side Diff: chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc

Issue 3112015: Customize Hebrew spellcheck word break iterator... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_worditerator.cc ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 21 matching lines...) Expand all
32 // Numbers 32 // Numbers
33 L"0123456789" 33 L"0123456789"
34 // Latin (including a contraction character and a ligature). 34 // Latin (including a contraction character and a ligature).
35 L"hello:hello a\xFB03x" 35 L"hello:hello a\xFB03x"
36 // Greek 36 // Greek
37 L"\x03B3\x03B5\x03B9\x03AC\x0020\x03C3\x03BF\x03C5" 37 L"\x03B3\x03B5\x03B9\x03AC\x0020\x03C3\x03BF\x03C5"
38 // Cyrillic 38 // Cyrillic
39 L"\x0437\x0434\x0440\x0430\x0432\x0441\x0442\x0432" 39 L"\x0437\x0434\x0440\x0430\x0432\x0441\x0442\x0432"
40 L"\x0443\x0439\x0442\x0435" 40 L"\x0443\x0439\x0442\x0435"
41 // Hebrew (including niqquds) 41 // Hebrew (including niqquds)
42 L"\x05e9\x05c1\x05b8\x05dc\x05d5\x05b9\x05dd" 42 L"\x05e9\x05c1\x05b8\x05dc\x05d5\x05b9\x05dd "
43 // Hebrew words with U+0027 and U+05F3
44 L"\x05e6\x0027\x05d9\x05e4\x05e1 \x05e6\x05F3\x05d9\x05e4\x05e1 "
45 // Hebrew words with U+0022 and U+05F4
46 L"\x05e6\x05d4\x0022\x05dc \x05e6\x05d4\x05f4\x05dc "
47 // Hebrew words enclosed with ASCII quotes.
48 L"\"\x05e6\x05d4\x0022\x05dc\" '\x05e9\x05c1\x05b8\x05dc\x05d5'"
43 // Arabic (including vowel marks) 49 // Arabic (including vowel marks)
44 L"\x0627\x064e\x0644\x0633\x064e\x0651\x0644\x0627" 50 L"\x0627\x064e\x0644\x0633\x064e\x0651\x0644\x0627"
45 L"\x0645\x064f\x0020\x0639\x064e\x0644\x064e\x064a" 51 L"\x0645\x064f\x0020\x0639\x064e\x0644\x064e\x064a"
46 L"\x0652\x0643\x064f\x0645\x0652" 52 L"\x0652\x0643\x064f\x0645\x0652"
47 // Hindi 53 // Hindi
48 L"\x0930\x093E\x091C\x0927\x093E\x0928" 54 L"\x0930\x093E\x091C\x0927\x093E\x0928"
49 // Thai 55 // Thai
50 L"\x0e2a\x0e27\x0e31\x0e2a\x0e14\x0e35\x0020\x0e04" 56 L"\x0e2a\x0e27\x0e31\x0e2a\x0e14\x0e35\x0020\x0e04"
51 L"\x0e23\x0e31\x0e1a" 57 L"\x0e23\x0e31\x0e1a"
52 // Hiraganas 58 // Hiraganas
53 L"\x3053\x3093\x306B\x3061\x306F" 59 L"\x3053\x3093\x306B\x3061\x306F"
54 // CJKV ideographs 60 // CJKV ideographs
55 L"\x4F60\x597D" 61 L"\x4F60\x597D"
56 // Hangul Syllables 62 // Hangul Syllables
57 L"\xC548\xB155\xD558\xC138\xC694" 63 L"\xC548\xB155\xD558\xC138\xC694"
58 // Full-width latin 64 // Full-width latin : Hello
59 L"\xFF28\xFF45\xFF4C\xFF4C\xFF4F"; 65 L"\xFF28\xFF45\xFF4C\xFF4C\xFF4F "
66 L"e.g.,";
60 67
61 // The languages and expected results used in this test. 68 // The languages and expected results used in this test.
62 static const TestCase kTestCases[] = { 69 static const TestCase kTestCases[] = {
63 { 70 {
64 // English (keep contraction words) 71 // English (keep contraction words)
65 "en-US", true, L"hello:hello affix Hello" 72 "en-US", true, L"hello:hello affix Hello e.g"
66 }, { 73 }, {
67 // English (split contraction words) 74 // English (split contraction words)
68 "en-US", false, L"hello hello affix Hello" 75 "en-US", false, L"hello hello affix Hello e g"
69 }, { 76 }, {
70 // Greek 77 // Greek
71 "el-GR", true, 78 "el-GR", true,
72 L"\x03B3\x03B5\x03B9\x03AC\x0020\x03C3\x03BF\x03C5" 79 L"\x03B3\x03B5\x03B9\x03AC\x0020\x03C3\x03BF\x03C5"
73 }, { 80 }, {
74 // Russian 81 // Russian
75 "ru-RU", true, 82 "ru-RU", true,
76 L"\x0437\x0434\x0440\x0430\x0432\x0441\x0442\x0432" 83 L"\x0437\x0434\x0440\x0430\x0432\x0441\x0442\x0432"
77 L"\x0443\x0439\x0442\x0435" 84 L"\x0443\x0439\x0442\x0435"
78 }, { 85 }, {
79 // Hebrew 86 // Hebrew
80 "he-IL", true, 87 "he-IL", true,
81 L"\x05e9\x05dc\x05d5\x05dd" 88 L"\x05e9\x05dc\x05d5\x05dd "
89 L"\x05e6\x0027\x05d9\x05e4\x05e1 \x05e6\x05F3\x05d9\x05e4\x05e1 "
90 L"\x05e6\x05d4\x0022\x05dc \x05e6\x05d4\x05f4\x05dc "
91 L"\x05e6\x05d4\x0022\x05dc \x05e9\x05dc\x05d5"
82 }, { 92 }, {
83 // Arabic 93 // Arabic
84 "ar", true, 94 "ar", true,
85 L"\x0627\x0644\x0633\x0644\x0627\x0645\x0020\x0639" 95 L"\x0627\x0644\x0633\x0644\x0627\x0645\x0020\x0639"
86 L"\x0644\x064a\x0643\x0645" 96 L"\x0644\x064a\x0643\x0645"
87 }, { 97 }, {
88 // Hindi 98 // Hindi
89 "hi-IN", true, 99 "hi-IN", true,
90 L"\x0930\x093E\x091C\x0927\x093E\x0928" 100 L"\x0930\x093E\x091C\x0927\x093E\x0928"
91 }, { 101 }, {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 155
146 // When SpellcheckWordIterator uses an inconsistent ICU ruleset, the following 156 // When SpellcheckWordIterator uses an inconsistent ICU ruleset, the following
147 // iterator.GetNextWord() call gets stuck in an infinite loop. Therefore, this 157 // iterator.GetNextWord() call gets stuck in an infinite loop. Therefore, this
148 // test succeeds if this call returns without timeouts. 158 // test succeeds if this call returns without timeouts.
149 string16 actual_word; 159 string16 actual_word;
150 int actual_start, actual_end; 160 int actual_start, actual_end;
151 EXPECT_FALSE(iterator.GetNextWord(&actual_word, &actual_start, &actual_end)); 161 EXPECT_FALSE(iterator.GetNextWord(&actual_word, &actual_start, &actual_end));
152 EXPECT_EQ(0, actual_start); 162 EXPECT_EQ(0, actual_start);
153 EXPECT_EQ(0, actual_end); 163 EXPECT_EQ(0, actual_end);
154 } 164 }
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_worditerator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698