Fixed BorderTests

This commit is contained in:
Tig
2024-05-30 10:47:52 -06:00
parent 349f1f6459
commit 94ce28012e
8 changed files with 191 additions and 196 deletions

View File

@@ -91,7 +91,6 @@ public class ButtonTests (ITestOutputHelper output)
}
[Fact]
[AutoInitShutdown]
public void Button_HotKeyChanged_EventFires ()
{
var btn = new Button { Text = "_Yar" };
@@ -240,15 +239,11 @@ public class ButtonTests (ITestOutputHelper output)
}
[Fact]
[AutoInitShutdown]
public void HotKeyChange_Works ()
{
var clicked = false;
var btn = new Button { Text = "_Test" };
btn.Accept += (s, e) => clicked = true;
var top = new Toplevel ();
top.Add (btn);
Application.Begin (top);
Assert.Equal (KeyCode.T, btn.HotKey);
Assert.True (btn.NewKeyDownEvent (Key.T));
@@ -262,7 +257,6 @@ public class ButtonTests (ITestOutputHelper output)
btn.HotKey = KeyCode.E;
Assert.True (btn.NewKeyDownEvent (Key.E.WithAlt));
Assert.True (clicked);
top.Dispose ();
}
/// <summary>

View File

@@ -93,13 +93,10 @@ public class CheckBoxTests (ITestOutputHelper output)
}
[Fact]
[AutoInitShutdown]
[SetupFakeDriver]
public void AllowNullChecked_Get_Set ()
{
var checkBox = new CheckBox { Text = "Check this out 你" };
Toplevel top = new ();
top.Add (checkBox);
Application.Begin (top);
Assert.False (checkBox.Checked);
Assert.True (checkBox.NewKeyDownEvent (Key.Space));
@@ -110,7 +107,7 @@ public class CheckBoxTests (ITestOutputHelper output)
checkBox.AllowNullChecked = true;
Assert.True (checkBox.NewKeyDownEvent (Key.Space));
Assert.Null (checkBox.Checked);
Application.Refresh ();
checkBox.Draw();
TestHelpers.AssertDriverContentsWithFrameAre (
@$"
@@ -126,7 +123,6 @@ public class CheckBoxTests (ITestOutputHelper output)
checkBox.AllowNullChecked = false;
Assert.False (checkBox.Checked);
top.Dispose ();
}
[Fact]

View File

@@ -793,7 +793,6 @@ public class TileViewTests
}
[Fact]
[AutoInitShutdown]
public void TestDisposal_NoEarlyDisposalsOfUsersViews_DuringInsertTile ()
{
TileView tv = GetTileView (20, 10);
@@ -822,7 +821,6 @@ public class TileViewTests
}
[Fact]
[AutoInitShutdown]
public void TestDisposal_NoEarlyDisposalsOfUsersViews_DuringRebuildForTileCount ()
{
TileView tv = GetTileView (20, 10);
@@ -850,7 +848,6 @@ public class TileViewTests
}
[Theory]
[AutoInitShutdown]
[InlineData (0)]
[InlineData (1)]
public void TestDisposal_NoEarlyDisposalsOfUsersViews_DuringRemoveTile (int idx)

View File

@@ -36,7 +36,7 @@ public class TimeFieldTests
}
[Fact]
[AutoInitShutdown]
[AutoInitShutdown (useFakeClipboard:true)]
public void Copy_Paste ()
{
var tf1 = new TimeField { Time = TimeSpan.Parse ("12:12:19") };

View File

@@ -24,7 +24,6 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
public void ContentWidth_BiggerAfterExpand ()
{
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
@@ -51,7 +50,6 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
public void ContentWidth_VisibleVsAll ()
{
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out Car car2);
@@ -95,7 +93,7 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
[AutoInitShutdown]
public void CursorVisibility_MultiSelect ()
{
var tv = new TreeView { Width = 20, Height = 10 };
@@ -119,6 +117,7 @@ public class TreeViewTests
Application.Driver.GetCursorVisibility (out CursorVisibility visibility);
Assert.Equal (CursorVisibility.Default, tv.CursorVisibility);
Assert.Equal (CursorVisibility.Default, visibility);
top.Dispose ();
}
[Fact]
@@ -348,7 +347,6 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
public void ObjectActivated_Called ()
{
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
@@ -381,7 +379,6 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
public void ObjectActivated_CustomKey ()
{
@@ -424,7 +421,6 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
public void ObjectActivationButton_DoubleClick ()
{
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
@@ -451,7 +447,6 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
public void ObjectActivationButton_RightClick ()
{
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
@@ -485,7 +480,6 @@ public class TreeViewTests
}
[Fact]
[SetupFakeDriver]
public void ObjectActivationButton_SetToNull ()
{
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);

View File

@@ -3,13 +3,11 @@ using Xunit.Abstractions;
namespace Terminal.Gui.ViewsTests;
public class ViewDisposalTest
public class ViewDisposalTest (ITestOutputHelper output)
{
private readonly ITestOutputHelper _output;
#nullable enable
private readonly Dictionary<Type, object? []?> _special_params = new ();
#nullable restore
public ViewDisposalTest (ITestOutputHelper output) { _output = output; }
[Fact]
[AutoInitShutdown]
@@ -34,7 +32,7 @@ public class ViewDisposalTest
private WeakReference DoTest ()
{
GetSpecialParams ();
var Container = new View ();
var container = new View ();
Toplevel top = new ();
List<Type> views = GetViews ();
@@ -53,11 +51,11 @@ public class ViewDisposalTest
}
Assert.NotNull (instance);
Container.Add (instance);
_output.WriteLine ($"Added instance of {view}!");
container.Add (instance);
output.WriteLine ($"Added instance of {view}!");
}
top.Add (Container);
top.Add (container);
// make sure the application is doing to the views whatever its supposed to do to the views
for (var i = 0; i < 100; i++)
@@ -65,9 +63,9 @@ public class ViewDisposalTest
Application.Refresh ();
}
top.Remove (Container);
WeakReference reference = new (Container, true);
Container.Dispose ();
top.Remove (container);
WeakReference reference = new (container, true);
container.Dispose ();
return reference;
}
@@ -101,11 +99,11 @@ public class ViewDisposalTest
}
)) //end of body of anonymous check function
{ //body of the foreach loop
_output.WriteLine ($"Found Type {type.Name}");
output.WriteLine ($"Found Type {type.Name}");
Assert.DoesNotContain (type, valid);
Assert.True (type.IsAssignableTo (typeof (IDisposable))); // Just to be safe
valid.Add (type);
_output.WriteLine (" -Added!");
output.WriteLine (" -Added!");
} //end body of foreach loop
return valid;