public async Task TestBug16174_AutoIndent()
        {
            await Simulate("namespace Foo\n{\n\tpublic class Bar\n\t{\n$\t\tvoid Test()\n\t\t{\n\t\t}\n\t}\n}\n", (content, ext) => {
                var options         = new CustomEditorOptions();
                options.IndentStyle = IndentStyle.Auto;
                ext.Editor.Options  = options;
                EditActions.NewLine(ext.Editor);
                ext.KeyPress(KeyDescriptor.FromGtk(Gdk.Key.Return, '\n', Gdk.ModifierType.None));

                var newText = content.Text;

                var expected = "namespace Foo\n{\n\tpublic class Bar\n\t{\n\n\t\tvoid Test()\n\t\t{\n\t\t}\n\t}\n}\n";
                if (newText != expected)
                {
                    Console.WriteLine(newText);
                }
                Assert.AreEqual(expected, newText);
            });
        }
예제 #2
0
        public async Task TestCorrectReindentNextLine()
        {
            await Simulate(@"
class Foo
{
	void Bar ()
	{
		try {
		} catch (Exception e) {$}
	}
}
", (content, ext) => {
                ext.ReindentOnTab();
                EditActions.NewLine(ext.Editor);
                ext.KeyPress(KeyDescriptor.FromGtk((Gdk.Key) '\n', '\n', Gdk.ModifierType.None));

                var newText = content.Text;

                var expected = @"
class Foo
{
	void Bar ()
	{
		try {
		} catch (Exception e) {
		}
	}
}
";
                if (newText != expected)
                {
                    Console.WriteLine(newText);
                }
                Assert.AreEqual(expected, newText);
            });
        }