Fixes #3127 - View Layout improvements - Redefines how LayoutStyle works. Fixes AutoSize etc... (#3130)

* Removes CheckAbsoulte and updates unit tests to match

* Fixed code that was dependent on ToString behavior vs. direct test for null

* Dim/Pos != null WIP

* Moved AutoSize specific tests out of Pos/Dim tests

* Broke out AutoSize = false tests to new file

* Commented test TODOs

* New test

* Removed unused API and cleaned up code

* Removed unused API and cleaned up code

* Cleaned up code

* Cleaned up code

* reorg'd Toplevel tests

* Fixed Create and related unit tests

* Added test from #3136

* Removed TopLevel.Create

* Fixed SetCurrentOverlappedAsTop

* Updated pull request template

* Updated pull request template

* Revert "Updated pull request template"

This reverts commit d807190dd9.

* reverting

* re-reverting

* Fixed every thing but autosize scenarios??

* Fixed hexview

* Fixed contextmenu

* Fixed more minor issues in tests

* Fixed more minor issues in tests

* Debugging Dialog test failure

* Fixed bad Dialog test. Was cleary invalid

* Fixed OnResizeNeeded bug

* Fixed OnResizeNeeded bug

* Fixed UICatalog to not eat exceptions

* Fixed TextView

* Removed Frame overrides

* Made Frame non-virtual

* Fixed radioGroup

* Fixed TabView

* Hcked ScrolLBarView unit tests to pass

* All AutoSize tests pass!

* All tests pass!!!!!!!

* Updated API docs. Cleaned up code.

* Fixed ColorPicker

* Added 'Bounds =' unit tests

* Refactored TextFormatter.Size setting logic

* Cleaned up OnResizeNeeded (api docs and usages)

* Merges in #3019 changes. Makes OnResizeNeeded non-virtual. If we find a use-case where someone wants to override it we can change this back.

* Fixed FileDialog bounds warning

* Removed resharper settings from editorconfig

* Added Pos.Center test to AllViewsTests.cs.
Modernized RadioGroup.
Fixed ProgressBar.

* Reverted formatting

* Reverted formatting

* Reverted formatting

* Reverted formatting

* Reverted formatting

* Reverted formatting

* Reverted formatting

* Code cleanup

* Code cleanup

* Code cleanup

* Code cleanup

* Code cleanup

* Code cleanup

* Code cleanup

* Code cleanup

* Reverted formatting
This commit is contained in:
Tig
2024-01-12 17:43:35 -07:00
committed by GitHub
parent 4cc6339192
commit d2ad11248f
78 changed files with 21739 additions and 20765 deletions

View File

@@ -51,6 +51,8 @@ namespace Terminal.Gui.ViewsTests {
Width = 20,
Height = 20
};
// Needed because HexView relies on LayoutComplete to calc sizes
hv.LayoutSubviews ();
Assert.Empty (hv.Edits);
hv.AllowEdits = false;
@@ -88,6 +90,8 @@ namespace Terminal.Gui.ViewsTests {
Width = 20,
Height = 20
};
// Needed because HexView relies on LayoutComplete to calc sizes
hv.LayoutSubviews ();
Assert.Equal (0, hv.DisplayStart);
@@ -105,8 +109,11 @@ namespace Terminal.Gui.ViewsTests {
public void Edited_Event ()
{
var hv = new HexView (LoadStream (true)) { Width = 20, Height = 20 };
// Needed because HexView relies on LayoutComplete to calc sizes
hv.LayoutSubviews ();
KeyValuePair<long, byte> keyValuePair = default;
hv.Edited += (s,e) => keyValuePair = new KeyValuePair<long, byte>(e.Position,e.NewValue);
hv.Edited += (s, e) => keyValuePair = new KeyValuePair<long, byte> (e.Position, e.NewValue);
Assert.True (hv.NewKeyDownEvent (new (KeyCode.D4)));
Assert.True (hv.NewKeyDownEvent (new (KeyCode.D6)));
@@ -120,6 +127,9 @@ namespace Terminal.Gui.ViewsTests {
public void DiscardEdits_Method ()
{
var hv = new HexView (LoadStream (true)) { Width = 20, Height = 20 };
// Needed because HexView relies on LayoutComplete to calc sizes
hv.LayoutSubviews ();
Assert.True (hv.NewKeyDownEvent (new (KeyCode.D4)));
Assert.True (hv.NewKeyDownEvent (new (KeyCode.D1)));
Assert.Single (hv.Edits);
@@ -135,6 +145,8 @@ namespace Terminal.Gui.ViewsTests {
public void Position_Using_Encoding_Unicode ()
{
var hv = new HexView (LoadStream (true)) { Width = 20, Height = 20 };
// Needed because HexView relies on LayoutComplete to calc sizes
hv.LayoutSubviews ();
Assert.Equal (126, hv.Source.Length);
Assert.Equal (126, hv.Source.Position);
Assert.Equal (1, hv.Position);
@@ -166,6 +178,8 @@ namespace Terminal.Gui.ViewsTests {
public void Position_Using_Encoding_Default ()
{
var hv = new HexView (LoadStream ()) { Width = 20, Height = 20 };
// Needed because HexView relies on LayoutComplete to calc sizes
hv.LayoutSubviews ();
Assert.Equal (63, hv.Source.Length);
Assert.Equal (63, hv.Source.Position);
Assert.Equal (1, hv.Position);
@@ -376,6 +390,9 @@ namespace Terminal.Gui.ViewsTests {
original.CopyTo (copy);
copy.Flush ();
var hv = new HexView (copy) { Width = Dim.Fill (), Height = Dim.Fill () };
// Needed because HexView relies on LayoutComplete to calc sizes
hv.LayoutSubviews ();
byte [] readBuffer = new byte [hv.Source.Length];
hv.Source.Position = 0;
hv.Source.Read (readBuffer);