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

Unified Diff: chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc

Issue 1092243002: Handle typographical apostrophe with spelling service client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: base::char16 Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc
diff --git a/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc b/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc
index d45470cd2ffdba0737134cf875a61374580fa37d..491a8f2d23bc9bd973217c51a5b2dee00652821a 100644
--- a/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc
+++ b/chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc
@@ -229,6 +229,54 @@ TEST(SpellcheckWordIteratorTest, TreatNumbersAsWordCharacters) {
}
}
+// Vertify SpellcheckWordIterator treats typographical apostrophe as a part of
+// the word.
+TEST(SpellcheckWordIteratorTest, TypographicalApostropheIsPartOfWord) {
+ static const struct {
+ const char* language;
+ const wchar_t* word;
+ } kTestCases[] = {
+ // Typewriter apostrophe:
+ {
+ "en-AU", L"you're"
+ }, {
+ "en-CA", L"you're"
+ }, {
+ "en-GB", L"you're"
+ }, {
+ "en-US", L"you're"
+ },
+ // Typographical apostrophe:
+ {
+ "en-AU", L"you\x2019re"
+ }, {
+ "en-CA", L"you\x2019re"
+ }, {
+ "en-GB", L"you\x2019re"
+ }, {
+ "en-US", L"you\x2019re"
+ },
+ };
+
+ for (size_t i = 0; i < arraysize(kTestCases); ++i) {
+ SpellcheckCharAttribute attributes;
+ attributes.SetDefaultLanguage(kTestCases[i].language);
+
+ base::string16 input_word(base::WideToUTF16(kTestCases[i].word));
+ SpellcheckWordIterator iterator;
+ EXPECT_TRUE(iterator.Initialize(&attributes, true));
+ EXPECT_TRUE(iterator.SetText(input_word.c_str(), input_word.length()));
+
+ base::string16 actual_word;
+ int actual_start, actual_end;
+ EXPECT_TRUE(iterator.GetNextWord(&actual_word, &actual_start, &actual_end));
+ EXPECT_EQ(input_word, actual_word);
+ EXPECT_EQ(0, actual_start);
+ EXPECT_EQ(input_word.length(),
+ static_cast<base::string16::size_type>(actual_end));
+ }
+}
+
TEST(SpellcheckWordIteratorTest, Initialization) {
// Test initialization works when a default language is set.
{
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698