Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5669 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
7 changed files with 134 additions and 7 deletions
@ -0,0 +1,92 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||||
|
// <version>$Revision: 5529 $</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.XamlBinding.Tests |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
[RequiresSTA] |
||||||
|
public class CodeInsertionTests : TextEditorBasedTests |
||||||
|
{ |
||||||
|
#region TextInsertionTests
|
||||||
|
[Test] |
||||||
|
public void CtrlSpaceClosingAttributeValueWithEqualsInsertionTest() |
||||||
|
{ |
||||||
|
string fileHeader = @"<Window x:Class='ICSharpCode.XamlBinding.Tests.CompletionTestsBase'
|
||||||
|
xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
|
||||||
|
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
|
||||||
|
<Grid> |
||||||
|
<Button ";
|
||||||
|
string fileFooter = @"
|
||||||
|
</Grid> |
||||||
|
</Window>";
|
||||||
|
|
||||||
|
TestCtrlSpace(fileHeader, fileFooter, true, |
||||||
|
list => { |
||||||
|
Assert.AreEqual(0, list.PreselectionLength); |
||||||
|
Assert.IsNull(list.SuggestedItem); |
||||||
|
Assert.IsTrue(list.Items.Any()); |
||||||
|
|
||||||
|
TestTextInsert(fileHeader, fileFooter, '=', list, list.Items.First(i => i.Text == "Content"), "Content=\"\"", "Content=\"".Length); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void CtrlSpaceInsertionTest() |
||||||
|
{ |
||||||
|
string fileHeader = @"<Window x:Class='ICSharpCode.XamlBinding.Tests.CompletionTestsBase'
|
||||||
|
xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
|
||||||
|
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
|
||||||
|
<Grid> |
||||||
|
";
|
||||||
|
string fileFooter = @"
|
||||||
|
</Grid> |
||||||
|
</Window>";
|
||||||
|
|
||||||
|
TestCtrlSpace(fileHeader, fileFooter, true, |
||||||
|
list => { |
||||||
|
Assert.AreEqual(0, list.PreselectionLength); |
||||||
|
Assert.IsNull(list.SuggestedItem); |
||||||
|
Assert.IsTrue(list.Items.Any()); |
||||||
|
|
||||||
|
TestTextInsert(fileHeader, fileFooter, '\n', list, list.Items.First(i => i.Text == "!--"), "<!-- -->", "<!-- ".Length); |
||||||
|
TestTextInsert(fileHeader, fileFooter, '\n', list, list.Items.First(i => i.Text == "Button"), "<Button", "<Button".Length); |
||||||
|
TestTextInsert(fileHeader, fileFooter, '\n', list, list.Items.First(i => i.Text == "/Grid"), "</Grid>", "</Grid>".Length); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void CtrlSpaceClosingTagWithGreaterThanInsertionTest() |
||||||
|
{ |
||||||
|
string fileHeader = @"<Window x:Class='ICSharpCode.XamlBinding.Tests.CompletionTestsBase'
|
||||||
|
xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
|
||||||
|
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
|
||||||
|
<Grid> |
||||||
|
";
|
||||||
|
string fileFooter = @"
|
||||||
|
</Grid> |
||||||
|
</Window>";
|
||||||
|
|
||||||
|
TestCtrlSpace(fileHeader, fileFooter, true, |
||||||
|
list => { |
||||||
|
Assert.AreEqual(0, list.PreselectionLength); |
||||||
|
Assert.IsNull(list.SuggestedItem); |
||||||
|
Assert.IsTrue(list.Items.Any()); |
||||||
|
|
||||||
|
TestTextInsert(fileHeader, fileFooter, '>', list, list.Items.First(i => i.Text == "/Grid"), "</Grid>", "</Grid>".Length); |
||||||
|
}); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue