Partially Fixes #2483 - Removes old Border and leverages LineCanvas for Frames, etc... (#2527)

* POC

* View.DrawFrame now uses LineCanvas

* Fixes #2531. Toplevel should redraw only if it's needed.

* Fix toplevel when mdi is enabled preventing clear the screen twice.

* Massive LineCanvis updates

* Fixes #2534. Bounds isn't updating when the Frame is changed.

* Almost everything works!

* Had to disable a few tests but all unit test now pass again

* Deleted ConsoleDriver.DrawWindowFrame; hacked ProgressBar

* Deleted ConsoleDriver.DrawWindowTitle; moved to Frame.DrawTitle

* Renames BorderFrame to Border

* Removed old commented code

* Tweaked scenario

* Added auto convert \r\n to Enviornment.NewLine in TestHelpers.AssertEqual

* Fix merge errors.

* Fix AssertEqual newlines to platform-specific.

* Refactored frames drawing; view adds to its lineview, superview renders them

* New titlebar style based on Border.Top size; fixed bugs

* wzard bug

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
This commit is contained in:
Tig
2023-04-13 15:35:01 -06:00
committed by GitHub
parent 5317489a8b
commit 8c59e8255f
49 changed files with 2970 additions and 1789 deletions

View File

@@ -24,6 +24,7 @@ namespace Terminal.Gui.ViewsTests {
Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
Assert.Equal ('_', btn.HotKeySpecifier);
Assert.True (btn.CanFocus);
Assert.Equal (new Rect (0, 0, 4, 1), btn.Bounds);
Assert.Equal (new Rect (0, 0, 4, 1), btn.Frame);
Assert.Equal (Key.Null, btn.HotKey);
var expected = @"
@@ -31,7 +32,7 @@ namespace Terminal.Gui.ViewsTests {
";
TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
Application.End (rs);
btn = new Button ("ARGS", true) { Text = "Test" };
Assert.Equal ("Test", btn.Text);
Application.Top.Add (btn);
@@ -42,6 +43,7 @@ namespace Terminal.Gui.ViewsTests {
Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
Assert.Equal ('_', btn.HotKeySpecifier);
Assert.True (btn.CanFocus);
Assert.Equal (new Rect (0, 0, 10, 1), btn.Bounds);
Assert.Equal (new Rect (0, 0, 10, 1), btn.Frame);
Assert.Equal (Key.T, btn.HotKey);
expected = @"
@@ -49,7 +51,7 @@ namespace Terminal.Gui.ViewsTests {
";
TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
Application.End (rs);
btn = new Button (3, 4, "Test", true);
Assert.Equal ("Test", btn.Text);
Application.Top.Add (btn);
@@ -60,6 +62,7 @@ namespace Terminal.Gui.ViewsTests {
Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
Assert.Equal ('_', btn.HotKeySpecifier);
Assert.True (btn.CanFocus);
Assert.Equal (new Rect (0, 0, 10, 1), btn.Bounds);
Assert.Equal (new Rect (3, 4, 10, 1), btn.Frame);
Assert.Equal (Key.T, btn.HotKey);
expected = @"
@@ -76,7 +79,7 @@ namespace Terminal.Gui.ViewsTests {
{
var clicked = false;
Button btn = new Button ("Test");
btn.Clicked += (s,e) => clicked = true;
btn.Clicked += (s, e) => clicked = true;
Application.Top.Add (btn);
Application.Begin (Application.Top);
@@ -119,7 +122,7 @@ namespace Terminal.Gui.ViewsTests {
{
var clicked = false;
Button btn = new Button ("Test");
btn.Clicked += (s,e) => clicked = true;
btn.Clicked += (s, e) => clicked = true;
Application.Top.Add (btn);
Application.Begin (Application.Top);
@@ -146,7 +149,7 @@ namespace Terminal.Gui.ViewsTests {
{
int pressed = 0;
var btn = new Button ("Press Me");
btn.Clicked += (s,e) => pressed++;
btn.Clicked += (s, e) => pressed++;
// The Button class supports the Accept command
Assert.Contains (Command.Accept, btn.GetSupportedCommands ());
@@ -593,12 +596,12 @@ namespace Terminal.Gui.ViewsTests {
object sender = null;
KeyChangedEventArgs args = null;
btn.HotKeyChanged += (s, e) =>{
btn.HotKeyChanged += (s, e) => {
sender = s;
args = e;
};
btn.HotKey = Key.r;
Assert.Same (btn, sender);
Assert.Equal (Key.Y, args.OldKey);