summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-27 05:50:45 +0000
committerrouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-27 05:50:45 +0000
commitfbc5b7a2166d9e624e44f5b842a0879e91482bc3 (patch)
tree96922c903a3d103e7f5e07544be037e24783395e
parent0a0f800a7feb315e71db99d21a80165f44264259 (diff)
downloadchromium_src-fbc5b7a2166d9e624e44f5b842a0879e91482bc3.zip
chromium_src-fbc5b7a2166d9e624e44f5b842a0879e91482bc3.tar.gz
chromium_src-fbc5b7a2166d9e624e44f5b842a0879e91482bc3.tar.bz2
Add a unit test for Hunspell spellcheck
Chrome has been suggesting "Othello" for "hellllo" and "identically" for "accidently" because the Chrome version in Hunspell assumed that dictionaries contain at most one affix per entry. This CL adds a unit test that verifies Hunspell no longer has this erroneous assumption. BUG=170668 Review URL: https://chromiumcodereview.appspot.com/12334105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184890 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--chrome/renderer/spellchecker/spellcheck_unittest.cc27
2 files changed, 28 insertions, 1 deletions
diff --git a/DEPS b/DEPS
index c75a9ca..048f10d 100644
--- a/DEPS
+++ b/DEPS
@@ -85,7 +85,7 @@ deps = {
"/trunk/deps/third_party/libexif/sources@146817",
"src/third_party/hunspell":
- "/trunk/deps/third_party/hunspell@177853",
+ "/trunk/deps/third_party/hunspell@184822",
"src/third_party/hunspell_dictionaries":
"/trunk/deps/third_party/hunspell_dictionaries@175986",
diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc
index 8a443a63..f5a8dc1 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));
+ }
+}