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

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

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

Loading…
Cancel
Save