mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Added Attributes tests; balanced Application.Init/Shutdown
This commit is contained in:
@@ -355,6 +355,9 @@ namespace Terminal.Gui.Views {
|
||||
var ex = Assert.Throws<Exception>(()=>gv.Redraw (gv.Bounds));
|
||||
|
||||
Assert.Equal ("CellSize cannot be 0", ex.Message);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
@@ -447,6 +450,9 @@ namespace Terminal.Gui.Views {
|
||||
// The screen space the graph will be rendered into should
|
||||
// not overspill the margins
|
||||
Assert.Equal (new Rect (5, 0, 45, 28), graphScreenBounds);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -493,6 +499,9 @@ namespace Terminal.Gui.Views {
|
||||
// The screen space the graph will be rendered into should
|
||||
// not overspill the margins
|
||||
Assert.Equal (new Rect (5, 0, 45, 28), graphScreenBounds);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
private class FakeSeries : ISeries {
|
||||
@@ -550,6 +559,9 @@ namespace Terminal.Gui.Views {
|
||||
// user passes 1 color only but asks for 5 bars
|
||||
var ex = Assert.Throws<ArgumentException>(()=>new MultiBarSeries(5,7,1,colors));
|
||||
Assert.Equal("Number of colors must match the number of bars (Parameter 'numberOfBarsPerCategory')",ex.Message);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
@@ -570,6 +582,9 @@ namespace Terminal.Gui.Views {
|
||||
Assert.Equal(series.SubSeries.ElementAt(0).OverrideBarColor,colors[0]);
|
||||
Assert.Equal(series.SubSeries.ElementAt(1).OverrideBarColor,colors[1]);
|
||||
Assert.Equal(series.SubSeries.ElementAt(2).OverrideBarColor,colors[2]);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
@@ -651,6 +666,9 @@ namespace Terminal.Gui.Views {
|
||||
┼──┬M──┬M──┬M──────
|
||||
heytherebob ";
|
||||
GraphViewTests.AssertDriverContentsAre (looksLike, output);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,6 +725,9 @@ namespace Terminal.Gui.Views {
|
||||
// Screen position x=2 because bars are drawn every 1f of
|
||||
// graph space and CellSize.X is 0.5f
|
||||
Assert.Contains(2, axisX.LabelPoints);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
@@ -757,10 +778,11 @@ namespace Terminal.Gui.Views {
|
||||
Assert.Equal(0,barSeries.BarScreenEnds[0].Y);
|
||||
Assert.Equal(9,barSeries.BarScreenStarts[1].Y);
|
||||
Assert.Equal(0,barSeries.BarScreenEnds[1].Y);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Fact]
|
||||
public void TestOneLongOneShortHorizontalBars_WithOffset(){
|
||||
|
||||
@@ -819,6 +841,9 @@ namespace Terminal.Gui.Views {
|
||||
// labels should align with the bars (same screen y axis point)
|
||||
Assert.Contains(4, axisY.LabelPoints);
|
||||
Assert.Contains(1, axisY.LabelPoints);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
private class FakeBarSeries : BarSeries{
|
||||
@@ -896,6 +921,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
Assert.InRange(axis.LabelPoints.Max(),0,49);
|
||||
Assert.InRange(axis.LabelPoints.Min(),0,49);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -916,6 +944,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
Assert.InRange(axis.LabelPoints.Max(),0,49);
|
||||
Assert.InRange(axis.LabelPoints.Min(),0,49);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -937,6 +968,9 @@ namespace Terminal.Gui.Views {
|
||||
// Axis lables should not be drawn in the margin
|
||||
Assert.InRange(axis.LabelPoints.Max(),5,49);
|
||||
Assert.InRange(axis.LabelPoints.Min(),5,49);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -965,6 +999,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
Assert.InRange(axis.LabelPoints.Max(),0,29);
|
||||
Assert.InRange(axis.LabelPoints.Min(),0,29);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -986,6 +1023,9 @@ namespace Terminal.Gui.Views {
|
||||
// Labels should not be drawn into the axis
|
||||
Assert.InRange(axis.LabelPoints.Max(),0,19);
|
||||
Assert.InRange(axis.LabelPoints.Min(),0,19);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1006,12 +1046,12 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
Assert.InRange(axis.LabelPoints.Max(),0,29);
|
||||
Assert.InRange(axis.LabelPoints.Min(),0,29);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class TextAnnotationTests {
|
||||
@@ -1060,6 +1100,9 @@ namespace Terminal.Gui.Views {
|
||||
0 5";
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
@@ -1102,6 +1145,9 @@ namespace Terminal.Gui.Views {
|
||||
0 5";
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1130,6 +1176,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
|
||||
@@ -1156,6 +1205,8 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -1189,6 +1240,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1221,6 +1275,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1247,6 +1304,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1286,6 +1346,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected, output);
|
||||
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1315,6 +1378,9 @@ namespace Terminal.Gui.Views {
|
||||
|
||||
GraphViewTests.AssertDriverContentsAre (expected,output);
|
||||
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user