mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Improves robustness of Dim, Pos, and SetRelativeLayout (#3077)
* Updated overview docs * Updated toc * Updated docs more * Updated yml via dependabot * Initial work in progress * Fixed some autosize things * Revamped Pos / Dim API docs * Removed margin * horiz->width * Updated MessageBoxes and Dialogs Scenarios to use AutoSize * AutoSize->Auxo * Adds validation * prep for Dialog to use Dim.Auto - Simplify unit tests to not depend on things not important to the unit test (like Dialog) * prep for Dialog to use Dim.Auto - Simplify unit tests * prep for Dialog to use Dim.Auto - Simplify unit tests * prep for Dialog to use Dim.Auto - Make Dialog tests not depend on MessageBox * Started on DimAuto unit tests * started impl on min/max. * started impl on min/max. * Added DimAutoStyle * Added arg checking for not implemented features * Temporarily made DimAutoStyle.Subviews default * Removed unneeded override of Anchor * Fixed GethashCode warning * Implemented DimAuto(min) * Fixed unit tests * renamed scenario * WIP * Moved ViewLayout.cs into Layout folder * Clean up cocde formatting * Renamed and moved SetFrameToFitText * Fixed API docs for SetRelativeLayout * Factored out SetRelativeLayout tests * Better documented existing SetRelativeLayout behavior + unit tess * Debugging Pos.Center + x in SetRelativeLayout - WIP * Progress on low level unit tess * Initial commit * Restored unmodified scenarios * Bump deps
This commit is contained in:
@@ -420,11 +420,13 @@ public class ApplicationTests {
|
||||
Assert.Equal (3, count);
|
||||
}
|
||||
|
||||
// TODO: All Toplevel layout tests should be moved to ToplevelTests.cs
|
||||
[Fact]
|
||||
public void Run_Toplevel_With_Modal_View_Does_Not_Refresh_If_Not_Dirty ()
|
||||
{
|
||||
Init ();
|
||||
var count = 0;
|
||||
// Don't use Dialog here as it has more layout logic. Use Window instead.
|
||||
Dialog d = null;
|
||||
var top = Application.Top;
|
||||
top.DrawContent += (s, a) => count++;
|
||||
@@ -432,6 +434,7 @@ public class ApplicationTests {
|
||||
Application.Iteration += (s, a) => {
|
||||
iteration++;
|
||||
if (iteration == 0) {
|
||||
// TODO: Don't use Dialog here as it has more layout logic. Use Window instead.
|
||||
d = new Dialog ();
|
||||
d.DrawContent += (s, a) => count++;
|
||||
Application.Run (d);
|
||||
@@ -453,44 +456,42 @@ public class ApplicationTests {
|
||||
Assert.Equal (3, count);
|
||||
}
|
||||
|
||||
// TODO: All Toplevel layout tests should be moved to ToplevelTests.cs
|
||||
[Fact]
|
||||
public void Run_A_Modal_Toplevel_Refresh_Background_On_Moving ()
|
||||
{
|
||||
Init ();
|
||||
var d = new Dialog () { Width = 5, Height = 5 };
|
||||
// Don't use Dialog here as it has more layout logic. Use Window instead.
|
||||
var w = new Window () { Width = 5, Height = 5 };
|
||||
((FakeDriver)Application.Driver).SetBufferSize (10, 10);
|
||||
var rs = Application.Begin (d);
|
||||
var rs = Application.Begin (w);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
┌───┐
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└───┘", _output);
|
||||
┌───┐
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└───┘", _output);
|
||||
|
||||
var attributes = new Attribute [] {
|
||||
// 0
|
||||
new Attribute (ColorName.White, ColorName.Black),
|
||||
// 1
|
||||
Colors.Dialog.Normal
|
||||
Colors.Base.Normal
|
||||
};
|
||||
TestHelpers.AssertDriverColorsAre (@"
|
||||
0000000000
|
||||
0000000000
|
||||
0011111000
|
||||
0011111000
|
||||
0011111000
|
||||
0011111000
|
||||
0011111000
|
||||
0000000000
|
||||
0000000000
|
||||
0000000000
|
||||
1111100000
|
||||
1111100000
|
||||
1111100000
|
||||
1111100000
|
||||
1111100000
|
||||
", null, attributes);
|
||||
|
||||
// TODO: In PR #2920 this breaks because the mouse is not grabbed anymore.
|
||||
// TODO: Move the mouse grap/drag mode from Toplevel to Border.
|
||||
Application.OnMouseEvent (new MouseEventEventArgs (new MouseEvent () { X = 2, Y = 2, Flags = MouseFlags.Button1Pressed }));
|
||||
Assert.Equal (d, Application.MouseGrabView);
|
||||
Application.OnMouseEvent (new MouseEventEventArgs (new MouseEvent () { X = 0, Y = 0, Flags = MouseFlags.Button1Pressed }));
|
||||
Assert.Equal (w, Application.MouseGrabView);
|
||||
|
||||
// Move down and to the right.
|
||||
Application.OnMouseEvent (new MouseEventEventArgs (new MouseEvent () { X = 1, Y = 1, Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition }));
|
||||
Application.Refresh ();
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
@@ -504,7 +505,7 @@ public class ApplicationTests {
|
||||
// 0
|
||||
new Attribute (ColorName.White, ColorName.Black),
|
||||
// 1
|
||||
Colors.Dialog.Normal
|
||||
Colors.Base.Normal
|
||||
};
|
||||
TestHelpers.AssertDriverColorsAre (@"
|
||||
0000000000
|
||||
@@ -513,10 +514,6 @@ public class ApplicationTests {
|
||||
0111110000
|
||||
0111110000
|
||||
0111110000
|
||||
0000000000
|
||||
0000000000
|
||||
0000000000
|
||||
0000000000
|
||||
", null, attributes);
|
||||
|
||||
Application.End (rs);
|
||||
@@ -578,6 +575,7 @@ public class ApplicationTests {
|
||||
var t1 = new Toplevel ();
|
||||
var t2 = new Toplevel ();
|
||||
var t3 = new Toplevel ();
|
||||
// Don't use Dialog here as it has more layout logic. Use Window instead.
|
||||
var d = new Dialog ();
|
||||
var t4 = new Toplevel ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user