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

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

Issue 10889002: Reset word iterators when changing the spellchecker language. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck.cc ('k') | chrome/renderer/spellchecker/spellcheck_worditerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/spellchecker/spellcheck_unittest.cc
===================================================================
--- chrome/renderer/spellchecker/spellcheck_unittest.cc (revision 153594)
+++ chrome/renderer/spellchecker/spellcheck_unittest.cc (working copy)
@@ -793,6 +793,55 @@
}
}
+// Verify that our SpellCheck::SpellCheckWord() returns false when it checks
+// misspelled words.
+TEST_F(SpellCheckTest, MisspelledWords) {
+ static const struct {
+ const char* language;
+ const wchar_t* input;
+ } kTestCases[] = {
+ {
+ // A misspelled word for English
+ "en-US",
+ L"aaaaaaaaaa",
+ }, {
+ // A misspelled word for Greek.
+ "el-GR",
+ L"\x03B1\x03B1\x03B1\x03B1\x03B1\x03B1\x03B1\x03B1\x03B1\x03B1",
+ }, {
+ // A misspelled word for Hebrew
+ "he-IL",
+ L"\x05D0\x05D0\x05D0\x05D0\x05D0\x05D0\x05D0\x05D0\x05D0\x05D0",
+ }, {
+ // Hindi
+ "hi-IN",
+ L"\x0905\x0905\x0905\x0905\x0905\x0905\x0905\x0905\x0905\x0905",
+ }, {
+ // A misspelled word for Russian
+ "ru-RU",
+ L"\x0430\x0430\x0430\x0430\x0430\x0430\x0430\x0430\x0430\x0430",
+ },
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
+ ReinitializeSpellCheck(kTestCases[i].language);
+
+ string16 word(WideToUTF16(kTestCases[i].input));
+ int word_length = static_cast<int>(word.length());
+ int misspelling_start = 0;
+ int misspelling_length = 0;
+ bool result = spell_check()->SpellCheckWord(word.c_str(),
+ word_length,
+ 0,
+ &misspelling_start,
+ &misspelling_length,
+ NULL);
+ EXPECT_FALSE(result);
+ EXPECT_EQ(0, misspelling_start);
+ EXPECT_EQ(word_length, misspelling_length);
+ }
+}
+
// Since SpellCheck::SpellCheckParagraph is not implemented on Mac,
// we skip these SpellCheckParagraph tests on Mac.
#if !defined(OS_MACOSX)
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck.cc ('k') | chrome/renderer/spellchecker/spellcheck_worditerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698