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

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

Issue 12334105: Add a unit test for Hunspell spellcheck (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Bump hunspell dependency Created 7 years, 10 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 | « DEPS ('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_unittest.cc
diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc
index 8a443a63b63d18cd0f1c2b69e792dfd32fca12eb..f5a8dc19b442b614c9726ab56b5823e304028911 100644
--- a/chrome/renderer/spellchecker/spellcheck_unittest.cc
+++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc
@@ -1326,3 +1326,30 @@ TEST_F(SpellCheckTest, SpellingEngine_CheckSpelling) {
}
}
+// Chrome should not suggest "Othello" for "hellllo" or "identically" for
+// "accidently".
+TEST_F(SpellCheckTest, LogicalSuggestions) {
+ static const struct {
+ const char* misspelled;
+ const char* suggestion;
+ } kTestCases[] = {
+ { "hellllo", "hello" },
+ { "accidently", "accidentally" }
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
+ int misspelling_start = 0;
+ int misspelling_length = 0;
+ std::vector<string16> suggestions;
+ EXPECT_FALSE(spell_check()->SpellCheckWord(
+ ASCIIToUTF16(kTestCases[i].misspelled).c_str(),
+ strlen(kTestCases[i].misspelled),
+ 0,
+ &misspelling_start,
+ &misspelling_length,
+ &suggestions));
+ EXPECT_GE(suggestions.size(), static_cast<size_t>(1));
+ if (suggestions.size() > 0)
+ EXPECT_EQ(suggestions[0], ASCIIToUTF16(kTestCases[i].suggestion));
+ }
+}
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698