mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
This commit is contained in:
@@ -111,7 +111,7 @@ public class DrawTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
[SetupFakeApplication]
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
@@ -136,7 +136,7 @@ public class DrawTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
[SetupFakeApplication]
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Bottom ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
||||
@@ -154,7 +154,7 @@ public class DrawTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
[SetupFakeApplication]
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Left ()
|
||||
{
|
||||
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
||||
@@ -179,7 +179,7 @@ public class DrawTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
[SetupFakeApplication]
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Right ()
|
||||
{
|
||||
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
||||
@@ -204,7 +204,7 @@ public class DrawTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
[SetupFakeApplication]
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Top ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
||||
@@ -582,7 +582,7 @@ public class DrawTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[SetupFakeDriver]
|
||||
[SetupFakeApplication]
|
||||
[InlineData ("𝔽𝕆𝕆𝔹𝔸R")]
|
||||
[InlineData ("a𐐀b")]
|
||||
public void DrawHotString_NonBmp (string expected)
|
||||
@@ -635,22 +635,15 @@ public class DrawTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[TestRespondersDisposed]
|
||||
[AutoInitShutdown]
|
||||
public void Draw_Throws_IndexOutOfRangeException_With_Negative_Bounds ()
|
||||
{
|
||||
Application.Init (new FakeDriver ());
|
||||
|
||||
Toplevel top = new ();
|
||||
|
||||
var view = new View { X = -2, Text = "view" };
|
||||
top.Add (view);
|
||||
|
||||
Application.Iteration += (s, a) =>
|
||||
{
|
||||
Assert.Equal (-2, view.X);
|
||||
|
||||
Application.RequestStop ();
|
||||
};
|
||||
Application.Iteration += OnApplicationOnIteration;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -661,11 +654,24 @@ public class DrawTests (ITestOutputHelper output)
|
||||
// After the fix this exception will not be caught.
|
||||
Assert.IsType<IndexOutOfRangeException> (ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Application.Iteration -= OnApplicationOnIteration;
|
||||
}
|
||||
|
||||
top.Dispose ();
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
|
||||
return;
|
||||
|
||||
void OnApplicationOnIteration (object? s, IterationEventArgs a)
|
||||
{
|
||||
Assert.Equal (-2, view.X);
|
||||
|
||||
Application.RequestStop ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -685,7 +691,7 @@ public class DrawTests (ITestOutputHelper output)
|
||||
};
|
||||
Toplevel top = new ();
|
||||
top.Add (label, view);
|
||||
RunState runState = Application.Begin (top);
|
||||
SessionToken sessionToken = Application.Begin (top);
|
||||
AutoInitShutdownAttribute.RunIteration ();
|
||||
|
||||
DriverAssert.AssertDriverContentsWithFrameAre (
|
||||
@@ -713,7 +719,7 @@ At 0,0
|
||||
A text wit",
|
||||
output
|
||||
);
|
||||
Application.End (runState);
|
||||
Application.End (sessionToken);
|
||||
top.Dispose ();
|
||||
}
|
||||
|
||||
@@ -733,7 +739,7 @@ At 0,0
|
||||
};
|
||||
Toplevel top = new ();
|
||||
top.Add (label, view);
|
||||
RunState runState = Application.Begin (top);
|
||||
SessionToken sessionToken = Application.Begin (top);
|
||||
|
||||
top.Draw ();
|
||||
|
||||
@@ -766,7 +772,7 @@ At 0,0
|
||||
,
|
||||
output
|
||||
);
|
||||
Application.End (runState);
|
||||
Application.End (sessionToken);
|
||||
top.Dispose ();
|
||||
}
|
||||
|
||||
@@ -786,7 +792,7 @@ At 0,0
|
||||
};
|
||||
Toplevel top = new ();
|
||||
top.Add (label, view);
|
||||
RunState runState = Application.Begin (top);
|
||||
SessionToken sessionToken = Application.Begin (top);
|
||||
AutoInitShutdownAttribute.RunIteration ();
|
||||
|
||||
DriverAssert.AssertDriverContentsWithFrameAre (
|
||||
@@ -812,7 +818,7 @@ At 0,0
|
||||
,
|
||||
output
|
||||
);
|
||||
Application.End (runState);
|
||||
Application.End (sessionToken);
|
||||
top.Dispose ();
|
||||
}
|
||||
|
||||
@@ -832,7 +838,7 @@ At 0,0
|
||||
};
|
||||
Toplevel top = new ();
|
||||
top.Add (label, view);
|
||||
RunState runState = Application.Begin (top);
|
||||
SessionToken sessionToken = Application.Begin (top);
|
||||
|
||||
top.Draw ();
|
||||
|
||||
@@ -864,7 +870,7 @@ At 0,0
|
||||
,
|
||||
output
|
||||
);
|
||||
Application.End (runState);
|
||||
Application.End (sessionToken);
|
||||
top.Dispose ();
|
||||
}
|
||||
public class DerivedView : View
|
||||
|
||||
Reference in New Issue
Block a user