protected void SpellChecker_MisspelledWord(object sender, SpellingEventArgs e) { // Ignore macro content if (IsInMacro(e.TextIndex)) { SpellChecker.IgnoreWord(); SpellChecker.SpellCheck(); return; } SaveValues(); CurrentWord.Text = SpellChecker.CurrentWord; SpellChecker.Suggest(); Suggestions.DataSource = SpellChecker.Suggestions; Suggestions.DataBind(); if (Suggestions.Items.Count > 0) { Suggestions.SelectedIndex = 0; } ReplacementWord.Text = Suggestions.SelectedValue; SpellMode.Value = "suggest"; StatusText.Text = string.Format(wordCounterString, SpellChecker.WordIndex + 1, SpellChecker.WordCount); }
public void NoText() { Spelling _SpellChecker = NewSpellChecker(); Assert.AreEqual(string.Empty, _SpellChecker.CurrentWord, "Incorrect Current Word"); _SpellChecker.WordIndex = 1; Assert.AreEqual(0, _SpellChecker.WordIndex, "Incorrect Word Index"); Assert.AreEqual(0, _SpellChecker.WordCount, "Incorrect Word Count"); Assert.AreEqual(0, _SpellChecker.TextIndex, "Incorrect Text Index"); _SpellChecker.DeleteWord(); Assert.AreEqual(string.Empty, _SpellChecker.Text, "Incorrect Text"); _SpellChecker.IgnoreWord(); Assert.AreEqual(string.Empty, _SpellChecker.Text, "Incorrect Text"); _SpellChecker.ReplaceWord("Test"); Assert.AreEqual(string.Empty, _SpellChecker.Text, "Incorrect Text"); Assert.IsFalse(_SpellChecker.SpellCheck(), "Spell Check not false"); _SpellChecker.Suggest(); Assert.AreEqual(0, _SpellChecker.Suggestions.Count, "Generated Suggestions with no text"); }
public void IgnoreWord() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "this is an errr tst"; _SpellChecker.SpellCheck(); Assertion.AssertEquals("Incorrect WordOffset", 3, _SpellChecker.WordIndex); Assertion.AssertEquals("Incorrect CurrentWord", "errr", _SpellChecker.CurrentWord); _SpellChecker.IgnoreWord(); _SpellChecker.SpellCheck(); Assertion.AssertEquals("Incorrect WordOffset", 4, _SpellChecker.WordIndex); Assertion.AssertEquals("Incorrect CurrentWord", "tst", _SpellChecker.CurrentWord); }
public void IgnoreWord() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "this is an errr tst"; _SpellChecker.SpellCheck(); Assert.True(3 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("errr" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); _SpellChecker.IgnoreWord(); _SpellChecker.SpellCheck(); Assert.True(4 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("tst" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); }
private void IgnoreWordClick(object sender, EventArgs e) { _spelling.IgnoreWord(); CheckSpelling(); }
protected void IgnoreButton_Click(object sender, EventArgs e) { SpellChecker.IgnoreWord(); SpellChecker.SpellCheck(); }
public void TestEvents() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "ths is is a tst."; ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.AreEqual(0, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("ths", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.AreEqual(EventNames.MisspelledWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Event not fired"); Assert.AreEqual(0, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(0, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("ths", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.ReplaceWord("this"); //spelling check Assert.AreEqual("this is is a tst.", _SpellChecker.Text, "Incorrect Text"); // event check Assert.AreEqual(EventNames.ReplacedWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastReplaceEvent, "Null Event object fired"); Assert.AreEqual(0, _lastReplaceEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(0, _lastReplaceEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("ths", _lastReplaceEvent.Word, "Incorrect Event Word"); Assert.AreEqual("this", _lastReplaceEvent.ReplacementWord, "Incorrect Event Replacement Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.AreEqual(2, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("is", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.AreEqual(EventNames.DoubledWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(2, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(8, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("is", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.DeleteWord(); //spelling check Assert.AreEqual("this is a tst.", _SpellChecker.Text, "Incorrect Text"); // event check Assert.AreEqual(EventNames.DeletedWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(2, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(8, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("is ", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.AreEqual(3, _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.AreEqual("tst", _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.AreEqual(EventNames.MisspelledWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(3, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(10, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("tst", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.IgnoreWord(); //spelling check Assert.AreEqual("this is a tst.", _SpellChecker.Text, "Incorrect Text"); // event check Assert.AreEqual(EventNames.IgnoredWord, _lastEvent, "Incorrect Event"); Assert.IsNotNull(_lastSpellingEvent, "Null Event object fired"); Assert.AreEqual(3, _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.AreEqual(10, _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.AreEqual("tst", _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); // event check Assert.AreEqual(EventNames.EndOfText, _lastEvent, "Incorrect Event"); }
public void TestEvents() { Spelling _SpellChecker = NewSpellChecker(); _SpellChecker.Text = "ths is is a tst."; ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.True(0 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("ths" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.True(EventNames.MisspelledWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Event not fired"); Assert.True(0 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(0 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("ths" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.ReplaceWord("this"); //spelling check Assert.True("this is is a tst." == _SpellChecker.Text, "Incorrect Text"); // event check Assert.True(EventNames.ReplacedWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastReplaceEvent); //, "Null Event object fired"); Assert.True(0 == _lastReplaceEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(0 == _lastReplaceEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("ths" == _lastReplaceEvent.Word, "Incorrect Event Word"); Assert.True("this" == _lastReplaceEvent.ReplacementWord, "Incorrect Event Replacement Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.True(2 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("is" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.True(EventNames.DoubledWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(2 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(8 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("is" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.DeleteWord(); //spelling check Assert.True("this is a tst." == _SpellChecker.Text, "Incorrect Text"); // event check Assert.True(EventNames.DeletedWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(2 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(8 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("is " == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); //spelling check Assert.True(3 == _SpellChecker.WordIndex, "Incorrect WordOffset"); Assert.True("tst" == _SpellChecker.CurrentWord, "Incorrect CurrentWord"); // event check Assert.True(EventNames.MisspelledWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(3 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(10 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("tst" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.IgnoreWord(); //spelling check Assert.True("this is a tst." == _SpellChecker.Text, "Incorrect Text"); // event check Assert.True(EventNames.IgnoredWord == _lastEvent, "Incorrect Event"); Assert.NotNull(_lastSpellingEvent); //, "Null Event object fired"); Assert.True(3 == _lastSpellingEvent.WordIndex, "Incorrect Event Word Index"); Assert.True(10 == _lastSpellingEvent.TextIndex, "Incorrect Event Text Index"); Assert.True("tst" == _lastSpellingEvent.Word, "Incorrect Event Word"); ResetEvents(); _SpellChecker.SpellCheck(); // event check Assert.True(EventNames.EndOfText == _lastEvent, "Incorrect Event"); }