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

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

Issue 11348019: Bump English spellcheck dictionary versions and add tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: roll DEPS Created 8 years, 2 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/common/spellcheck_common.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_unittest.cc
diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc
index e2fa05d4a4b9b3f13ff658a61fb5508003d24ca5..40333559d169ae006bec7febad7141a8d8b72885 100644
--- a/chrome/renderer/spellchecker/spellcheck_unittest.cc
+++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc
@@ -358,6 +358,7 @@ TEST_F(SpellCheckTest, SpellCheckStrings_EN_US) {
{L"2012", true},
{L"100,000,000", true},
{L"3.141592653", true},
+
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
@@ -1087,4 +1088,56 @@ TEST_F(SpellCheckTest, CreateTextCheckingResults) {
}
}
+// Checks some words that should be present in all English dictionaries.
+TEST_F(SpellCheckTest, EnglishWords) {
+ static const struct {
+ const char* input;
+ bool should_pass;
+ } kTestCases[] = {
+ // Issue 146093: "Chromebook" and "Chromebox" not included in spell-checking
+ // dictionary.
+ {"Chromebook", true},
+ {"Chromebooks", true},
+ {"Chromebox", true},
+ {"Chromeboxes", true},
+ {"Chromeblade", true},
+ {"Chromeblades", true},
+ {"Chromebase", true},
+ {"Chromebases", true},
+ // Issue 94708: Spell-checker incorrectly reports whisky as misspelled.
+ {"whisky", true},
+ {"whiskey", true},
+ {"whiskies", true},
+ // Issue 98678: "Recency" should be included in client-side dictionary.
+ {"recency", true},
+ {"recencies", false},
+ // Issue 140486
+ {"movie", true},
+ {"movies", true},
+ };
+
+ static const char* kLocales[] = { "en-GB", "en-US", "en-CA", "en-AU" };
+
+ for (size_t j = 0; j < arraysize(kLocales); ++j) {
+ ReinitializeSpellCheck(kLocales[j]);
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
+ size_t input_length = 0;
+ if (kTestCases[i].input != NULL)
+ input_length = strlen(kTestCases[i].input);
+
+ int misspelling_start = 0;
+ int misspelling_length = 0;
+ bool result = spell_check()->SpellCheckWord(
+ ASCIIToUTF16(kTestCases[i].input).c_str(),
+ static_cast<int>(input_length),
+ 0,
+ &misspelling_start,
+ &misspelling_length, NULL);
+
+ EXPECT_EQ(kTestCases[i].should_pass, result) << kTestCases[i].input <<
+ " in " << kLocales[j];
+ }
+ }
+}
+
#endif
« no previous file with comments | « chrome/common/spellcheck_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698