|
@@ -2,11 +2,8 @@ using Xunit.Abstractions;
|
|
|
|
|
|
namespace Terminal.Gui.TextTests;
|
|
namespace Terminal.Gui.TextTests;
|
|
|
|
|
|
-public class AppendAutocompleteTests
|
|
|
|
|
|
+public class AppendAutocompleteTests (ITestOutputHelper output)
|
|
{
|
|
{
|
|
- private readonly ITestOutputHelper output;
|
|
|
|
- public AppendAutocompleteTests (ITestOutputHelper output) { this.output = output; }
|
|
|
|
-
|
|
|
|
[Fact]
|
|
[Fact]
|
|
[AutoInitShutdown]
|
|
[AutoInitShutdown]
|
|
public void TestAutoAppend_AfterCloseKey_NoAutocomplete ()
|
|
public void TestAutoAppend_AfterCloseKey_NoAutocomplete ()
|
|
@@ -34,6 +31,7 @@ public class AppendAutocompleteTests
|
|
// But can tab away
|
|
// But can tab away
|
|
Application.Driver.SendKeys ('\t', ConsoleKey.Tab, false, false, false);
|
|
Application.Driver.SendKeys ('\t', ConsoleKey.Tab, false, false, false);
|
|
Assert.NotSame (tf, Application.Top.Focused);
|
|
Assert.NotSame (tf, Application.Top.Focused);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
@@ -63,6 +61,7 @@ public class AppendAutocompleteTests
|
|
tf.PositionCursor ();
|
|
tf.PositionCursor ();
|
|
TestHelpers.AssertDriverContentsAre ("fish", output);
|
|
TestHelpers.AssertDriverContentsAre ("fish", output);
|
|
Assert.Equal ("fi", tf.Text);
|
|
Assert.Equal ("fi", tf.Text);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
[Theory]
|
|
[Theory]
|
|
@@ -94,6 +93,7 @@ public class AppendAutocompleteTests
|
|
tf.PositionCursor ();
|
|
tf.PositionCursor ();
|
|
TestHelpers.AssertDriverContentsAre ("fish", output);
|
|
TestHelpers.AssertDriverContentsAre ("fish", output);
|
|
Assert.Equal ("f", tf.Text);
|
|
Assert.Equal ("f", tf.Text);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
@@ -116,6 +116,7 @@ public class AppendAutocompleteTests
|
|
tf.Draw ();
|
|
tf.Draw ();
|
|
TestHelpers.AssertDriverContentsAre ("f", output);
|
|
TestHelpers.AssertDriverContentsAre ("f", output);
|
|
Assert.Equal ("f ", tf.Text);
|
|
Assert.Equal ("f ", tf.Text);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
@@ -136,6 +137,7 @@ public class AppendAutocompleteTests
|
|
tf.Draw ();
|
|
tf.Draw ();
|
|
TestHelpers.AssertDriverContentsAre ("fx", output);
|
|
TestHelpers.AssertDriverContentsAre ("fx", output);
|
|
Assert.Equal ("fx", tf.Text);
|
|
Assert.Equal ("fx", tf.Text);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
@@ -168,6 +170,7 @@ public class AppendAutocompleteTests
|
|
tf.Draw ();
|
|
tf.Draw ();
|
|
TestHelpers.AssertDriverContentsAre ("my FISH", output);
|
|
TestHelpers.AssertDriverContentsAre ("my FISH", output);
|
|
Assert.Equal ("my FISH", tf.Text);
|
|
Assert.Equal ("my FISH", tf.Text);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
@@ -203,6 +206,7 @@ public class AppendAutocompleteTests
|
|
// Second tab should move focus (nothing to autocomplete)
|
|
// Second tab should move focus (nothing to autocomplete)
|
|
Application.Driver.SendKeys ('\t', ConsoleKey.Tab, false, false, false);
|
|
Application.Driver.SendKeys ('\t', ConsoleKey.Tab, false, false, false);
|
|
Assert.NotSame (tf, Application.Top.Focused);
|
|
Assert.NotSame (tf, Application.Top.Focused);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
[Theory]
|
|
[Theory]
|
|
@@ -220,6 +224,7 @@ public class AppendAutocompleteTests
|
|
tf.PositionCursor ();
|
|
tf.PositionCursor ();
|
|
TestHelpers.AssertDriverContentsAre (expectRender, output);
|
|
TestHelpers.AssertDriverContentsAre (expectRender, output);
|
|
Assert.Equal ("f", tf.Text);
|
|
Assert.Equal ("f", tf.Text);
|
|
|
|
+ Application.Top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
private TextField GetTextFieldsInView ()
|
|
private TextField GetTextFieldsInView ()
|