Browse Source

Update ignored XML Editor tests.

newNRvisualizers
Matt Ward 13 years ago
parent
commit
e879ad63d8
  1. 42
      src/AddIns/DisplayBindings/XmlEditor/Test/Completion/ElementCompletionWindowTests.cs
  2. 12
      src/AddIns/DisplayBindings/XmlEditor/Test/Editor/DefaultXmlEditorOptionsTestFixture.cs

42
src/AddIns/DisplayBindings/XmlEditor/Test/Completion/ElementCompletionWindowTests.cs

@ -13,7 +13,6 @@ using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.Completion namespace XmlEditor.Tests.Completion
{ {
[TestFixture] [TestFixture]
[Ignore("Test needs to be adjusted to SD5")]
public class ElementCompletionWindowTests public class ElementCompletionWindowTests
{ {
MockTextEditor textEditor; MockTextEditor textEditor;
@ -39,29 +38,54 @@ namespace XmlEditor.Tests.Completion
completionBinding = new XmlCodeCompletionBinding(associations); completionBinding = new XmlCodeCompletionBinding(associations);
} }
void CharacterTypedIntoTextEditor(char ch)
{
textEditor.Document.Text += ch.ToString();
textEditor.Caret.Offset++;
}
[Test] [Test]
public void HandleKeyPress_LessThanKeyPressed_KeyPressResultIsCompletedAfterPressingLessThanSign() public void HandleKeyPress_AnyKey_ReturnsNone()
{ {
keyPressResult = completionBinding.HandleKeyPress(textEditor, '<'); keyPressResult = completionBinding.HandleKeyPress(textEditor, 'a');
Assert.AreEqual(CodeCompletionKeyPressResult.EatKey, keyPressResult);
Assert.AreEqual(CodeCompletionKeyPressResult.None, keyPressResult);
} }
[Test] [Test]
public void HandleKeyPress_LessThanKeyPressed_CompletionWindowWidthIsNotSetToMatchLongestNamespaceTextWidth() public void HandleKeyPressed_LessThanKeyPressed_ReturnsTrue()
{ {
completionBinding.HandleKeyPress(textEditor, '<'); CharacterTypedIntoTextEditor('<');
bool result = completionBinding.HandleKeyPressed(textEditor, '<');
Assert.IsTrue(result);
}
[Test]
public void HandleKeyPressed_SpaceCharacterPressed_ReturnsFalse()
{
CharacterTypedIntoTextEditor(' ');
bool result = completionBinding.HandleKeyPressed(textEditor, ' ');
Assert.IsFalse(result);
}
[Test]
public void HandleKeyPressed_LessThanKeyPressed_CompletionWindowWidthIsNotSetToMatchLongestNamespaceTextWidth()
{
CharacterTypedIntoTextEditor('<');
completionBinding.HandleKeyPressed(textEditor, '<');
Assert.AreNotEqual(double.NaN, textEditor.CompletionWindowDisplayed.Width); Assert.AreNotEqual(double.NaN, textEditor.CompletionWindowDisplayed.Width);
} }
[Test] [Test]
public void HandleKeyPress_LessThanKeyPressedInsideRootHtmlElement_BodyElementExistsInChildCompletionItems() public void HandleKeyPressed_LessThanKeyPressedInsideRootHtmlElement_BodyElementExistsInChildCompletionItems()
{ {
textEditor.Document.Text = textEditor.Document.Text =
"<html><\r\n" + "<html><\r\n" +
"</html>"; "</html>";
textEditor.Caret.Offset = 6; textEditor.Caret.Offset = 7;
completionBinding.HandleKeyPress(textEditor, '<'); completionBinding.HandleKeyPressed(textEditor, '<');
ICompletionItem[] items = textEditor.CompletionItemsDisplayedToArray(); ICompletionItem[] items = textEditor.CompletionItemsDisplayedToArray();
XmlCompletionItem expectedItem = new XmlCompletionItem("body", XmlCompletionItemType.XmlElement); XmlCompletionItem expectedItem = new XmlCompletionItem("body", XmlCompletionItemType.XmlElement);

12
src/AddIns/DisplayBindings/XmlEditor/Test/Editor/DefaultXmlEditorOptionsTestFixture.cs

@ -15,7 +15,6 @@ using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.Editor namespace XmlEditor.Tests.Editor
{ {
[TestFixture] [TestFixture]
[Ignore("Test needs to be adjusted to SD5")]
public class DefaultXmlEditorOptionsTestFixture public class DefaultXmlEditorOptionsTestFixture
{ {
XmlSchemaFileAssociations associations; XmlSchemaFileAssociations associations;
@ -37,11 +36,12 @@ namespace XmlEditor.Tests.Editor
DefaultXmlSchemaFileAssociations CreateDefaultXmlSchemaFileExtensions() DefaultXmlSchemaFileAssociations CreateDefaultXmlSchemaFileExtensions()
{ {
string addinXml = "<AddIn name = 'Xml Editor'\r\n" + string addinXml =
"author = ''\r\n" + "<AddIn name = 'Xml Editor'\r\n" +
"copyright = 'prj:///doc/copyright.txt'\r\n" + " author = ''\r\n" +
"description = ''\r\n" + " copyright = 'prj:///doc/copyright.txt'\r\n" +
"addInManagerHidden = 'preinstalled'>\r\n" + " description = ''\r\n" +
" addInManagerHidden = 'preinstalled'>\r\n" +
"</AddIn>"; "</AddIn>";
using (StringReader reader = new StringReader(addinXml)) { using (StringReader reader = new StringReader(addinXml)) {

Loading…
Cancel
Save