Fixes #2493. Move all layout code out of View (and Toplevel) into a layout helper class (#2544)

* Comment/warning clean up

* Moved Text and Drawing out

* Moved Layout out

* Removed extra lines

* Removed Mouse out

* Reorgainzed View

* API docs

* removed border.cs

* TopLevel.Resized -> TerminalResized

* Mdi -> Overlapped

* Removed confusing and un-needed WillPresent

* privates -> _

* Tweaked RunLoop API
This commit is contained in:
Tig
2023-04-14 10:26:10 -06:00
committed by GitHub
parent 8c59e8255f
commit b4552ee14b
154 changed files with 5261 additions and 5725 deletions

View File

@@ -111,7 +111,6 @@ namespace Terminal.Gui.ViewsTests {
Assert.Equal (1, botLeft.Width);
Assert.Equal (1, botLeft.Height);
// up 2 rows of the console and along 1 col
var up2along1 = gv.ScreenToGraphSpace (1, 7);
Assert.Equal (1, up2along1.X);
@@ -292,7 +291,6 @@ namespace Terminal.Gui.ViewsTests {
Assert.Equal (7, gv.GraphSpaceToScreen (new PointF (2, 11)).Y);
}
[Fact]
public void GraphSpaceToScreen_CustomCellSize_WithScrollOffset ()
{
@@ -318,7 +316,6 @@ namespace Terminal.Gui.ViewsTests {
Assert.Equal (12, along2up1.X);
Assert.Equal (7, along2up1.Y);
// More boundary testing for this cell size/offset
Assert.Equal (6, gv.GraphSpaceToScreen (new PointF (2, 6)).Y);
Assert.Equal (6, gv.GraphSpaceToScreen (new PointF (2, 7)).Y);
@@ -330,7 +327,6 @@ namespace Terminal.Gui.ViewsTests {
#endregion
/// <summary>
/// A cell size of 0 would result in mapping all graph space into the
/// same cell of the console. Since <see cref="GraphView.CellSize"/>
@@ -357,7 +353,6 @@ namespace Terminal.Gui.ViewsTests {
}
/// <summary>
/// Tests that each point in the screen space maps to a rectangle of
/// (float) graph space and that each corner of that rectangle of graph
@@ -549,7 +544,6 @@ namespace Terminal.Gui.ViewsTests {
Assert.Equal (4, series.SubSeries.ElementAt (4).Offset);
}
[Fact]
public void MultiBarSeriesColors_WrongNumber ()
{
@@ -568,7 +562,6 @@ namespace Terminal.Gui.ViewsTests {
Application.Shutdown ();
}
[Fact]
public void MultiBarSeriesColors_RightNumber ()
{
@@ -592,7 +585,6 @@ namespace Terminal.Gui.ViewsTests {
Application.Shutdown ();
}
[Fact]
public void MultiBarSeriesAddValues_WrongNumber ()
{
@@ -606,7 +598,6 @@ namespace Terminal.Gui.ViewsTests {
}
[Fact]
public void TestRendering_MultibarSeries ()
{
@@ -684,7 +675,6 @@ namespace Terminal.Gui.ViewsTests {
public class BarSeriesTests {
private GraphView GetGraph (out FakeBarSeries series, out FakeHAxis axisX, out FakeVAxis axisY)
{
GraphViewTests.InitFakeDriver ();
@@ -742,7 +732,6 @@ namespace Terminal.Gui.ViewsTests {
Application.Shutdown ();
}
[Fact]
public void TestTwoTallBars_WithOffset ()
{
@@ -882,10 +871,8 @@ namespace Terminal.Gui.ViewsTests {
}
}
public class AxisTests {
private GraphView GetGraph (out FakeHAxis axis)
{
return GetGraph (out axis, out _);
@@ -993,7 +980,6 @@ namespace Terminal.Gui.ViewsTests {
#region VerticalAxisTests
/// <summary>
/// Tests that the horizontal axis is computed correctly and does not over spill
/// it's bounds
@@ -1124,7 +1110,6 @@ namespace Terminal.Gui.ViewsTests {
Application.Shutdown ();
}
[Fact]
public void TestTextAnnotation_GraphUnits ()
{
@@ -1197,12 +1182,10 @@ namespace Terminal.Gui.ViewsTests {
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
[Fact]
public void TestTextAnnotation_Offscreen ()
{
@@ -1262,7 +1245,6 @@ namespace Terminal.Gui.ViewsTests {
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1297,7 +1279,6 @@ namespace Terminal.Gui.ViewsTests {
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1326,7 +1307,6 @@ namespace Terminal.Gui.ViewsTests {
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1369,7 +1349,6 @@ namespace Terminal.Gui.ViewsTests {
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1409,7 +1388,6 @@ namespace Terminal.Gui.ViewsTests {
";
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1451,12 +1429,10 @@ namespace Terminal.Gui.ViewsTests {
";
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
[Fact]
public void MarginBottom_BiggerThanHeight_ExpectBlankGraph ()
{
@@ -1478,7 +1454,6 @@ namespace Terminal.Gui.ViewsTests {
";
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1503,7 +1478,6 @@ namespace Terminal.Gui.ViewsTests {
";
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1537,7 +1511,6 @@ namespace Terminal.Gui.ViewsTests {
TestHelpers.AssertDriverContentsAre (expected, output);
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
@@ -1571,7 +1544,7 @@ namespace Terminal.Gui.ViewsTests {
//put label into view
mount.Add (lbl1);
//putting mount into toplevel since changing size
//putting mount into Toplevel since changing size
//also change AutoSize to false
Application.Top.Add (mount);
Application.Begin (Application.Top);
@@ -1591,7 +1564,6 @@ namespace Terminal.Gui.ViewsTests {
// should have the new text rendered
TestHelpers.AssertDriverContentsAre ("ff1234", null);
} finally {
Application.Shutdown ();
}