From cb5c4b0aedc3f6ad50060dae8c8a890c8087534c Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 6 Mar 2025 15:07:01 -0700 Subject: [PATCH 01/25] Subview clean up --- Terminal.Gui/View/Adornment/Adornment.cs | 15 - Terminal.Gui/View/Layout/DimAuto.cs | 8 +- Terminal.Gui/View/View.Command.cs | 2 +- Terminal.Gui/View/View.Hierarchy.cs | 40 +-- Terminal.Gui/View/View.Keyboard.cs | 6 +- Tests/UnitTests/View/SubviewTests.cs | 196 +------------ .../View/SubviewTests.cs | 260 ++++++++++++++---- 7 files changed, 246 insertions(+), 281 deletions(-) diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs index d872db769c..c61c1fc0db 100644 --- a/Terminal.Gui/View/Adornment/Adornment.cs +++ b/Terminal.Gui/View/Adornment/Adornment.cs @@ -82,21 +82,6 @@ public Thickness Thickness #endregion Thickness #region View Overrides - - /// - /// Adornments cannot be used as sub-views (see ); setting this property will throw - /// . - /// - /// - /// While there are no real use cases for an Adornment being a subview, it is not explicitly dis-allowed to support - /// testing. E.g. in AllViewsTester. - /// - public override View? SuperView - { - get => base.SuperView!; - set => throw new InvalidOperationException (@"Adornments can not be Subviews or have SuperViews. Use Parent instead."); - } - /// /// Gets the rectangle that describes the area of the Adornment. The Location is always (0,0). /// The size is the size of the . diff --git a/Terminal.Gui/View/Layout/DimAuto.cs b/Terminal.Gui/View/Layout/DimAuto.cs index 8f5716b1e9..6439e3efe0 100644 --- a/Terminal.Gui/View/Layout/DimAuto.cs +++ b/Terminal.Gui/View/Layout/DimAuto.cs @@ -72,7 +72,7 @@ internal override int Calculate (int location, int superviewContentSize, View us { maxCalculatedSize = textSize; - if (us is { ContentSizeTracksViewport: false, Subviews.Count: 0 }) + if (us is { ContentSizeTracksViewport: false, InternalSubviews.Count: 0 }) { // ContentSize was explicitly set. Use `us.ContentSize` to determine size. maxCalculatedSize = dimension == Dimension.Width ? us.GetContentSize ().Width : us.GetContentSize ().Height; @@ -81,7 +81,7 @@ internal override int Calculate (int location, int superviewContentSize, View us { // TOOD: All the below is a naive implementation. It may be possible to optimize this. - List includedSubviews = us.Subviews.ToList (); + List includedSubviews = us.InternalSubviews.ToList (); // If [x] it can cause `us.ContentSize` to change. // If [ ] it doesn't need special processing for us to determine `us.ContentSize`. @@ -197,11 +197,11 @@ or DimAbsolute if (dimension == Dimension.Width) { - centeredSubViews = us.Subviews.Where (v => v.X.Has (out _)).ToList (); + centeredSubViews = us.InternalSubviews.Where (v => v.X.Has (out _)).ToList (); } else { - centeredSubViews = us.Subviews.Where (v => v.Y.Has (out _)).ToList (); + centeredSubViews = us.InternalSubviews.Where (v => v.Y.Has (out _)).ToList (); } viewsNeedingLayout.AddRange (centeredSubViews); diff --git a/Terminal.Gui/View/View.Command.cs b/Terminal.Gui/View/View.Command.cs index 6b33782265..74c86a58c0 100644 --- a/Terminal.Gui/View/View.Command.cs +++ b/Terminal.Gui/View/View.Command.cs @@ -91,7 +91,7 @@ private void SetupCommands () if (!args.Cancel) { // If there's an IsDefault peer view in Subviews, try it - var isDefaultView = SuperView?.Subviews.FirstOrDefault (v => v is Button { IsDefault: true }); + var isDefaultView = SuperView?.InternalSubviews.FirstOrDefault (v => v is Button { IsDefault: true }); if (isDefaultView != this && isDefaultView is Button { IsDefault: true } button) { diff --git a/Terminal.Gui/View/View.Hierarchy.cs b/Terminal.Gui/View/View.Hierarchy.cs index 5a0705adae..556e2f3bb0 100644 --- a/Terminal.Gui/View/View.Hierarchy.cs +++ b/Terminal.Gui/View/View.Hierarchy.cs @@ -15,18 +15,19 @@ public partial class View // SuperView/SubView hierarchy management (SuperView, // to make the same mistakes our users make when they poke at the Subviews. internal IList InternalSubviews => _subviews ?? _empty; - /// This returns a list of the subviews contained by this view. - /// The subviews. + /// Gets the list of Subviews. + /// + /// Use and to add or remove subviews. + /// public IList Subviews => _subviews?.AsReadOnly () ?? _empty; private View? _superView; - /// Returns the container for this view, or null if this view has not been added to a container. - /// The super view. - public virtual View? SuperView + /// Gets this Views SuperView (the View's container), or if this view has not been added as a Subview. + public View? SuperView { get => _superView!; - set => throw new NotImplementedException (); + set => throw new InvalidOperationException (@"SuperView cannot be set."); } #region AddRemove @@ -34,7 +35,7 @@ public virtual View? SuperView /// Indicates whether the view was added to . public bool IsAdded { get; private set; } - /// Adds a subview (child) to this view. + /// Adds a Subview (child) to this view. /// /// /// The Views that have been added to this view can be retrieved via the property. See also @@ -94,7 +95,7 @@ public virtual View? SuperView return view; } - /// Adds the specified views (children) to the view. + /// Adds the specified Subview (children) to the view. /// Array of one or more views (can be optional parameter). /// /// @@ -119,28 +120,29 @@ public void Add (params View []? views) } } - /// Event fired when this view is added to another. + // TODO: Make these events follow the standard pattern + /// Raised when a Subview has been added to this View. public event EventHandler? Added; - /// Method invoked when a subview is being added to this view. + /// Method invoked when a Subview has been added to this view. /// Event where is the subview being added. - public virtual void OnAdded (SuperViewChangedEventArgs e) + protected virtual void OnAdded (SuperViewChangedEventArgs e) { View view = e.SubView; view.IsAdded = true; view.Added?.Invoke (this, e); } - /// Method invoked when a subview is being removed from this view. + /// Method invoked when a Subview is being removed from this view. /// Event args describing the subview being removed. - public virtual void OnRemoved (SuperViewChangedEventArgs e) + protected virtual void OnRemoved (SuperViewChangedEventArgs e) { View view = e.SubView; view.IsAdded = false; view.Removed?.Invoke (this, e); } - /// Removes a subview added via or from this View. + /// Removes a Subview added via or from this View. /// /// /// Normally Subviews will be disposed when this View is disposed. Removing a Subview causes ownership of the @@ -208,7 +210,7 @@ public virtual void OnRemoved (SuperViewChangedEventArgs e) } /// - /// Removes all subviews (children) added via or from this View. + /// Removes all Subview (children) added via or from this View. /// /// /// @@ -231,15 +233,15 @@ public virtual void RemoveAll () } } - /// Event fired when this view is removed from another. + /// Raised when a Subview has been removed from this View. public event EventHandler? Removed; #endregion AddRemove - // TODO: Mark as internal. Or nuke. + // TODO: This drives a weird coupling of Application.Top and View. It's not clear why this is needed. /// Get the top superview of a given . /// The superview view. - public View? GetTopSuperView (View? view = null, View? superview = null) + internal View? GetTopSuperView (View? view = null, View? superview = null) { View? top = superview ?? Application.Top; @@ -275,7 +277,7 @@ public static bool IsInHierarchy (View? start, View? view, bool includeAdornment return true; } - foreach (View subView in start.Subviews) + foreach (View subView in start.InternalSubviews) { if (view == subView) { diff --git a/Terminal.Gui/View/View.Keyboard.cs b/Terminal.Gui/View/View.Keyboard.cs index cc21f6203c..44e3efa3d9 100644 --- a/Terminal.Gui/View/View.Keyboard.cs +++ b/Terminal.Gui/View/View.Keyboard.cs @@ -562,12 +562,12 @@ private static bool InvokeCommandsBoundToKeyOnAdornment (Adornment adornment, Ke return true; } - if (adornment?.Subviews is null) + if (adornment?.InternalSubviews is null) { return false; } - foreach (View subview in adornment.Subviews) + foreach (View subview in adornment.InternalSubviews) { bool? subViewHandled = subview.InvokeCommands (key); @@ -604,7 +604,7 @@ internal bool InvokeCommandsBoundToHotKey (Key hotKey, ref bool? handled) } // Now, process any HotKey bindings in the subviews - foreach (View subview in Subviews) + foreach (View subview in InternalSubviews) { if (subview == Focused) { diff --git a/Tests/UnitTests/View/SubviewTests.cs b/Tests/UnitTests/View/SubviewTests.cs index 666a282e01..0727197576 100644 --- a/Tests/UnitTests/View/SubviewTests.cs +++ b/Tests/UnitTests/View/SubviewTests.cs @@ -1,6 +1,4 @@ -using System.Text; -using UnitTests; -using Xunit.Abstractions; +using Xunit.Abstractions; namespace Terminal.Gui.ViewTests; @@ -9,194 +7,8 @@ public class SubviewTests private readonly ITestOutputHelper _output; public SubviewTests (ITestOutputHelper output) { _output = output; } + // TODO: This is a poor unit tests. Not clear what it's testing. Refactor. [Fact] - [AutoInitShutdown] - public void GetTopSuperView_Test () - { - var v1 = new View (); - var fv1 = new FrameView (); - fv1.Add (v1); - var tf1 = new TextField (); - var w1 = new Window (); - w1.Add (fv1, tf1); - var top1 = new Toplevel (); - top1.Add (w1); - - var v2 = new View (); - var fv2 = new FrameView (); - fv2.Add (v2); - var tf2 = new TextField (); - var w2 = new Window (); - w2.Add (fv2, tf2); - var top2 = new Toplevel (); - top2.Add (w2); - - Assert.Equal (top1, v1.GetTopSuperView ()); - Assert.Equal (top2, v2.GetTopSuperView ()); - - v1.Dispose (); - fv1.Dispose (); - tf1.Dispose (); - w1.Dispose (); - top1.Dispose (); - v2.Dispose (); - fv2.Dispose (); - tf2.Dispose (); - w2.Dispose (); - top2.Dispose (); - } - - [Fact] - [TestRespondersDisposed] - public void Initialized_Event_Comparing_With_Added_Event () - { - Application.Init (new FakeDriver ()); - - var top = new Toplevel { Id = "0" }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 80, 25 - - var winAddedToTop = new Window - { - Id = "t", Width = Dim.Fill (), Height = Dim.Fill () - }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 78, 23 - - var v1AddedToWin = new View - { - Id = "v1", Width = Dim.Fill (), Height = Dim.Fill () - }; // Frame: 1, 1, 78, 23 (because Windows has a border) - - var v2AddedToWin = new View - { - Id = "v2", Width = Dim.Fill (), Height = Dim.Fill () - }; // Frame: 1, 1, 78, 23 (because Windows has a border) - - var svAddedTov1 = new View - { - Id = "sv1", Width = Dim.Fill (), Height = Dim.Fill () - }; // Frame: 1, 1, 78, 23 (same as it's superview v1AddedToWin) - - int tc = 0, wc = 0, v1c = 0, v2c = 0, sv1c = 0; - - winAddedToTop.Added += (s, e) => - { - Assert.Equal (e.SuperView.Frame.Width, winAddedToTop.Frame.Width); - Assert.Equal (e.SuperView.Frame.Height, winAddedToTop.Frame.Height); - }; - - v1AddedToWin.Added += (s, e) => - { - Assert.Equal (e.SuperView.Frame.Width, v1AddedToWin.Frame.Width); - Assert.Equal (e.SuperView.Frame.Height, v1AddedToWin.Frame.Height); - }; - - v2AddedToWin.Added += (s, e) => - { - Assert.Equal (e.SuperView.Frame.Width, v2AddedToWin.Frame.Width); - Assert.Equal (e.SuperView.Frame.Height, v2AddedToWin.Frame.Height); - }; - - svAddedTov1.Added += (s, e) => - { - Assert.Equal (e.SuperView.Frame.Width, svAddedTov1.Frame.Width); - Assert.Equal (e.SuperView.Frame.Height, svAddedTov1.Frame.Height); - }; - - top.Initialized += (s, e) => - { - tc++; - Assert.Equal (1, tc); - Assert.Equal (1, wc); - Assert.Equal (1, v1c); - Assert.Equal (1, v2c); - Assert.Equal (1, sv1c); - - Assert.True (top.CanFocus); - Assert.True (winAddedToTop.CanFocus); - Assert.False (v1AddedToWin.CanFocus); - Assert.False (v2AddedToWin.CanFocus); - Assert.False (svAddedTov1.CanFocus); - - Application.LayoutAndDraw (); - }; - - winAddedToTop.Initialized += (s, e) => - { - wc++; - Assert.Equal (top.Viewport.Width, winAddedToTop.Frame.Width); - Assert.Equal (top.Viewport.Height, winAddedToTop.Frame.Height); - }; - - v1AddedToWin.Initialized += (s, e) => - { - v1c++; - - // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 - // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. - // in no way should the v1AddedToWin.Frame be the same as the Top.Frame/Viewport - // as it is a subview of winAddedToTop, which has a border! - //Assert.Equal (top.Viewport.Width, v1AddedToWin.Frame.Width); - //Assert.Equal (top.Viewport.Height, v1AddedToWin.Frame.Height); - }; - - v2AddedToWin.Initialized += (s, e) => - { - v2c++; - - // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 - // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. - // in no way should the v2AddedToWin.Frame be the same as the Top.Frame/Viewport - // as it is a subview of winAddedToTop, which has a border! - //Assert.Equal (top.Viewport.Width, v2AddedToWin.Frame.Width); - //Assert.Equal (top.Viewport.Height, v2AddedToWin.Frame.Height); - }; - - svAddedTov1.Initialized += (s, e) => - { - sv1c++; - - // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 - // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. - // in no way should the svAddedTov1.Frame be the same as the Top.Frame/Viewport - // because sv1AddedTov1 is a subview of v1AddedToWin, which is a subview of - // winAddedToTop, which has a border! - //Assert.Equal (top.Viewport.Width, svAddedTov1.Frame.Width); - //Assert.Equal (top.Viewport.Height, svAddedTov1.Frame.Height); - Assert.False (svAddedTov1.CanFocus); - //Assert.Throws (() => svAddedTov1.CanFocus = true); - Assert.False (svAddedTov1.CanFocus); - }; - - v1AddedToWin.Add (svAddedTov1); - winAddedToTop.Add (v1AddedToWin, v2AddedToWin); - top.Add (winAddedToTop); - - Application.Iteration += (s, a) => - { - Application.LayoutAndDraw (); - top.Running = false; - }; - - Application.Run (top); - top.Dispose (); - Application.Shutdown (); - - Assert.Equal (1, tc); - Assert.Equal (1, wc); - Assert.Equal (1, v1c); - Assert.Equal (1, v2c); - Assert.Equal (1, sv1c); - - Assert.True (top.CanFocus); - Assert.True (winAddedToTop.CanFocus); - Assert.False (v1AddedToWin.CanFocus); - Assert.False (v2AddedToWin.CanFocus); - Assert.False (svAddedTov1.CanFocus); - - v1AddedToWin.CanFocus = true; - Assert.False (svAddedTov1.CanFocus); // False because sv1 was disposed and it isn't a subview of v1. - } - - [Fact] - [TestRespondersDisposed] public void Initialized_Event_Will_Be_Invoked_When_Added_Dynamically () { Application.Init (new FakeDriver ()); @@ -261,6 +73,7 @@ public void Initialized_Event_Will_Be_Invoked_When_Added_Dynamically () Assert.NotEqual (t.Frame.Width, sv1.Frame.Width); Assert.NotEqual (t.Frame.Height, sv1.Frame.Height); Assert.False (sv1.CanFocus); + //Assert.Throws (() => sv1.CanFocus = true); Assert.False (sv1.CanFocus); }; @@ -285,4 +98,5 @@ public void Initialized_Event_Will_Be_Invoked_When_Added_Dynamically () Assert.True (w.CanFocus); Assert.False (v1.CanFocus); Assert.False (v2.CanFocus); - }} + } +} diff --git a/Tests/UnitTestsParallelizable/View/SubviewTests.cs b/Tests/UnitTestsParallelizable/View/SubviewTests.cs index 7362ea625c..a0c7f9138d 100644 --- a/Tests/UnitTestsParallelizable/View/SubviewTests.cs +++ b/Tests/UnitTestsParallelizable/View/SubviewTests.cs @@ -1,16 +1,11 @@ -using Xunit.Abstractions; - -namespace Terminal.Gui.ViewTests; +namespace Terminal.Gui.ViewTests; public class SubviewTests { - private readonly ITestOutputHelper _output; - public SubviewTests (ITestOutputHelper output) { _output = output; } - [Fact] public void Added_Removed () { - var v = new View { Frame = new Rectangle (0, 0, 10, 24) }; + var v = new View { Frame = new (0, 0, 10, 24) }; var t = new View (); v.Added += (s, e) => @@ -32,12 +27,8 @@ public void Added_Removed () t.Remove (v); Assert.True (t.Subviews.Count == 0); - - t.Dispose (); - v.Dispose (); } - [Fact] public void IsAdded_Added_Removed () { @@ -48,9 +39,6 @@ public void IsAdded_Added_Removed () Assert.True (view.IsAdded); top.Remove (view); Assert.False (view.IsAdded); - - top.Dispose (); - view.Dispose (); } // TODO: Consider a feature that will change the ContentSize to fit the subviews. @@ -60,15 +48,15 @@ public void Add_Does_Not_Impact_ContentSize () var view = new View (); view.SetContentSize (new Size (1, 1)); - var subview = new View () + var subview = new View { X = 10, Y = 10 }; - Assert.Equal (new Size (1, 1), view.GetContentSize ()); + Assert.Equal (new (1, 1), view.GetContentSize ()); view.Add (subview); - Assert.Equal (new Size (1, 1), view.GetContentSize ()); + Assert.Equal (new (1, 1), view.GetContentSize ()); } [Fact] @@ -77,21 +65,21 @@ public void Remove_Does_Not_Impact_ContentSize () var view = new View (); view.SetContentSize (new Size (1, 1)); - var subview = new View () + var subview = new View { X = 10, Y = 10 }; - Assert.Equal (new Size (1, 1), view.GetContentSize ()); + Assert.Equal (new (1, 1), view.GetContentSize ()); view.Add (subview); - Assert.Equal (new Size (1, 1), view.GetContentSize ()); + Assert.Equal (new (1, 1), view.GetContentSize ()); view.SetContentSize (new Size (5, 5)); - Assert.Equal (new Size (5, 5), view.GetContentSize ()); + Assert.Equal (new (5, 5), view.GetContentSize ()); view.Remove (subview); - Assert.Equal (new Size (5, 5), view.GetContentSize ()); + Assert.Equal (new (5, 5), view.GetContentSize ()); } [Fact] @@ -99,17 +87,17 @@ public void MoveSubviewToStart () { View superView = new (); - View subview1 = new View () + var subview1 = new View { Id = "subview1" }; - View subview2 = new View () + var subview2 = new View { Id = "subview2" }; - View subview3 = new View () + var subview3 = new View { Id = "subview3" }; @@ -117,29 +105,28 @@ public void MoveSubviewToStart () superView.Add (subview1, subview2, subview3); superView.MoveSubviewToStart (subview2); - Assert.Equal(subview2, superView.Subviews [0]); + Assert.Equal (subview2, superView.Subviews [0]); superView.MoveSubviewToStart (subview3); Assert.Equal (subview3, superView.Subviews [0]); } - [Fact] public void MoveSubviewTowardsFront () { View superView = new (); - View subview1 = new View () + var subview1 = new View { Id = "subview1" }; - View subview2 = new View () + var subview2 = new View { Id = "subview2" }; - View subview3 = new View () + var subview3 = new View { Id = "subview3" }; @@ -162,17 +149,17 @@ public void MoveSubviewToEnd () { View superView = new (); - View subview1 = new View () + var subview1 = new View { Id = "subview1" }; - View subview2 = new View () + var subview2 = new View { Id = "subview2" }; - View subview3 = new View () + var subview3 = new View { Id = "subview3" }; @@ -186,23 +173,22 @@ public void MoveSubviewToEnd () Assert.Equal (subview2, superView.Subviews [^1]); } - [Fact] public void MoveSubviewTowardsEnd () { View superView = new (); - View subview1 = new View () + var subview1 = new View { Id = "subview1" }; - View subview2 = new View () + var subview2 = new View { Id = "subview2" }; - View subview3 = new View () + var subview3 = new View { Id = "subview3" }; @@ -227,7 +213,7 @@ public void IsInHierarchy_ViewIsNull_ReturnsFalse () var start = new View (); // Act - var result = View.IsInHierarchy (start, null); + bool result = View.IsInHierarchy (start, null); // Assert Assert.False (result); @@ -240,7 +226,7 @@ public void IsInHierarchy_StartIsNull_ReturnsFalse () var view = new View (); // Act - var result = View.IsInHierarchy (null, view); + bool result = View.IsInHierarchy (null, view); // Assert Assert.False (result); @@ -253,7 +239,7 @@ public void IsInHierarchy_ViewIsStart_ReturnsTrue () var start = new View (); // Act - var result = View.IsInHierarchy (start, start); + bool result = View.IsInHierarchy (start, start); // Assert Assert.True (result); @@ -268,7 +254,7 @@ public void IsInHierarchy_ViewIsDirectSubview_ReturnsTrue () start.Add (subview); // Act - var result = View.IsInHierarchy (start, subview); + bool result = View.IsInHierarchy (start, subview); // Assert Assert.True (result); @@ -285,7 +271,7 @@ public void IsInHierarchy_ViewIsNestedSubview_ReturnsTrue () subview.Add (nestedSubview); // Act - var result = View.IsInHierarchy (start, nestedSubview); + bool result = View.IsInHierarchy (start, nestedSubview); // Assert Assert.True (result); @@ -299,7 +285,7 @@ public void IsInHierarchy_ViewIsNotInHierarchy_ReturnsFalse () var subview = new View (); // Act - var result = View.IsInHierarchy (start, subview); + bool result = View.IsInHierarchy (start, subview); // Assert Assert.False (result); @@ -310,21 +296,199 @@ public void IsInHierarchy_ViewIsNotInHierarchy_ReturnsFalse () public void IsInHierarchy_ViewIsInAdornments_ReturnsTrue (bool includeAdornments) { // Arrange - var start = new View () + var start = new View { Id = "start" }; - var inPadding = new View () + + var inPadding = new View { Id = "inPadding" }; - start.Padding.Add (inPadding); + start.Padding!.Add (inPadding); // Act - var result = View.IsInHierarchy (start, inPadding, includeAdornments: includeAdornments); + bool result = View.IsInHierarchy (start, inPadding, includeAdornments); // Assert - Assert.Equal(includeAdornments, result); + Assert.Equal (includeAdornments, result); + } + + [Fact] + public void GetTopSuperView_Test () + { + var v1 = new View (); + var fv1 = new FrameView (); + fv1.Add (v1); + var tf1 = new TextField (); + var w1 = new Window (); + w1.Add (fv1, tf1); + var top1 = new Toplevel (); + top1.Add (w1); + + var v2 = new View (); + var fv2 = new FrameView (); + fv2.Add (v2); + var tf2 = new TextField (); + var w2 = new Window (); + w2.Add (fv2, tf2); + var top2 = new Toplevel (); + top2.Add (w2); + + Assert.Equal (top1, v1.GetTopSuperView ()); + Assert.Equal (top2, v2.GetTopSuperView ()); + + v1.Dispose (); + fv1.Dispose (); + tf1.Dispose (); + w1.Dispose (); + top1.Dispose (); + v2.Dispose (); + fv2.Dispose (); + tf2.Dispose (); + w2.Dispose (); + top2.Dispose (); + } + + + [Fact] + public void Initialized_Event_Comparing_With_Added_Event () + { + var top = new Toplevel { Id = "0" }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 80, 25 + + var winAddedToTop = new Window + { + Id = "t", Width = Dim.Fill (), Height = Dim.Fill () + }; // Frame: 0, 0, 80, 25; Viewport: 0, 0, 78, 23 + + var v1AddedToWin = new View + { + Id = "v1", Width = Dim.Fill (), Height = Dim.Fill () + }; // Frame: 1, 1, 78, 23 (because Windows has a border) + + var v2AddedToWin = new View + { + Id = "v2", Width = Dim.Fill (), Height = Dim.Fill () + }; // Frame: 1, 1, 78, 23 (because Windows has a border) + + var svAddedTov1 = new View + { + Id = "sv1", Width = Dim.Fill (), Height = Dim.Fill () + }; // Frame: 1, 1, 78, 23 (same as it's superview v1AddedToWin) + + int tc = 0, wc = 0, v1c = 0, v2c = 0, sv1c = 0; + + winAddedToTop.Added += (s, e) => + { + Assert.Equal (e.SuperView.Frame.Width, winAddedToTop.Frame.Width); + Assert.Equal (e.SuperView.Frame.Height, winAddedToTop.Frame.Height); + }; + + v1AddedToWin.Added += (s, e) => + { + Assert.Equal (e.SuperView.Frame.Width, v1AddedToWin.Frame.Width); + Assert.Equal (e.SuperView.Frame.Height, v1AddedToWin.Frame.Height); + }; + + v2AddedToWin.Added += (s, e) => + { + Assert.Equal (e.SuperView.Frame.Width, v2AddedToWin.Frame.Width); + Assert.Equal (e.SuperView.Frame.Height, v2AddedToWin.Frame.Height); + }; + + svAddedTov1.Added += (s, e) => + { + Assert.Equal (e.SuperView.Frame.Width, svAddedTov1.Frame.Width); + Assert.Equal (e.SuperView.Frame.Height, svAddedTov1.Frame.Height); + }; + + top.Initialized += (s, e) => + { + tc++; + Assert.Equal (1, tc); + Assert.Equal (1, wc); + Assert.Equal (1, v1c); + Assert.Equal (1, v2c); + Assert.Equal (1, sv1c); + + Assert.True (top.CanFocus); + Assert.True (winAddedToTop.CanFocus); + Assert.False (v1AddedToWin.CanFocus); + Assert.False (v2AddedToWin.CanFocus); + Assert.False (svAddedTov1.CanFocus); + + Application.LayoutAndDraw (); + }; + + winAddedToTop.Initialized += (s, e) => + { + wc++; + Assert.Equal (top.Viewport.Width, winAddedToTop.Frame.Width); + Assert.Equal (top.Viewport.Height, winAddedToTop.Frame.Height); + }; + + v1AddedToWin.Initialized += (s, e) => + { + v1c++; + + // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 + // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. + // in no way should the v1AddedToWin.Frame be the same as the Top.Frame/Viewport + // as it is a subview of winAddedToTop, which has a border! + //Assert.Equal (top.Viewport.Width, v1AddedToWin.Frame.Width); + //Assert.Equal (top.Viewport.Height, v1AddedToWin.Frame.Height); + }; + + v2AddedToWin.Initialized += (s, e) => + { + v2c++; + + // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 + // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. + // in no way should the v2AddedToWin.Frame be the same as the Top.Frame/Viewport + // as it is a subview of winAddedToTop, which has a border! + //Assert.Equal (top.Viewport.Width, v2AddedToWin.Frame.Width); + //Assert.Equal (top.Viewport.Height, v2AddedToWin.Frame.Height); + }; + + svAddedTov1.Initialized += (s, e) => + { + sv1c++; + + // Top.Frame: 0, 0, 80, 25; Top.Viewport: 0, 0, 80, 25 + // BUGBUG: This is wrong, it should be 78, 23. This test has always been broken. + // in no way should the svAddedTov1.Frame be the same as the Top.Frame/Viewport + // because sv1AddedTov1 is a subview of v1AddedToWin, which is a subview of + // winAddedToTop, which has a border! + //Assert.Equal (top.Viewport.Width, svAddedTov1.Frame.Width); + //Assert.Equal (top.Viewport.Height, svAddedTov1.Frame.Height); + Assert.False (svAddedTov1.CanFocus); + //Assert.Throws (() => svAddedTov1.CanFocus = true); + Assert.False (svAddedTov1.CanFocus); + }; + + v1AddedToWin.Add (svAddedTov1); + winAddedToTop.Add (v1AddedToWin, v2AddedToWin); + top.Add (winAddedToTop); + + top.BeginInit (); + top.EndInit (); + + Assert.Equal (1, tc); + Assert.Equal (1, wc); + Assert.Equal (1, v1c); + Assert.Equal (1, v2c); + Assert.Equal (1, sv1c); + + Assert.True (top.CanFocus); + Assert.True (winAddedToTop.CanFocus); + Assert.False (v1AddedToWin.CanFocus); + Assert.False (v2AddedToWin.CanFocus); + Assert.False (svAddedTov1.CanFocus); + + v1AddedToWin.CanFocus = true; + Assert.False (svAddedTov1.CanFocus); // False because sv1 was disposed and it isn't a subview of v1. } + } From 2b9ca779431d7e8c0374c9da54d95800d552bcc5 Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 6 Mar 2025 16:29:23 -0700 Subject: [PATCH 02/25] New Add/Remove event pattern --- .../View/SuperViewChangedEventArgs.cs | 4 +- Terminal.Gui/View/View.Hierarchy.cs | 107 ++++++++-- Terminal.Gui/Views/ComboBox.cs | 2 +- Terminal.Gui/Views/Menu/MenuBar.cs | 6 +- Terminal.Gui/Views/MenuBarv2.cs | 11 +- Terminal.Gui/Views/Menuv2.cs | 9 +- Terminal.Gui/Views/StatusBar.cs | 11 +- Terminal.Gui/Views/TextField.cs | 21 +- Terminal.Gui/Views/TextView.cs | 17 +- Tests/StressTests/ScenariosStressTests.cs | 2 +- Tests/UnitTests/Views/ToplevelTests.cs | 183 ++++++++++-------- .../View/SubviewTests.cs | 117 +++++++---- UICatalog/KeyBindingsDialog.cs | 6 +- 13 files changed, 309 insertions(+), 187 deletions(-) diff --git a/Terminal.Gui/View/SuperViewChangedEventArgs.cs b/Terminal.Gui/View/SuperViewChangedEventArgs.cs index 59ddc4ce6f..1090980794 100644 --- a/Terminal.Gui/View/SuperViewChangedEventArgs.cs +++ b/Terminal.Gui/View/SuperViewChangedEventArgs.cs @@ -2,7 +2,7 @@ /// /// Args for events where the of a is changed (e.g. -/// / events). +/// / events). /// public class SuperViewChangedEventArgs : EventArgs { @@ -20,7 +20,7 @@ public SuperViewChangedEventArgs (View superView, View subView) /// /// The parent. For this is the old parent (new parent now being null). For - /// it is the new parent to whom view now belongs. + /// it is the new parent to whom view now belongs. /// public View SuperView { get; } } diff --git a/Terminal.Gui/View/View.Hierarchy.cs b/Terminal.Gui/View/View.Hierarchy.cs index 556e2f3bb0..dd29e09c3e 100644 --- a/Terminal.Gui/View/View.Hierarchy.cs +++ b/Terminal.Gui/View/View.Hierarchy.cs @@ -1,6 +1,7 @@ #nullable enable using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using Unix.Terminal; namespace Terminal.Gui; @@ -32,9 +33,40 @@ public View? SuperView #region AddRemove + private bool _isAdded; + /// Indicates whether the view was added to . - public bool IsAdded { get; private set; } + public bool IsAdded + { + get => _isAdded; + private set + { + if (_isAdded == value) + { + return; + } + _isAdded = value; + RaiseIsAddedChanged (); + } + } + + internal void RaiseIsAddedChanged () + { + // Tell subclasses that a subview has been added + EventArgs args = new EventArgs (IsAdded); + OnIsAddedChanged (args); + + IsAddedChanged?.Invoke (this, args); + } + + /// Raised when this View has been added to a SuperView. + public event EventHandler>? IsAddedChanged; + /// Method invoked when a Subview has been added to this view. + /// The new value of IsAdded + protected virtual void OnIsAddedChanged (EventArgs newValue) + { + } /// Adds a Subview (child) to this view. /// /// @@ -45,6 +77,9 @@ public View? SuperView /// Subviews will be disposed when this View is disposed. In other-words, calling this method causes /// the lifecycle of the subviews to be transferred to this View. /// + /// + /// Calls/Raises the / event. + /// /// /// The view to add. /// The view that was added. @@ -59,13 +94,17 @@ public View? SuperView _subviews = []; } + Debug.WriteLineIf (view.IsAdded, $"WARNING: {view} already has IsAdded == true."); Debug.WriteLineIf (_subviews.Contains (view), $"WARNING: {view} has already been added to {this}."); // TileView likes to add views that were previously added and have HasFocus = true. No bueno. view.HasFocus = false; + // TODO: Make this thread safe _subviews.Add (view); view._superView = this; + // This causes IsAddedChanged to be raised on view + view.IsAdded = true; if (view is { Enabled: true, Visible: true, CanFocus: true }) { @@ -81,7 +120,9 @@ public View? SuperView view.Enabled = false; } - OnAdded (new (this, view)); + // Raise event indicating a subview has been added + // We do this before Init. + RaiseSubViewAdded (view); if (IsInitialized && !view.IsInitialized) { @@ -120,28 +161,30 @@ public void Add (params View []? views) } } - // TODO: Make these events follow the standard pattern - /// Raised when a Subview has been added to this View. - public event EventHandler? Added; - - /// Method invoked when a Subview has been added to this view. - /// Event where is the subview being added. - protected virtual void OnAdded (SuperViewChangedEventArgs e) + internal void RaiseSubViewAdded (View view) { - View view = e.SubView; - view.IsAdded = true; - view.Added?.Invoke (this, e); + OnSubViewAdded (view); + SubViewAdded?.Invoke (this, new SuperViewChangedEventArgs (this, view)); } - /// Method invoked when a Subview is being removed from this view. - /// Event args describing the subview being removed. - protected virtual void OnRemoved (SuperViewChangedEventArgs e) + /// + /// Called when a Subview has been added to this View. + /// + /// + /// If the Subview has not been initialized, this happens before BeginInit/EndInit is called. + /// + /// + protected virtual void OnSubViewAdded (View view) { - View view = e.SubView; - view.IsAdded = false; - view.Removed?.Invoke (this, e); } + /// Raised when a Subview has been added to this View. + /// + /// If the Subview has not been initialized, this happens before BeginInit/EndInit is called. + /// + public event EventHandler? SubViewAdded; + + /// Removes a Subview added via or from this View. /// /// @@ -149,6 +192,9 @@ protected virtual void OnRemoved (SuperViewChangedEventArgs e) /// Subview's /// lifecycle to be transferred to the caller; the caller must call . /// + /// + /// Calls/Raises the / event. + /// /// /// /// The removed View. if the View could not be removed. @@ -165,6 +211,9 @@ protected virtual void OnRemoved (SuperViewChangedEventArgs e) return view; } + Debug.WriteLineIf (!view.IsAdded, $"WARNING: {view} already has IsAdded == false."); + Debug.WriteLineIf (!_subviews.Contains (view), $"WARNING: {view} has not been added to {this}."); + Rectangle touched = view.Frame; bool hadFocus = view.HasFocus; @@ -186,6 +235,9 @@ protected virtual void OnRemoved (SuperViewChangedEventArgs e) } view._superView = null; + // This causes IsAddedChanged to be raised on view + view.IsAdded = false; + SetNeedsLayout (); SetNeedsDraw (); @@ -204,11 +256,28 @@ protected virtual void OnRemoved (SuperViewChangedEventArgs e) _previouslyFocused = null; } - OnRemoved (new (this, view)); + RaiseSubViewRemoved (view); return view; } + internal void RaiseSubViewRemoved (View view) + { + OnSubViewRemoved (view); + SubViewRemoved?.Invoke (this, new SuperViewChangedEventArgs (this, view)); + } + + /// + /// Called when a Subview has been removed from this View. + /// + /// + protected virtual void OnSubViewRemoved (View view) + { + } + + /// Raised when a Subview has been added to this View. + public event EventHandler? SubViewRemoved; + /// /// Removes all Subview (children) added via or from this View. /// diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 7b30e09cfb..687b94f349 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -59,7 +59,7 @@ public ComboBox () // On resize SubviewsLaidOut += (sender, a) => ProcessLayout (); - Added += (s, e) => + IsAddedChanged += (s, e) => { // Determine if this view is hosted inside a dialog and is the only control for (View view = SuperView; view != null; view = view.SuperView) diff --git a/Terminal.Gui/Views/Menu/MenuBar.cs b/Terminal.Gui/Views/Menu/MenuBar.cs index a9b0676dd8..98d5a0a259 100644 --- a/Terminal.Gui/Views/Menu/MenuBar.cs +++ b/Terminal.Gui/Views/Menu/MenuBar.cs @@ -84,7 +84,7 @@ public MenuBar () WantMousePositionReports = true; IsMenuOpen = false; - Added += MenuBar_Added; + IsAddedChanged += MenuBar_IsAddedChanged; // Things this view knows how to do AddCommand ( @@ -1157,10 +1157,10 @@ private Point GetLocationOffset () return new (-2, 0); } - private void MenuBar_Added (object? sender, SuperViewChangedEventArgs e) + private void MenuBar_IsAddedChanged (object? sender, EventArgs e) { _initialCanFocus = CanFocus; - Added -= MenuBar_Added; + IsAddedChanged -= MenuBar_IsAddedChanged; } private void MoveLeft () diff --git a/Terminal.Gui/Views/MenuBarv2.cs b/Terminal.Gui/Views/MenuBarv2.cs index 7eb470968b..e7c5011d86 100644 --- a/Terminal.Gui/Views/MenuBarv2.cs +++ b/Terminal.Gui/Views/MenuBarv2.cs @@ -34,14 +34,11 @@ private void MenuBarv2_LayoutStarted (object sender, LayoutEventArgs e) } /// - public override View Add (View view) + protected override void OnSubViewAdded (View subView) { - // Call base first, because otherwise it resets CanFocus to true - base.Add (view); + subView.CanFocus = false; - view.CanFocus = true; - - if (view is Shortcut shortcut) + if (subView is Shortcut shortcut) { // TODO: not happy about using AlignmentModes for this. Too implied. // TODO: instead, add a property (a style enum?) to Shortcut to control this @@ -50,7 +47,5 @@ public override View Add (View view) shortcut.KeyView.Visible = false; shortcut.HelpView.Visible = false; } - - return view; } } diff --git a/Terminal.Gui/Views/Menuv2.cs b/Terminal.Gui/Views/Menuv2.cs index 609fb962c2..555f585c6e 100644 --- a/Terminal.Gui/Views/Menuv2.cs +++ b/Terminal.Gui/Views/Menuv2.cs @@ -63,11 +63,10 @@ protected override void OnSubviewLayout (LayoutEventArgs args) } /// - public override View Add (View view) + /// + protected override void OnSubViewAdded (View subView) { - base.Add (view); - - if (view is Shortcut shortcut) + if (subView is Shortcut shortcut) { shortcut.CanFocus = true; shortcut.Orientation = Orientation.Vertical; @@ -95,7 +94,5 @@ void ShortcutOnAccept (object sender, CommandEventArgs e) //} } } - - return view; } } diff --git a/Terminal.Gui/Views/StatusBar.cs b/Terminal.Gui/Views/StatusBar.cs index 84914ab558..2f1ed36dc4 100644 --- a/Terminal.Gui/Views/StatusBar.cs +++ b/Terminal.Gui/Views/StatusBar.cs @@ -57,21 +57,16 @@ private void StatusBar_LayoutStarted (object sender, LayoutEventArgs e) } /// - public override View Add (View view) + protected override void OnSubViewAdded (View subView) { - // Call base first, because otherwise it resets CanFocus to true - base.Add (view); + subView.CanFocus = false; - view.CanFocus = false; - - if (view is Shortcut shortcut) + if (subView is Shortcut shortcut) { // TODO: not happy about using AlignmentModes for this. Too implied. // TODO: instead, add a property (a style enum?) to Shortcut to control this shortcut.AlignmentModes = AlignmentModes.EndToStart; } - - return view; } /// diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index 5bb386ca72..560ac89262 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -45,9 +45,7 @@ public TextField () Initialized += TextField_Initialized; - Added += TextField_Added; - - Removed += TextField_Removed; + IsAddedChanged += TextField_IsAddedChanged; // Things this view knows how to do AddCommand ( @@ -1820,17 +1818,22 @@ private void ShowContextMenu () ContextMenu.Show (BuildContextMenuBarItem ()); } - private void TextField_Added (object sender, SuperViewChangedEventArgs e) + private void TextField_IsAddedChanged (object sender, EventArgs e) { - if (Autocomplete.HostControl is null) + if (e.CurrentValue) { - Autocomplete.HostControl = this; - Autocomplete.PopupInsideContainer = false; + if (Autocomplete.HostControl is null) + { + Autocomplete.HostControl = this; + Autocomplete.PopupInsideContainer = false; + } + } + else + { + Autocomplete.HostControl = null; } } - private void TextField_Removed (object sender, SuperViewChangedEventArgs e) { Autocomplete.HostControl = null; } - private void TextField_Initialized (object sender, EventArgs e) { _cursorPosition = Text.GetRuneCount (); diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs index 0dbd1f960f..a8a925d2c7 100644 --- a/Terminal.Gui/Views/TextView.cs +++ b/Terminal.Gui/Views/TextView.cs @@ -1899,7 +1899,7 @@ public TextView () Initialized += TextView_Initialized!; - Added += TextView_Added!; + IsAddedChanged += TextView_IsAddedChanged!; SubviewsLaidOut += TextView_LayoutComplete; @@ -2416,8 +2416,6 @@ public TextView () KeyBindings.Add (ContextMenu.Key, Command.Context); } - private void TextView_Added1 (object? sender, SuperViewChangedEventArgs e) { throw new NotImplementedException (); } - // BUGBUG: AllowsReturn is mis-named. It should be EnterKeyAccepts. /// /// Gets or sets whether pressing ENTER in a creates a new line of text @@ -6444,11 +6442,18 @@ private string StringFromRunes (List cells) return StringExtensions.ToString (encoded); } - private void TextView_Added (object sender, SuperViewChangedEventArgs e) + private void TextView_IsAddedChanged (object sender, EventArgs e) { - if (Autocomplete.HostControl is null) + if (e.CurrentValue) { - Autocomplete.HostControl = this; + if (Autocomplete.HostControl is null) + { + Autocomplete.HostControl = this; + } + } + else + { + Autocomplete.HostControl = null; } } diff --git a/Tests/StressTests/ScenariosStressTests.cs b/Tests/StressTests/ScenariosStressTests.cs index 007cd58b38..a59c4f1878 100644 --- a/Tests/StressTests/ScenariosStressTests.cs +++ b/Tests/StressTests/ScenariosStressTests.cs @@ -154,7 +154,7 @@ void SubscribeAllSubviews (View view) { view.DrawComplete += (s, a) => drawCompleteCount++; view.SubviewsLaidOut += (s, a) => laidOutCount++; - view.Added += (s, a) => addedCount++; + view.IsAddedChanged += (s, a) => addedCount++; foreach (View subview in view.Subviews) { diff --git a/Tests/UnitTests/Views/ToplevelTests.cs b/Tests/UnitTests/Views/ToplevelTests.cs index b7a776e9d2..952865230a 100644 --- a/Tests/UnitTests/Views/ToplevelTests.cs +++ b/Tests/UnitTests/Views/ToplevelTests.cs @@ -2,7 +2,7 @@ namespace Terminal.Gui.ViewsTests; -public partial class ToplevelTests +public class ToplevelTests { public ToplevelTests () { @@ -22,6 +22,7 @@ public void Constructor_Default () Assert.False (top.Running); Assert.False (top.Modal); Assert.Null (top.MenuBar); + //Assert.Null (top.StatusBar); } @@ -52,22 +53,27 @@ public void Internal_Tests () top.Add (new MenuBar ()); Assert.NotNull (top.MenuBar); + //top.Add (new StatusBar ()); //Assert.NotNull (top.StatusBar); - var menuBar = top.MenuBar; + MenuBar menuBar = top.MenuBar; top.Remove (top.MenuBar); Assert.Null (top.MenuBar); Assert.NotNull (menuBar); + //var statusBar = top.StatusBar; //top.Remove (top.StatusBar); //Assert.Null (top.StatusBar); //Assert.NotNull (statusBar); #if DEBUG_IDISPOSABLE Assert.False (menuBar.WasDisposed); + //Assert.False (statusBar.WasDisposed); menuBar.Dispose (); + //statusBar.Dispose (); Assert.True (menuBar.WasDisposed); + //Assert.True (statusBar.WasDisposed); #endif @@ -75,26 +81,28 @@ public void Internal_Tests () Assert.Equal (top, Application.Top); // Application.Top without menu and status bar. - View supView = View.GetLocationEnsuringFullVisibility (top, 2, 2, out int nx, out int ny/*, out StatusBar sb*/); + View supView = View.GetLocationEnsuringFullVisibility (top, 2, 2, out int nx, out int ny /*, out StatusBar sb*/); Assert.Equal (Application.Top, supView); Assert.Equal (0, nx); Assert.Equal (0, ny); + //Assert.Null (sb); top.Add (new MenuBar ()); Assert.NotNull (top.MenuBar); // Application.Top with a menu and without status bar. - View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny /*, out sb*/); Assert.Equal (0, nx); Assert.Equal (1, ny); + //Assert.Null (sb); //top.Add (new StatusBar ()); //Assert.NotNull (top.StatusBar); // Application.Top with a menu and status bar. - View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny /*, out sb*/); Assert.Equal (0, nx); // The available height is lower than the Application.Top height minus @@ -108,7 +116,7 @@ public void Internal_Tests () Assert.NotNull (menuBar); // Application.Top without a menu and with a status bar. - View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny /*, out sb*/); Assert.Equal (0, nx); // The available height is lower than the Application.Top height minus @@ -127,31 +135,34 @@ public void Internal_Tests () top.LayoutSubviews (); // The SuperView is always the same regardless of the caller. - supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/); + supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny /*, out sb*/); Assert.Equal (Application.Top, supView); - supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/); + supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny /*, out sb*/); Assert.Equal (Application.Top, supView); // Application.Top without menu and status bar. - View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny /*, out sb*/); Assert.Equal (0, nx); Assert.Equal (0, ny); + //Assert.Null (sb); top.Add (new MenuBar ()); Assert.NotNull (top.MenuBar); // Application.Top with a menu and without status bar. - View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny /*, out sb*/); Assert.Equal (0, nx); Assert.Equal (1, ny); + //Assert.Null (sb); top.Add (new StatusBar ()); + //Assert.NotNull (top.StatusBar); // Application.Top with a menu and status bar. - View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny /*, out sb*/); Assert.Equal (0, nx); // The available height is lower than the Application.Top height minus @@ -160,10 +171,12 @@ public void Internal_Tests () //Assert.NotNull (sb); menuBar = top.MenuBar; + //statusBar = top.StatusBar; top.Remove (top.MenuBar); Assert.Null (top.MenuBar); Assert.NotNull (menuBar); + //top.Remove (top.StatusBar); //Assert.Null (top.StatusBar); //Assert.NotNull (statusBar); @@ -174,26 +187,30 @@ public void Internal_Tests () top.Add (win); // Application.Top without menu and status bar. - View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny /*, out sb*/); Assert.Equal (0, nx); Assert.Equal (0, ny); + //Assert.Null (sb); top.Add (new MenuBar ()); Assert.NotNull (top.MenuBar); // Application.Top with a menu and without status bar. - View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny /*, out sb*/); Assert.Equal (2, nx); Assert.Equal (2, ny); + //Assert.Null (sb); top.Add (new StatusBar ()); + //Assert.NotNull (top.StatusBar); // Application.Top with a menu and status bar. - View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny/*, out sb*/); + View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny /*, out sb*/); Assert.Equal (20, nx); // 20+60=80 + //Assert.Equal (9, ny); // 9+15+1(mb)=25 //Assert.NotNull (sb); @@ -211,35 +228,33 @@ public void Internal_Tests () #if DEBUG_IDISPOSABLE Assert.False (top.MenuBar.WasDisposed); + //Assert.False (top.StatusBar.WasDisposed); #endif menuBar = top.MenuBar; + //statusBar = top.StatusBar; top.Dispose (); Assert.Null (top.MenuBar); + //Assert.Null (top.StatusBar); Assert.NotNull (menuBar); + //Assert.NotNull (statusBar); #if DEBUG_IDISPOSABLE Assert.True (menuBar.WasDisposed); + //Assert.True (statusBar.WasDisposed); #endif } [Fact] - public void Added_Event_Should_Not_Be_Used_To_Initialize_Toplevel_Events () + public void IsAddedChanged_Should_Not_Be_Used_To_Initialize_Toplevel_Events () { var wasAdded = false; var view = new View (); - view.Added += View_Added; - - void View_Added (object sender, SuperViewChangedEventArgs e) - { - Assert.False (wasAdded); - wasAdded = true; - view.Added -= View_Added; - } + view.IsAddedChanged += ViewIsAddedChanged; var win = new Window (); win.Add (view); @@ -250,6 +265,15 @@ void View_Added (object sender, SuperViewChangedEventArgs e) Assert.True (wasAdded); Application.Shutdown (); + + return; + + void ViewIsAddedChanged (object sender, EventArgs _) + { + Assert.False (wasAdded); + wasAdded = true; + view.IsAddedChanged -= ViewIsAddedChanged; + } } [Fact] @@ -302,11 +326,11 @@ public void Mouse_Drag_On_Top_With_Superview_Null () // Drag to left Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (2, 2), Flags = MouseFlags.Button1Pressed - | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (2, 2), Flags = MouseFlags.Button1Pressed + | MouseFlags.ReportMousePosition + }); Application.LayoutAndDraw (); Assert.Equal (Application.Top.Border, Application.MouseGrabView); @@ -325,10 +349,11 @@ public void Mouse_Drag_On_Top_With_Superview_Null () // Drag up Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (2, 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (2, 1), + Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition + }); Application.LayoutAndDraw (); Assert.Equal (Application.Top!.Border, Application.MouseGrabView); @@ -397,10 +422,10 @@ public void Mouse_Drag_On_Top_With_Superview_Not_Null () // Grab the mouse Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (win.Frame.X, win.Frame.Y), Flags = MouseFlags.Button1Pressed - }); + new () + { + ScreenPosition = new (win.Frame.X, win.Frame.Y), Flags = MouseFlags.Button1Pressed + }); Assert.Equal (win.Border, Application.MouseGrabView); } @@ -413,12 +438,12 @@ public void Mouse_Drag_On_Top_With_Superview_Not_Null () movey = 0; Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (win.Frame.X + movex, win.Frame.Y + movey), Flags = - MouseFlags.Button1Pressed - | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (win.Frame.X + movex, win.Frame.Y + movey), Flags = + MouseFlags.Button1Pressed + | MouseFlags.ReportMousePosition + }); Assert.Equal (win.Border, Application.MouseGrabView); } @@ -438,12 +463,12 @@ public void Mouse_Drag_On_Top_With_Superview_Not_Null () movey = -1; Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (win.Frame.X + movex, win.Frame.Y + movey), Flags = - MouseFlags.Button1Pressed - | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (win.Frame.X + movex, win.Frame.Y + movey), Flags = + MouseFlags.Button1Pressed + | MouseFlags.ReportMousePosition + }); Assert.Equal (win.Border, Application.MouseGrabView); } @@ -463,11 +488,11 @@ public void Mouse_Drag_On_Top_With_Superview_Not_Null () movey = 0; Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (win.Frame.X + movex, win.Frame.Y + movey), - Flags = MouseFlags.Button1Released - }); + new () + { + ScreenPosition = new (win.Frame.X + movex, win.Frame.Y + movey), + Flags = MouseFlags.Button1Released + }); Assert.Null (Application.MouseGrabView); } @@ -591,10 +616,10 @@ public void Window_Viewport_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_L Assert.Equal (window.Border, Application.MouseGrabView); Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (-11, -4), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (-11, -4), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition + }); Application.LayoutAndDraw (); Assert.Equal (new (0, 0, 40, 10), top.Frame); @@ -604,10 +629,10 @@ public void Window_Viewport_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_L ((FakeDriver)Application.Driver!).SetBufferSize (20, 3); Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (-1, -1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (-1, -1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition + }); Application.LayoutAndDraw (); Assert.Equal (new (0, 0, 20, 3), top.Frame); @@ -617,20 +642,20 @@ public void Window_Viewport_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_L ((FakeDriver)Application.Driver!).SetBufferSize (19, 2); Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (-1, -1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (-1, -1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition + }); Application.LayoutAndDraw (); Assert.Equal (new (0, 0, 19, 2), top.Frame); Assert.Equal (new (-1, -1, 20, 3), window.Frame); Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (18, 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (18, 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition + }); Application.LayoutAndDraw (); Assert.Equal (new (0, 0, 19, 2), top.Frame); @@ -638,14 +663,15 @@ public void Window_Viewport_Bigger_Than_Driver_Cols_And_Rows_Allow_Drag_Beyond_L // On a real app we can't go beyond the SuperView bounds Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (19, 2), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (19, 2), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition + }); Application.LayoutAndDraw (); Assert.Equal (new (0, 0, 19, 2), top.Frame); Assert.Equal (new (19, 2, 20, 3), window.Frame); + //DriverAsserts.AssertDriverContentsWithFrameAre (@"", output); Application.End (rsWindow); @@ -687,10 +713,10 @@ public void Modal_As_Top_Will_Drag_Cleanly () Assert.Equal (new (0, 0, 10, 3), window.Frame); Application.RaiseMouseEvent ( - new () - { - ScreenPosition = new (1, 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition - }); + new () + { + ScreenPosition = new (1, 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition + }); firstIteration = false; Application.RunIteration (ref rs, firstIteration); @@ -720,7 +746,6 @@ public void Begin_With_Window_Sets_Size_Correctly () top.Dispose (); } - [Fact] [AutoInitShutdown] public void Activating_MenuBar_By_Alt_Key_Does_Not_Throw () @@ -892,6 +917,7 @@ public void Remove_Do_Not_Dispose_MenuBar_Or_StatusBar () #endif tl.Add (mb, sb); Assert.NotNull (tl.MenuBar); + //Assert.NotNull (tl.StatusBar); #if DEBUG Assert.False (mb.WasDisposed); @@ -899,6 +925,7 @@ public void Remove_Do_Not_Dispose_MenuBar_Or_StatusBar () #endif tl.RemoveAll (); Assert.Null (tl.MenuBar); + //Assert.Null (tl.StatusBar); #if DEBUG Assert.False (mb.WasDisposed); diff --git a/Tests/UnitTestsParallelizable/View/SubviewTests.cs b/Tests/UnitTestsParallelizable/View/SubviewTests.cs index a0c7f9138d..3463efba4e 100644 --- a/Tests/UnitTestsParallelizable/View/SubviewTests.cs +++ b/Tests/UnitTestsParallelizable/View/SubviewTests.cs @@ -3,30 +3,65 @@ public class SubviewTests { [Fact] - public void Added_Removed () + public void IsAddedChanged_Raised_On_Add () { - var v = new View { Frame = new (0, 0, 10, 24) }; - var t = new View (); - - v.Added += (s, e) => - { - Assert.Same (v.SuperView, e.SuperView); - Assert.Same (t, e.SuperView); - Assert.Same (v, e.SubView); - }; - - v.Removed += (s, e) => - { - Assert.Same (t, e.SuperView); - Assert.Same (v, e.SubView); - Assert.True (v.SuperView == null); - }; - - t.Add (v); - Assert.True (t.Subviews.Count == 1); - - t.Remove (v); - Assert.True (t.Subviews.Count == 0); + var super = new View { }; + var sub = new View (); + + int superRaisedCount = 0; + int subRaisedCount = 0; + + super.IsAddedChanged += (s, e) => + { + superRaisedCount++; + }; + sub.IsAddedChanged += (s, e) => + { + if (e.CurrentValue) + { + subRaisedCount++; + } + }; + + super.Add (sub); + Assert.True (super.Subviews.Count == 1); + Assert.True (sub.IsAdded); + Assert.Equal (0, superRaisedCount); + Assert.Equal (1, subRaisedCount); + } + + [Fact] + public void IsAddedChanged_Raised_On_Remove () + { + var super = new View { }; + var sub = new View (); + + int superRaisedCount = 0; + int subRaisedCount = 0; + + super.IsAddedChanged += (s, e) => + { + superRaisedCount++; + }; + sub.IsAddedChanged += (s, e) => + { + if (!e.CurrentValue) + { + subRaisedCount++; + } + }; + + super.Add (sub); + Assert.True (super.Subviews.Count == 1); + Assert.True (sub.IsAdded); + Assert.Equal (0, superRaisedCount); + Assert.Equal (0, subRaisedCount); + + super.Remove (sub); + Assert.Empty (super.Subviews); + Assert.False (sub.IsAdded); + Assert.Equal (0, superRaisedCount); + Assert.Equal (1, subRaisedCount); } [Fact] @@ -379,29 +414,29 @@ public void Initialized_Event_Comparing_With_Added_Event () int tc = 0, wc = 0, v1c = 0, v2c = 0, sv1c = 0; - winAddedToTop.Added += (s, e) => + winAddedToTop.SubViewAdded += (s, e) => { Assert.Equal (e.SuperView.Frame.Width, winAddedToTop.Frame.Width); Assert.Equal (e.SuperView.Frame.Height, winAddedToTop.Frame.Height); }; - v1AddedToWin.Added += (s, e) => - { - Assert.Equal (e.SuperView.Frame.Width, v1AddedToWin.Frame.Width); - Assert.Equal (e.SuperView.Frame.Height, v1AddedToWin.Frame.Height); - }; - - v2AddedToWin.Added += (s, e) => - { - Assert.Equal (e.SuperView.Frame.Width, v2AddedToWin.Frame.Width); - Assert.Equal (e.SuperView.Frame.Height, v2AddedToWin.Frame.Height); - }; - - svAddedTov1.Added += (s, e) => - { - Assert.Equal (e.SuperView.Frame.Width, svAddedTov1.Frame.Width); - Assert.Equal (e.SuperView.Frame.Height, svAddedTov1.Frame.Height); - }; + v1AddedToWin.SubViewAdded += (s, e) => + { + Assert.Equal (e.SuperView.Frame.Width, v1AddedToWin.Frame.Width); + Assert.Equal (e.SuperView.Frame.Height, v1AddedToWin.Frame.Height); + }; + + v2AddedToWin.SubViewAdded += (s, e) => + { + Assert.Equal (e.SuperView.Frame.Width, v2AddedToWin.Frame.Width); + Assert.Equal (e.SuperView.Frame.Height, v2AddedToWin.Frame.Height); + }; + + svAddedTov1.SubViewAdded += (s, e) => + { + Assert.Equal (e.SuperView.Frame.Width, svAddedTov1.Frame.Width); + Assert.Equal (e.SuperView.Frame.Height, svAddedTov1.Frame.Height); + }; top.Initialized += (s, e) => { diff --git a/UICatalog/KeyBindingsDialog.cs b/UICatalog/KeyBindingsDialog.cs index 54e8f521dc..6d58b066a4 100644 --- a/UICatalog/KeyBindingsDialog.cs +++ b/UICatalog/KeyBindingsDialog.cs @@ -205,11 +205,7 @@ private void RecordView (View view) RecordView (sub); } - // TODO: BUG: Based on my new understanding of Added event I think this is wrong - // (and always was wrong). Parents don't get to be told when new views are added - // to them - - view.Added += (s, e) => RecordView (e.SubView); + view.SubViewAdded += (s, e) => RecordView (e.SubView); } } } From 1312894df8176ae44b6e5871588f218a45a55830 Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 6 Mar 2025 23:44:42 -0700 Subject: [PATCH 03/25] Using Logging --- Terminal.Gui/View/View.Hierarchy.cs | 59 ++++++++++++++++++----------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/Terminal.Gui/View/View.Hierarchy.cs b/Terminal.Gui/View/View.Hierarchy.cs index dd29e09c3e..0a3c562649 100644 --- a/Terminal.Gui/View/View.Hierarchy.cs +++ b/Terminal.Gui/View/View.Hierarchy.cs @@ -1,7 +1,6 @@ #nullable enable using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -using Unix.Terminal; namespace Terminal.Gui; @@ -24,7 +23,10 @@ public partial class View // SuperView/SubView hierarchy management (SuperView, private View? _superView; - /// Gets this Views SuperView (the View's container), or if this view has not been added as a Subview. + /// + /// Gets this Views SuperView (the View's container), or if this view has not been added as a + /// Subview. + /// public View? SuperView { get => _superView!; @@ -45,6 +47,7 @@ private set { return; } + _isAdded = value; RaiseIsAddedChanged (); } @@ -53,7 +56,7 @@ private set internal void RaiseIsAddedChanged () { // Tell subclasses that a subview has been added - EventArgs args = new EventArgs (IsAdded); + EventArgs args = new (IsAdded); OnIsAddedChanged (args); IsAddedChanged?.Invoke (this, args); @@ -64,9 +67,8 @@ internal void RaiseIsAddedChanged () /// Method invoked when a Subview has been added to this view. /// The new value of IsAdded - protected virtual void OnIsAddedChanged (EventArgs newValue) - { - } + protected virtual void OnIsAddedChanged (EventArgs newValue) { } + /// Adds a Subview (child) to this view. /// /// @@ -89,13 +91,18 @@ protected virtual void OnIsAddedChanged (EventArgs newValue) { return null; } - if (_subviews is null) + + _subviews ??= []; + + if (view.IsAdded) { - _subviews = []; + Logging.Warning ($"{view} already has IsAdded == true."); } - Debug.WriteLineIf (view.IsAdded, $"WARNING: {view} already has IsAdded == true."); - Debug.WriteLineIf (_subviews.Contains (view), $"WARNING: {view} has already been added to {this}."); + if (_subviews.Contains (view)) + { + Logging.Warning ($"{view} has already been added to {this}."); + } // TileView likes to add views that were previously added and have HasFocus = true. No bueno. view.HasFocus = false; @@ -103,6 +110,7 @@ protected virtual void OnIsAddedChanged (EventArgs newValue) // TODO: Make this thread safe _subviews.Add (view); view._superView = this; + // This causes IsAddedChanged to be raised on view view.IsAdded = true; @@ -164,19 +172,17 @@ public void Add (params View []? views) internal void RaiseSubViewAdded (View view) { OnSubViewAdded (view); - SubViewAdded?.Invoke (this, new SuperViewChangedEventArgs (this, view)); + SubViewAdded?.Invoke (this, new (this, view)); } /// - /// Called when a Subview has been added to this View. + /// Called when a Subview has been added to this View. /// /// /// If the Subview has not been initialized, this happens before BeginInit/EndInit is called. /// /// - protected virtual void OnSubViewAdded (View view) - { - } + protected virtual void OnSubViewAdded (View view) { } /// Raised when a Subview has been added to this View. /// @@ -184,7 +190,6 @@ protected virtual void OnSubViewAdded (View view) /// public event EventHandler? SubViewAdded; - /// Removes a Subview added via or from this View. /// /// @@ -211,8 +216,15 @@ protected virtual void OnSubViewAdded (View view) return view; } - Debug.WriteLineIf (!view.IsAdded, $"WARNING: {view} already has IsAdded == false."); - Debug.WriteLineIf (!_subviews.Contains (view), $"WARNING: {view} has not been added to {this}."); + if (!view.IsAdded) + { + Logging.Warning ($"{view} has IsAdded == false."); + } + + if (!_subviews.Contains (view)) + { + Logging.Warning ($"{view} has not been added to {this}."); + } Rectangle touched = view.Frame; @@ -223,16 +235,19 @@ protected virtual void OnSubViewAdded (View view) { view.CanFocus = false; // If view had focus, this will ensure it doesn't and it stays that way } + Debug.Assert (!view.HasFocus); _subviews.Remove (view); // Clean up focus stuff _previouslyFocused = null; + if (view._superView is { } && view._superView._previouslyFocused == this) { view._superView._previouslyFocused = null; } + view._superView = null; // This causes IsAddedChanged to be raised on view @@ -264,16 +279,14 @@ protected virtual void OnSubViewAdded (View view) internal void RaiseSubViewRemoved (View view) { OnSubViewRemoved (view); - SubViewRemoved?.Invoke (this, new SuperViewChangedEventArgs (this, view)); + SubViewRemoved?.Invoke (this, new (this, view)); } /// - /// Called when a Subview has been removed from this View. + /// Called when a Subview has been removed from this View. /// /// - protected virtual void OnSubViewRemoved (View view) - { - } + protected virtual void OnSubViewRemoved (View view) { } /// Raised when a Subview has been added to this View. public event EventHandler? SubViewRemoved; From 461a29e8e4ffe1451bc555e07d939b90c1873c9f Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 6 Mar 2025 23:47:24 -0700 Subject: [PATCH 04/25] cleanup --- Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs b/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs index 34e058dab5..1e5dda863a 100644 --- a/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs +++ b/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs @@ -75,11 +75,6 @@ public override View HostControl } } - private void _top_Added (object sender, SuperViewChangedEventArgs e) - { - throw new NotImplementedException (); - } - /// public override void EnsureSelectedIdxIsValid () { From a7cc9f27c5f090057a16287a2a1ac320b0e7917d Mon Sep 17 00:00:00 2001 From: Tig Date: Fri, 7 Mar 2025 09:27:10 -0700 Subject: [PATCH 05/25] Subview -> SubView --- Terminal.Gui/Application/Application.Run.cs | 2 +- .../Application/ApplicationNavigation.cs | 4 +- Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs | 8 +- .../Text/Autocomplete/PopupAutocomplete.cs | 2 +- Terminal.Gui/View/Adornment/Adornment.cs | 4 +- Terminal.Gui/View/Adornment/Border.cs | 2 +- Terminal.Gui/View/Adornment/Margin.cs | 4 +- Terminal.Gui/View/Layout/Dim.cs | 2 +- Terminal.Gui/View/Layout/DimAuto.cs | 46 +++++----- Terminal.Gui/View/Layout/DimAutoStyle.cs | 8 +- Terminal.Gui/View/Layout/LayoutEventArgs.cs | 2 +- Terminal.Gui/View/Layout/PosAlign.cs | 2 +- Terminal.Gui/View/View.Adornments.cs | 6 +- Terminal.Gui/View/View.Command.cs | 4 +- Terminal.Gui/View/View.Content.cs | 8 +- Terminal.Gui/View/View.Drawing.cs | 60 ++++++------- Terminal.Gui/View/View.Hierarchy.cs | 84 +++++++++---------- Terminal.Gui/View/View.Keyboard.cs | 6 +- Terminal.Gui/View/View.Layout.cs | 66 +++++++-------- Terminal.Gui/View/View.Mouse.cs | 12 +-- Terminal.Gui/View/View.Navigation.cs | 28 +++---- Terminal.Gui/View/View.cs | 8 +- Terminal.Gui/View/ViewArrangement.cs | 2 +- Terminal.Gui/View/ViewportSettings.cs | 6 +- Terminal.Gui/Views/Bar.cs | 26 +++--- Terminal.Gui/Views/ComboBox.cs | 12 +-- Terminal.Gui/Views/FileDialog.cs | 2 +- Terminal.Gui/Views/HexView.cs | 4 +- Terminal.Gui/Views/Label.cs | 12 +-- Terminal.Gui/Views/Menu/MenuBar.cs | 2 +- Terminal.Gui/Views/MenuBarv2.cs | 2 +- Terminal.Gui/Views/Menuv2.cs | 8 +- Terminal.Gui/Views/RadioGroup.cs | 2 +- Terminal.Gui/Views/ScrollBar/ScrollBar.cs | 4 +- Terminal.Gui/Views/Shortcut.cs | 4 +- Terminal.Gui/Views/Slider.cs | 2 +- Terminal.Gui/Views/StatusBar.cs | 8 +- Terminal.Gui/Views/TabView/TabRow.cs | 8 +- Terminal.Gui/Views/TabView/TabView.cs | 2 +- Terminal.Gui/Views/TextView.cs | 2 +- Terminal.Gui/Views/TileView.cs | 12 +-- Terminal.Gui/Views/Toplevel.cs | 24 +++--- Terminal.Gui/Views/Wizard/Wizard.cs | 6 +- Terminal.Gui/Views/Wizard/WizardStep.cs | 8 +- .../UICatalog/ScenarioTests.cs | 8 +- Tests/StressTests/ScenariosStressTests.cs | 10 +-- Tests/UnitTests/Dialogs/WizardTests.cs | 2 +- .../UnitTests/FileServices/FileDialogTests.cs | 12 +-- Tests/UnitTests/View/Adornment/BorderTests.cs | 2 +- .../UnitTests/View/Draw/AllViewsDrawTests.cs | 4 +- .../UnitTests/View/Draw/ClearViewportTests.cs | 4 +- Tests/UnitTests/View/Draw/ClipTests.cs | 2 +- Tests/UnitTests/View/Draw/DrawTests.cs | 2 +- Tests/UnitTests/View/Draw/NeedsDrawTests.cs | 8 +- Tests/UnitTests/View/Draw/TransparentTests.cs | 2 +- Tests/UnitTests/View/Layout/Dim.Tests.cs | 2 +- Tests/UnitTests/View/Layout/LayoutTests.cs | 4 +- .../UnitTests/View/Layout/Pos.CombineTests.cs | 2 +- .../View/Mouse/GetViewsUnderMouseTests.cs | 20 ++--- .../View/Navigation/AddRemoveTests.cs | 12 +-- .../View/Navigation/AdvanceFocusTests.cs | 84 +++++++++---------- .../UnitTests/View/Navigation/EnabledTests.cs | 16 ++-- .../Navigation/HasFocusChangeEventTests.cs | 4 +- .../View/Navigation/HasFocusTests.cs | 4 +- .../View/Navigation/NavigationTests.cs | 4 +- .../UnitTests/View/Navigation/VisibleTests.cs | 14 ++-- Tests/UnitTests/View/SubviewTests.cs | 4 +- Tests/UnitTests/View/TextTests.cs | 4 +- Tests/UnitTests/View/ViewCommandTests.cs | 4 +- Tests/UnitTests/View/ViewTests.cs | 54 ++++++------ Tests/UnitTests/Views/AllViewsTests.cs | 2 +- Tests/UnitTests/Views/BarTests.cs | 16 ++-- Tests/UnitTests/Views/ColorPicker16Tests.cs | 2 +- Tests/UnitTests/Views/ColorPickerTests.cs | 22 ++--- Tests/UnitTests/Views/ComboBoxTests.cs | 78 ++++++++--------- Tests/UnitTests/Views/ContextMenuTests.cs | 64 +++++++------- Tests/UnitTests/Views/DatePickerTests.cs | 18 ++-- Tests/UnitTests/Views/GraphViewTests.cs | 48 +++++------ Tests/UnitTests/Views/HexViewTests.cs | 16 ++-- Tests/UnitTests/Views/LabelTests.cs | 26 +++--- Tests/UnitTests/Views/MenuBarTests.cs | 56 ++++++------- Tests/UnitTests/Views/ProgressBarTests.cs | 6 +- Tests/UnitTests/Views/RadioGroupTests.cs | 2 +- Tests/UnitTests/Views/ShortcutTests.cs | 30 +++---- Tests/UnitTests/Views/SliderTests.cs | 6 +- Tests/UnitTests/Views/StatusBarTests.cs | 24 +++--- Tests/UnitTests/Views/TabViewTests.cs | 12 +-- Tests/UnitTests/Views/TableViewTests.cs | 80 +++++++++--------- Tests/UnitTests/Views/TextFieldTests.cs | 10 +-- Tests/UnitTests/Views/TextViewTests.cs | 12 +-- Tests/UnitTests/Views/TileViewTests.cs | 44 +++++----- Tests/UnitTests/Views/ToplevelTests.cs | 6 +- Tests/UnitTests/Views/TreeTableSourceTests.cs | 2 +- Tests/UnitTests/Views/TreeViewTests.cs | 22 ++--- Tests/UnitTests/Views/ViewDisposalTest.cs | 2 +- .../View/Adornment/AdornmentSubViewTests.cs | 2 +- .../View/Adornment/AdornmentTests.cs | 4 +- .../View/Draw/NeedsDrawTests.cs | 6 +- .../View/Layout/Dim.AutoTests.DimTypes.cs | 20 ++--- .../View/Layout/Dim.AutoTests.MinMax.cs | 14 ++-- .../View/Layout/Dim.AutoTests.PosTypes.cs | 30 +++---- .../View/Layout/Dim.AutoTests.cs | 26 +++--- .../View/Layout/Dim.PercentTests.cs | 4 +- .../View/Layout/Dim.Tests.cs | 6 +- .../View/Layout/Dim.ViewTests.cs | 2 +- .../View/Layout/Pos.AnchorEndTests.cs | 6 +- .../View/Layout/Pos.CenterTests.cs | 2 +- .../View/Layout/Pos.CombineTests.cs | 2 +- .../View/Layout/Pos.PercentTests.cs | 2 +- .../View/Layout/SetLayoutTests.cs | 68 +++++++-------- .../View/Layout/ToScreenTests.cs | 36 ++++---- .../View/Layout/TopologicalSortTests.cs | 8 +- .../View/Layout/ViewportTests.cs | 4 +- .../View/SubviewTests.cs | 66 +++++++-------- UICatalog/KeyBindingsDialog.cs | 4 +- UICatalog/Scenario.cs | 10 +-- UICatalog/Scenarios/AllViewsTester.cs | 4 +- UICatalog/Scenarios/Bars.cs | 6 +- UICatalog/Scenarios/ComputedLayout.cs | 4 +- UICatalog/Scenarios/ConfigurationEditor.cs | 2 +- UICatalog/Scenarios/DynamicStatusBar.cs | 12 +-- UICatalog/Scenarios/Editor.cs | 2 +- UICatalog/Scenarios/Editors/BorderEditor.cs | 2 +- UICatalog/Scenarios/Editors/DimEditor.cs | 2 +- UICatalog/Scenarios/Editors/EditorBase.cs | 4 +- UICatalog/Scenarios/Editors/ExpanderButton.cs | 2 +- .../Editors/ViewportSettingsEditor.cs | 2 +- UICatalog/Scenarios/KeyBindings.cs | 2 +- UICatalog/Scenarios/ListsAndCombos.cs | 20 ++--- UICatalog/Scenarios/MenuBarScenario.cs | 2 +- UICatalog/Scenarios/Mouse.cs | 8 +- UICatalog/Scenarios/PosAlignDemo.cs | 2 +- UICatalog/Scenarios/Progress.cs | 2 +- UICatalog/Scenarios/ProgressBarStyles.cs | 4 +- UICatalog/Scenarios/ScrollBarDemo.cs | 4 +- UICatalog/Scenarios/Shortcuts.cs | 8 +- UICatalog/Scenarios/Sliders.cs | 22 ++--- .../Scenarios/TextViewAutocompletePopup.cs | 2 +- UICatalog/Scenarios/TileViewNesting.cs | 2 +- UICatalog/Scenarios/ViewportSettings.cs | 2 +- UICatalog/Scenarios/VkeyPacketSimulator.cs | 2 +- UICatalog/Scenarios/Wizards.cs | 2 +- UICatalog/UICatalog.cs | 2 +- docfx/docs/View.md | 6 +- docfx/docs/arrangement.md | 2 +- docfx/docs/drawing.md | 8 +- docfx/docs/layout.md | 6 +- docfx/docs/migratingfromv1.md | 18 ++-- docfx/docs/navigation.md | 6 +- 149 files changed, 958 insertions(+), 958 deletions(-) diff --git a/Terminal.Gui/Application/Application.Run.cs b/Terminal.Gui/Application/Application.Run.cs index 5bfa5f2cc6..b929cce4ad 100644 --- a/Terminal.Gui/Application/Application.Run.cs +++ b/Terminal.Gui/Application/Application.Run.cs @@ -71,7 +71,7 @@ public static Key ArrangeKey /// The to prepare execution for. /// /// This method prepares the provided for running with the focus, it adds this to the list - /// of s, lays out the Subviews, focuses the first element, and draws the + /// of s, lays out the SubViews, focuses the first element, and draws the /// in the screen. This is usually followed by executing the method, and then the /// method upon termination which will undo these changes. /// diff --git a/Terminal.Gui/Application/ApplicationNavigation.cs b/Terminal.Gui/Application/ApplicationNavigation.cs index 1fe6972eae..f351b515d6 100644 --- a/Terminal.Gui/Application/ApplicationNavigation.cs +++ b/Terminal.Gui/Application/ApplicationNavigation.cs @@ -33,7 +33,7 @@ public ApplicationNavigation () } /// - /// Gets whether is in the Subview hierarchy of . + /// Gets whether is in the SubView hierarchy of . /// /// /// @@ -50,7 +50,7 @@ public static bool IsInHierarchy (View? start, View? view) return true; } - foreach (View subView in start.Subviews) + foreach (View subView in start.SubViews) { if (view == subView) { diff --git a/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs b/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs index d4bd54863a..0b00165e1f 100644 --- a/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs +++ b/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs @@ -122,7 +122,7 @@ internal void IterationImpl () if (Application.Top != null) { - bool needsDrawOrLayout = AnySubviewsNeedDrawn (Application.Top); + bool needsDrawOrLayout = AnySubViewsNeedDrawn (Application.Top); bool sizeChanged = WindowSizeMonitor.Poll (); @@ -174,7 +174,7 @@ private void SetCursor () } } - private bool AnySubviewsNeedDrawn (View v) + private bool AnySubViewsNeedDrawn (View v) { if (v.NeedsDraw || v.NeedsLayout) { @@ -183,9 +183,9 @@ private bool AnySubviewsNeedDrawn (View v) return true; } - foreach (View subview in v.Subviews) + foreach (View subview in v.SubViews) { - if (AnySubviewsNeedDrawn (subview)) + if (AnySubViewsNeedDrawn (subview)) { return true; } diff --git a/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs b/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs index 1e5dda863a..6eb4682c79 100644 --- a/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs +++ b/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs @@ -554,7 +554,7 @@ private void AddPopupToTop () private void RemovePopupFromTop () { - if (_popup is { } && _top.Subviews.Contains (_popup)) + if (_popup is { } && _top.SubViews.Contains (_popup)) { _top?.Remove (_popup); _popup.Dispose (); diff --git a/Terminal.Gui/View/Adornment/Adornment.cs b/Terminal.Gui/View/Adornment/Adornment.cs index c61c1fc0db..dce0e3147b 100644 --- a/Terminal.Gui/View/Adornment/Adornment.cs +++ b/Terminal.Gui/View/Adornment/Adornment.cs @@ -11,7 +11,7 @@ namespace Terminal.Gui; /// /// Each of , , and has slightly different /// behavior relative to , , keyboard input, and -/// mouse input. Each can be customized by manipulating their Subviews. +/// mouse input. Each can be customized by manipulating their SubViews. /// /// public class Adornment : View, IDesignable @@ -165,7 +165,7 @@ protected override bool OnClearingViewport () protected override bool OnDrawingText () { return Thickness == Thickness.Empty; } /// - protected override bool OnDrawingSubviews () { return Thickness == Thickness.Empty; } + protected override bool OnDrawingSubViews () { return Thickness == Thickness.Empty; } /// Does nothing for Adornment diff --git a/Terminal.Gui/View/Adornment/Border.cs b/Terminal.Gui/View/Adornment/Border.cs index 566559b2c9..0cb68c94f3 100644 --- a/Terminal.Gui/View/Adornment/Border.cs +++ b/Terminal.Gui/View/Adornment/Border.cs @@ -711,7 +711,7 @@ protected override bool OnDrawingContent () { Attribute focus = Parent.GetNormalColor (); - if (Parent.SuperView is { } && Parent.SuperView?.Subviews!.Count (s => s.CanFocus) > 1) + if (Parent.SuperView is { } && Parent.SuperView?.SubViews!.Count (s => s.CanFocus) > 1) { // Only use focus color if there are multiple focusable views focus = GetFocusColor (); diff --git a/Terminal.Gui/View/Adornment/Margin.cs b/Terminal.Gui/View/Adornment/Margin.cs index 19bf76f372..ac19770282 100644 --- a/Terminal.Gui/View/Adornment/Margin.cs +++ b/Terminal.Gui/View/Adornment/Margin.cs @@ -32,7 +32,7 @@ public Margin (View parent) : base (parent) // BUGBUG: We should not set HighlightStyle.Pressed here, but wherever it is actually needed // HighlightStyle |= HighlightStyle.Pressed; Highlight += Margin_Highlight; - SubviewLayout += Margin_LayoutStarted; + SubViewLayout += Margin_LayoutStarted; // Margin should not be focusable CanFocus = false; @@ -82,7 +82,7 @@ internal static bool DrawMargins (IEnumerable margins) view.NeedsDraw = false; - foreach (var subview in view.Subviews) + foreach (var subview in view.SubViews) { stack.Push (subview); } diff --git a/Terminal.Gui/View/Layout/Dim.cs b/Terminal.Gui/View/Layout/Dim.cs index 849a29e2ab..072fc77bf3 100644 --- a/Terminal.Gui/View/Layout/Dim.cs +++ b/Terminal.Gui/View/Layout/Dim.cs @@ -96,7 +96,7 @@ public abstract record Dim : IEqualityOperators public static Dim? Absolute (int size) { return new DimAbsolute (size); } /// - /// Creates a object that automatically sizes the view to fit all the view's Content, Subviews, and/or Text. + /// Creates a object that automatically sizes the view to fit all the view's Content, SubViews, and/or Text. /// /// /// diff --git a/Terminal.Gui/View/Layout/DimAuto.cs b/Terminal.Gui/View/Layout/DimAuto.cs index 6439e3efe0..f1f610f337 100644 --- a/Terminal.Gui/View/Layout/DimAuto.cs +++ b/Terminal.Gui/View/Layout/DimAuto.cs @@ -72,7 +72,7 @@ internal override int Calculate (int location, int superviewContentSize, View us { maxCalculatedSize = textSize; - if (us is { ContentSizeTracksViewport: false, InternalSubviews.Count: 0 }) + if (us is { ContentSizeTracksViewport: false, InternalSubViews.Count: 0 }) { // ContentSize was explicitly set. Use `us.ContentSize` to determine size. maxCalculatedSize = dimension == Dimension.Width ? us.GetContentSize ().Width : us.GetContentSize ().Height; @@ -81,12 +81,12 @@ internal override int Calculate (int location, int superviewContentSize, View us { // TOOD: All the below is a naive implementation. It may be possible to optimize this. - List includedSubviews = us.InternalSubviews.ToList (); + List includedSubViews = us.InternalSubViews.ToList (); // If [x] it can cause `us.ContentSize` to change. // If [ ] it doesn't need special processing for us to determine `us.ContentSize`. - // -------------------- Pos types that are dependent on `us.Subviews` + // -------------------- Pos types that are dependent on `us.SubViews` // [ ] PosAlign - Position is dependent on other views with `GroupId` AND `us.ContentSize` // [x] PosView - Position is dependent on `subview.Target` - it can cause a change in `us.ContentSize` // [x] PosCombine - Position is dependent if `Pos.Has [one of the above]` - it can cause a change in `us.ContentSize` @@ -98,11 +98,11 @@ internal override int Calculate (int location, int superviewContentSize, View us // [ ] PosPercent - Position is dependent `us.ContentSize` - Will always be 0 if there is no other content that makes the superview have a size. // [x] PosCombine - Position is dependent if `Pos.Has [one of the above]` - it can cause a change in `us.ContentSize` - // -------------------- Pos types that are not dependent on either `us.Subviews` or `us.ContentSize` + // -------------------- Pos types that are not dependent on either `us.SubViews` or `us.ContentSize` // [ ] PosAbsolute - Position is fixed. // [ ] PosFunc - Position is internally calculated. - // -------------------- Dim types that are dependent on `us.Subviews` + // -------------------- Dim types that are dependent on `us.SubViews` // [x] DimView - Dimension is dependent on `subview.Target` // [x] DimCombine - Dimension is dependent if `Dim.Has [one of the above]` - it can cause a change in `us.ContentSize` @@ -111,7 +111,7 @@ internal override int Calculate (int location, int superviewContentSize, View us // [ ] DimPercent - Dimension is dependent on `us.ContentSize` - Will always be 0 if there is no other content that makes the superview have a size. // [ ] DimCombine - Dimension is dependent if `Dim.Has [one of the above]` - // -------------------- Dim types that are not dependent on either `us.Subviews` or `us.ContentSize` + // -------------------- Dim types that are not dependent on either `us.SubViews` or `us.ContentSize` // [ ] DimAuto - Dimension is internally calculated // [ ] DimAbsolute - Dimension is fixed // [ ] DimFunc - Dimension is internally calculated @@ -128,7 +128,7 @@ internal override int Calculate (int location, int superviewContentSize, View us if (dimension == Dimension.Width) { - notDependentSubViews = includedSubviews.Where ( + notDependentSubViews = includedSubViews.Where ( v => v.Width is { } && (v.X is PosAbsolute or PosFunc || v.Width is DimAuto @@ -144,7 +144,7 @@ or DimAbsolute } else { - notDependentSubViews = includedSubviews.Where ( + notDependentSubViews = includedSubViews.Where ( v => v.Height is { } && (v.Y is PosAbsolute or PosFunc || v.Height is DimAuto @@ -197,11 +197,11 @@ or DimAbsolute if (dimension == Dimension.Width) { - centeredSubViews = us.InternalSubviews.Where (v => v.X.Has (out _)).ToList (); + centeredSubViews = us.InternalSubViews.Where (v => v.X.Has (out _)).ToList (); } else { - centeredSubViews = us.InternalSubviews.Where (v => v.Y.Has (out _)).ToList (); + centeredSubViews = us.InternalSubViews.Where (v => v.Y.Has (out _)).ToList (); } viewsNeedingLayout.AddRange (centeredSubViews); @@ -241,7 +241,7 @@ or DimAbsolute var maxAlign = 0; // Use Linq to get a list of distinct GroupIds from the subviews - List groupIds = includedSubviews.Select ( + List groupIds = includedSubViews.Select ( v => { return dimension switch @@ -259,7 +259,7 @@ Dimension.Height when v.Y.Has (out PosAlign posAlign) => foreach (int groupId in groupIds.Where (g => g != -1)) { // PERF: If this proves a perf issue, consider caching a ref to this list in each item - List posAlignsInGroup = includedSubviews.Where (v => PosAlign.HasGroupId (v, dimension, groupId)) + List posAlignsInGroup = includedSubViews.Where (v => PosAlign.HasGroupId (v, dimension, groupId)) .Select (v => dimension == Dimension.Width ? v.X as PosAlign : v.Y as PosAlign) .ToList (); @@ -268,7 +268,7 @@ Dimension.Height when v.Y.Has (out PosAlign posAlign) => continue; } - maxAlign = PosAlign.CalculateMinDimension (groupId, includedSubviews, dimension); + maxAlign = PosAlign.CalculateMinDimension (groupId, includedSubViews, dimension); } maxCalculatedSize = int.Max (maxCalculatedSize, maxAlign); @@ -282,11 +282,11 @@ Dimension.Height when v.Y.Has (out PosAlign posAlign) => if (dimension == Dimension.Width) { - anchoredSubViews = includedSubviews.Where (v => v.X.Has (out _)).ToList (); + anchoredSubViews = includedSubViews.Where (v => v.X.Has (out _)).ToList (); } else { - anchoredSubViews = includedSubviews.Where (v => v.Y.Has (out _)).ToList (); + anchoredSubViews = includedSubViews.Where (v => v.Y.Has (out _)).ToList (); } viewsNeedingLayout.AddRange (anchoredSubViews); @@ -324,11 +324,11 @@ Dimension.Height when v.Y.Has (out PosAlign posAlign) => if (dimension == Dimension.Width) { - posViewSubViews = includedSubviews.Where (v => v.X.Has (out _)).ToList (); + posViewSubViews = includedSubViews.Where (v => v.X.Has (out _)).ToList (); } else { - posViewSubViews = includedSubviews.Where (v => v.Y.Has (out _)).ToList (); + posViewSubViews = includedSubViews.Where (v => v.Y.Has (out _)).ToList (); } for (var i = 0; i < posViewSubViews.Count; i++) @@ -358,11 +358,11 @@ Dimension.Height when v.Y.Has (out PosAlign posAlign) => if (dimension == Dimension.Width) { - dimViewSubViews = includedSubviews.Where (v => v.Width is { } && v.Width.Has (out _)).ToList (); + dimViewSubViews = includedSubViews.Where (v => v.Width is { } && v.Width.Has (out _)).ToList (); } else { - dimViewSubViews = includedSubviews.Where (v => v.Height is { } && v.Height.Has (out _)).ToList (); + dimViewSubViews = includedSubViews.Where (v => v.Height is { } && v.Height.Has (out _)).ToList (); } for (var i = 0; i < dimViewSubViews.Count; i++) @@ -391,11 +391,11 @@ Dimension.Height when v.Y.Has (out PosAlign posAlign) => if (dimension == Dimension.Width) { - dimAutoSubViews = includedSubviews.Where (v => v.Width is { } && v.Width.Has (out _)).ToList (); + dimAutoSubViews = includedSubViews.Where (v => v.Width is { } && v.Width.Has (out _)).ToList (); } else { - dimAutoSubViews = includedSubviews.Where (v => v.Height is { } && v.Height.Has (out _)).ToList (); + dimAutoSubViews = includedSubViews.Where (v => v.Height is { } && v.Height.Has (out _)).ToList (); } for (var i = 0; i < dimAutoSubViews.Count; i++) @@ -423,11 +423,11 @@ Dimension.Height when v.Y.Has (out PosAlign posAlign) => //if (dimension == Dimension.Width) //{ - // DimFillSubViews = includedSubviews.Where (v => v.Width is { } && v.Width.Has (out _)).ToList (); + // DimFillSubViews = includedSubViews.Where (v => v.Width is { } && v.Width.Has (out _)).ToList (); //} //else //{ - // DimFillSubViews = includedSubviews.Where (v => v.Height is { } && v.Height.Has (out _)).ToList (); + // DimFillSubViews = includedSubViews.Where (v => v.Height is { } && v.Height.Has (out _)).ToList (); //} //for (var i = 0; i < DimFillSubViews.Count; i++) diff --git a/Terminal.Gui/View/Layout/DimAutoStyle.cs b/Terminal.Gui/View/Layout/DimAutoStyle.cs index 3d3ec1df61..efd2b4b33f 100644 --- a/Terminal.Gui/View/Layout/DimAutoStyle.cs +++ b/Terminal.Gui/View/Layout/DimAutoStyle.cs @@ -10,12 +10,12 @@ namespace Terminal.Gui; public enum DimAutoStyle { /// - /// The dimensions will be computed based on the View's and/or . + /// The dimensions will be computed based on the View's and/or . /// /// If is , will be used to determine the dimension. /// /// - /// Otherwise, the Subview in with the largest corresponding position plus dimension + /// Otherwise, the SubView in with the largest corresponding position plus dimension /// will determine the dimension. /// /// @@ -31,7 +31,7 @@ public enum DimAutoStyle /// will be used to determine the dimension. /// /// - /// The corresponding dimensions of and/or will be ignored. + /// The corresponding dimensions of and/or will be ignored. /// /// /// If is set, the dimension will be the maximum of the formatted text and the @@ -42,7 +42,7 @@ public enum DimAutoStyle /// /// The dimension will be computed using the largest of the view's , , and - /// corresponding dimension + /// corresponding dimension /// Auto = Content | Text, } \ No newline at end of file diff --git a/Terminal.Gui/View/Layout/LayoutEventArgs.cs b/Terminal.Gui/View/Layout/LayoutEventArgs.cs index 264122c664..200ef24614 100644 --- a/Terminal.Gui/View/Layout/LayoutEventArgs.cs +++ b/Terminal.Gui/View/Layout/LayoutEventArgs.cs @@ -1,6 +1,6 @@ namespace Terminal.Gui; -/// Event arguments for the event. +/// Event arguments for the event. public class LayoutEventArgs : EventArgs { /// Creates a new instance of the class. diff --git a/Terminal.Gui/View/Layout/PosAlign.cs b/Terminal.Gui/View/Layout/PosAlign.cs index 1500e5a247..a42d53137d 100644 --- a/Terminal.Gui/View/Layout/PosAlign.cs +++ b/Terminal.Gui/View/Layout/PosAlign.cs @@ -117,7 +117,7 @@ internal override int Calculate (int superviewDimension, Dim dim, View us, Dimen } else { - groupViews = us.SuperView!.Subviews.Where (v => HasGroupId (v, dimension, GroupId)).ToList (); + groupViews = us.SuperView!.SubViews.Where (v => HasGroupId (v, dimension, GroupId)).ToList (); } AlignAndUpdateGroup (GroupId, groupViews, dimension, superviewDimension); diff --git a/Terminal.Gui/View/View.Adornments.cs b/Terminal.Gui/View/View.Adornments.cs index 7058fb0635..aa25bd24be 100644 --- a/Terminal.Gui/View/View.Adornments.cs +++ b/Terminal.Gui/View/View.Adornments.cs @@ -60,7 +60,7 @@ private void DisposeAdornments () /// /// Changing the size of an adornment (, , or ) will /// change the size of which will call to update the layout of the - /// and its . + /// and its . /// /// public Margin? Margin { get; private set; } @@ -116,7 +116,7 @@ public virtual ShadowStyle ShadowStyle /// /// Changing the size of an adornment (, , or ) will /// change the size of which will call to update the layout of the - /// and its . + /// and its . /// /// public Border? Border { get; private set; } @@ -233,7 +233,7 @@ public virtual void SetBorderStyle (LineStyle value) /// /// Changing the size of an adornment (, , or ) will /// change the size of which will call to update the layout of the - /// and its . + /// and its . /// /// public Padding? Padding { get; private set; } diff --git a/Terminal.Gui/View/View.Command.cs b/Terminal.Gui/View/View.Command.cs index 74c86a58c0..a273212fce 100644 --- a/Terminal.Gui/View/View.Command.cs +++ b/Terminal.Gui/View/View.Command.cs @@ -90,8 +90,8 @@ private void SetupCommands () // - bubbled up the SuperView hierarchy. if (!args.Cancel) { - // If there's an IsDefault peer view in Subviews, try it - var isDefaultView = SuperView?.InternalSubviews.FirstOrDefault (v => v is Button { IsDefault: true }); + // If there's an IsDefault peer view in SubViews, try it + var isDefaultView = SuperView?.InternalSubViews.FirstOrDefault (v => v is Button { IsDefault: true }); if (isDefaultView != this && isDefaultView is Button { IsDefault: true } button) { diff --git a/Terminal.Gui/View/View.Content.cs b/Terminal.Gui/View/View.Content.cs index 418f123c28..a624219e58 100644 --- a/Terminal.Gui/View/View.Content.cs +++ b/Terminal.Gui/View/View.Content.cs @@ -25,7 +25,7 @@ public partial class View /// /// If not explicitly set, and the View has visible subviews, will return the /// maximum - /// position + dimension of the Subviews, supporting with the + /// position + dimension of the SubViews, supporting with the /// flag set. /// /// @@ -68,7 +68,7 @@ public void SetContentSize (Size? contentSize) /// /// If the content size was not explicitly set by , and the View has visible subviews, will return the /// maximum - /// position + dimension of the Subviews, supporting with the + /// position + dimension of the SubViews, supporting with the /// flag set. /// /// @@ -109,7 +109,7 @@ public void SetContentSize (Size? contentSize) /// disabled. /// /// - /// The behavior of will be to use position and size of the Subviews + /// The behavior of will be to use position and size of the SubViews /// to /// determine the size of the view, ignoring . /// @@ -128,7 +128,7 @@ public void SetContentSize (Size? contentSize) /// The behavior of will be to use /// to /// determine the - /// size of the view, ignoring the position and size of the Subviews. + /// size of the view, ignoring the position and size of the SubViews. /// /// /// diff --git a/Terminal.Gui/View/View.Drawing.cs b/Terminal.Gui/View/View.Drawing.cs index 11887b9df0..5487b1ceea 100644 --- a/Terminal.Gui/View/View.Drawing.cs +++ b/Terminal.Gui/View/View.Drawing.cs @@ -78,11 +78,11 @@ public void Draw (DrawContext? context = null) DoClearViewport (); // ------------------------------------ - // Draw the subviews first (order matters: Subviews, Text, Content) + // Draw the subviews first (order matters: SubViews, Text, Content) if (SubViewNeedsDraw) { DoSetAttribute (); - DoDrawSubviews (context); + DoDrawSubViews (context); } // ------------------------------------ @@ -133,10 +133,10 @@ public void Draw (DrawContext? context = null) private void DoDrawBorderAndPaddingSubViews () { - if (Border?.Subviews is { } && Border.Thickness != Thickness.Empty) + if (Border?.SubViews is { } && Border.Thickness != Thickness.Empty) { // PERFORMANCE: Get the check for DrawIndicator out of this somehow. - foreach (View subview in Border.Subviews.Where (v => v.Visible || v.Id == "DrawIndicator")) + foreach (View subview in Border.SubViews.Where (v => v.Visible || v.Id == "DrawIndicator")) { if (subview.Id != "DrawIndicator") { @@ -147,19 +147,19 @@ private void DoDrawBorderAndPaddingSubViews () } Region? saved = Border?.AddFrameToClip (); - Border?.DoDrawSubviews (); + Border?.DoDrawSubViews (); SetClip (saved); } - if (Padding?.Subviews is { } && Padding.Thickness != Thickness.Empty) + if (Padding?.SubViews is { } && Padding.Thickness != Thickness.Empty) { - foreach (View subview in Padding.Subviews) + foreach (View subview in Padding.SubViews) { subview.SetNeedsDraw (); } Region? saved = Padding?.AddFrameToClip (); - Padding?.DoDrawSubviews (); + Padding?.DoDrawSubViews (); SetClip (saved); } } @@ -191,7 +191,7 @@ private void DoDrawBorderAndPadding (Region? originalClip) if (SubViewNeedsDraw) { - // A Subview may add to the LineCanvas. This ensures any Adornment LineCanvas updates happen. + // A SubView may add to the LineCanvas. This ensures any Adornment LineCanvas updates happen. Border?.SetNeedsDraw (); Padding?.SetNeedsDraw (); } @@ -525,22 +525,22 @@ private void DoDrawContent (DrawContext? context = null) #endregion DrawContent - #region DrawSubviews + #region DrawSubViews - private void DoDrawSubviews (DrawContext? context = null) + private void DoDrawSubViews (DrawContext? context = null) { - if (OnDrawingSubviews (context)) + if (OnDrawingSubViews (context)) { return; } - if (OnDrawingSubviews ()) + if (OnDrawingSubViews ()) { return; } var dev = new DrawEventArgs (Viewport, Rectangle.Empty, context); - DrawingSubviews?.Invoke (this, dev); + DrawingSubViews?.Invoke (this, dev); if (dev.Cancel) { @@ -552,36 +552,36 @@ private void DoDrawSubviews (DrawContext? context = null) return; } - DrawSubviews (context); + DrawSubViews (context); } /// - /// Called when the are to be drawn. + /// Called when the are to be drawn. /// /// The draw context to report drawn areas to, or null if not tracking. - /// to stop further drawing of . - protected virtual bool OnDrawingSubviews (DrawContext? context) { return false; } + /// to stop further drawing of . + protected virtual bool OnDrawingSubViews (DrawContext? context) { return false; } /// - /// Called when the are to be drawn. + /// Called when the are to be drawn. /// - /// to stop further drawing of . - protected virtual bool OnDrawingSubviews () { return false; } + /// to stop further drawing of . + protected virtual bool OnDrawingSubViews () { return false; } - /// Raised when the are to be drawn. + /// Raised when the are to be drawn. /// /// /// /// Set to to stop further drawing of - /// . + /// . /// - public event EventHandler? DrawingSubviews; + public event EventHandler? DrawingSubViews; /// - /// Draws the . + /// Draws the . /// /// The draw context to report drawn areas to, or null if not tracking. - public void DrawSubviews (DrawContext? context = null) + public void DrawSubViews (DrawContext? context = null) { if (_subviews is null) { @@ -606,7 +606,7 @@ public void DrawSubviews (DrawContext? context = null) } } - #endregion DrawSubviews + #endregion DrawSubViews #region DrawLineCanvas @@ -772,7 +772,7 @@ public bool NeedsDraw } } - /// Gets whether any Subviews need to be redrawn. + /// Gets whether any SubViews need to be redrawn. public bool SubViewNeedsDraw { get; private set; } /// Sets that the of this View needs to be redrawn. @@ -844,7 +844,7 @@ public void SetNeedsDraw (Rectangle viewPortRelativeRegion) } // There was multiple enumeration error here, so calling ToArray - probably a stop gap - foreach (View subview in Subviews.ToArray ()) + foreach (View subview in SubViews.ToArray ()) { if (subview.Frame.IntersectsWith (viewPortRelativeRegion)) { @@ -898,7 +898,7 @@ protected void ClearNeedsDraw () Padding?.ClearNeedsDraw (); } - foreach (View subview in Subviews) + foreach (View subview in SubViews) { subview.ClearNeedsDraw (); } diff --git a/Terminal.Gui/View/View.Hierarchy.cs b/Terminal.Gui/View/View.Hierarchy.cs index 0a3c562649..1fa5bf3712 100644 --- a/Terminal.Gui/View/View.Hierarchy.cs +++ b/Terminal.Gui/View/View.Hierarchy.cs @@ -11,21 +11,21 @@ public partial class View // SuperView/SubView hierarchy management (SuperView, private List? _subviews; // This is null, and allocated on demand. - // Internally, we use InternalSubviews rather than subviews, as we do not expect us - // to make the same mistakes our users make when they poke at the Subviews. - internal IList InternalSubviews => _subviews ?? _empty; + // Internally, we use InternalSubViews rather than subviews, as we do not expect us + // to make the same mistakes our users make when they poke at the SubViews. + internal IList InternalSubViews => _subviews ?? _empty; - /// Gets the list of Subviews. + /// Gets the list of SubViews. /// /// Use and to add or remove subviews. /// - public IList Subviews => _subviews?.AsReadOnly () ?? _empty; + public IList SubViews => _subviews?.AsReadOnly () ?? _empty; private View? _superView; /// /// Gets this Views SuperView (the View's container), or if this view has not been added as a - /// Subview. + /// SubView. /// public View? SuperView { @@ -65,18 +65,18 @@ internal void RaiseIsAddedChanged () /// Raised when this View has been added to a SuperView. public event EventHandler>? IsAddedChanged; - /// Method invoked when a Subview has been added to this view. + /// Method invoked when a SubView has been added to this view. /// The new value of IsAdded protected virtual void OnIsAddedChanged (EventArgs newValue) { } - /// Adds a Subview (child) to this view. + /// Adds a SubView (child) to this view. /// /// - /// The Views that have been added to this view can be retrieved via the property. See also + /// The Views that have been added to this view can be retrieved via the property. See also /// /// /// - /// Subviews will be disposed when this View is disposed. In other-words, calling this method causes + /// SubViews will be disposed when this View is disposed. In other-words, calling this method causes /// the lifecycle of the subviews to be transferred to this View. /// /// @@ -144,15 +144,15 @@ protected virtual void OnIsAddedChanged (EventArgs newValue) { } return view; } - /// Adds the specified Subview (children) to the view. + /// Adds the specified SubView (children) to the view. /// Array of one or more views (can be optional parameter). /// /// - /// The Views that have been added to this view can be retrieved via the property. See also + /// The Views that have been added to this view can be retrieved via the property. See also /// and . /// /// - /// Subviews will be disposed when this View is disposed. In other-words, calling this method causes + /// SubViews will be disposed when this View is disposed. In other-words, calling this method causes /// the lifecycle of the subviews to be transferred to this View. /// /// @@ -176,25 +176,25 @@ internal void RaiseSubViewAdded (View view) } /// - /// Called when a Subview has been added to this View. + /// Called when a SubView has been added to this View. /// /// - /// If the Subview has not been initialized, this happens before BeginInit/EndInit is called. + /// If the SubView has not been initialized, this happens before BeginInit/EndInit is called. /// /// protected virtual void OnSubViewAdded (View view) { } - /// Raised when a Subview has been added to this View. + /// Raised when a SubView has been added to this View. /// - /// If the Subview has not been initialized, this happens before BeginInit/EndInit is called. + /// If the SubView has not been initialized, this happens before BeginInit/EndInit is called. /// public event EventHandler? SubViewAdded; - /// Removes a Subview added via or from this View. + /// Removes a SubView added via or from this View. /// /// - /// Normally Subviews will be disposed when this View is disposed. Removing a Subview causes ownership of the - /// Subview's + /// Normally SubViews will be disposed when this View is disposed. Removing a SubView causes ownership of the + /// SubView's /// lifecycle to be transferred to the caller; the caller must call . /// /// @@ -283,21 +283,21 @@ internal void RaiseSubViewRemoved (View view) } /// - /// Called when a Subview has been removed from this View. + /// Called when a SubView has been removed from this View. /// /// protected virtual void OnSubViewRemoved (View view) { } - /// Raised when a Subview has been added to this View. + /// Raised when a SubView has been added to this View. public event EventHandler? SubViewRemoved; /// - /// Removes all Subview (children) added via or from this View. + /// Removes all SubView (children) added via or from this View. /// /// /// - /// Normally Subviews will be disposed when this View is disposed. Removing a Subview causes ownership of the - /// Subview's + /// Normally SubViews will be disposed when this View is disposed. Removing a SubView causes ownership of the + /// SubView's /// lifecycle to be transferred to the caller; the caller must call on any Views that were /// added. /// @@ -315,7 +315,7 @@ public virtual void RemoveAll () } } - /// Raised when a Subview has been removed from this View. + /// Raised when a SubView has been removed from this View. public event EventHandler? Removed; #endregion AddRemove @@ -341,7 +341,7 @@ public virtual void RemoveAll () } /// - /// Gets whether is in the Subview hierarchy of . + /// Gets whether is in the SubView hierarchy of . /// /// The View at the start of the hierarchy. /// The View to test. @@ -359,7 +359,7 @@ public static bool IsInHierarchy (View? start, View? view, bool includeAdornment return true; } - foreach (View subView in start.InternalSubviews) + foreach (View subView in start.InternalSubViews) { if (view == subView) { @@ -404,12 +404,12 @@ public static bool IsInHierarchy (View? start, View? view, bool includeAdornment #region SubViewOrdering /// - /// Moves one position towards the end of the list. + /// Moves one position towards the end of the list. /// /// The subview to move. - public void MoveSubviewTowardsEnd (View subview) + public void MoveSubViewTowardsEnd (View subview) { - PerformActionForSubview ( + PerformActionForSubView ( subview, x => { @@ -425,12 +425,12 @@ public void MoveSubviewTowardsEnd (View subview) } /// - /// Moves to the end of the list. + /// Moves to the end of the list. /// /// The subview to move. - public void MoveSubviewToEnd (View subview) + public void MoveSubViewToEnd (View subview) { - PerformActionForSubview ( + PerformActionForSubView ( subview, x => { @@ -441,12 +441,12 @@ public void MoveSubviewToEnd (View subview) } /// - /// Moves one position towards the start of the list. + /// Moves one position towards the start of the list. /// /// The subview to move. - public void MoveSubviewTowardsStart (View subview) + public void MoveSubViewTowardsStart (View subview) { - PerformActionForSubview ( + PerformActionForSubView ( subview, x => { @@ -462,12 +462,12 @@ public void MoveSubviewTowardsStart (View subview) } /// - /// Moves to the start of the list. + /// Moves to the start of the list. /// /// The subview to move. - public void MoveSubviewToStart (View subview) + public void MoveSubViewToStart (View subview) { - PerformActionForSubview ( + PerformActionForSubView ( subview, x => { @@ -478,11 +478,11 @@ public void MoveSubviewToStart (View subview) } /// - /// Internal API that runs on a subview if it is part of the list. + /// Internal API that runs on a subview if it is part of the list. /// /// /// - private void PerformActionForSubview (View subview, Action action) + private void PerformActionForSubView (View subview, Action action) { if (_subviews!.Contains (subview)) { diff --git a/Terminal.Gui/View/View.Keyboard.cs b/Terminal.Gui/View/View.Keyboard.cs index 44e3efa3d9..a47b333a1f 100644 --- a/Terminal.Gui/View/View.Keyboard.cs +++ b/Terminal.Gui/View/View.Keyboard.cs @@ -562,12 +562,12 @@ private static bool InvokeCommandsBoundToKeyOnAdornment (Adornment adornment, Ke return true; } - if (adornment?.InternalSubviews is null) + if (adornment?.InternalSubViews is null) { return false; } - foreach (View subview in adornment.InternalSubviews) + foreach (View subview in adornment.InternalSubViews) { bool? subViewHandled = subview.InvokeCommands (key); @@ -604,7 +604,7 @@ internal bool InvokeCommandsBoundToHotKey (Key hotKey, ref bool? handled) } // Now, process any HotKey bindings in the subviews - foreach (View subview in InternalSubviews) + foreach (View subview in InternalSubViews) { if (subview == Focused) { diff --git a/Terminal.Gui/View/View.Layout.cs b/Terminal.Gui/View/View.Layout.cs index 67c604319a..5ae60b8ed6 100644 --- a/Terminal.Gui/View/View.Layout.cs +++ b/Terminal.Gui/View/View.Layout.cs @@ -416,7 +416,7 @@ public bool Layout (Size contentSize) { if (SetRelativeLayout (contentSize)) { - LayoutSubviews (); + LayoutSubViews (); // Debug.Assert(!NeedsLayout); return true; @@ -475,7 +475,7 @@ public bool SetRelativeLayout (Size superviewContentSize) CheckDimAuto (); - // TODO: Should move to View.LayoutSubviews? + // TODO: Should move to View.LayoutSubViews? SetTextFormatterSize (); int newX, newW, newY, newH; @@ -594,9 +594,9 @@ public bool SetRelativeLayout (Size superviewContentSize) /// The position and dimensions of the view are indeterminate until the view has been initialized. Therefore, the /// behavior of this method is indeterminate if is . /// - /// Raises the event before it returns. + /// Raises the event before it returns. /// - internal void LayoutSubviews () + internal void LayoutSubViews () { if (!NeedsLayout) { @@ -607,23 +607,23 @@ internal void LayoutSubviews () Size contentSize = GetContentSize (); - OnSubviewLayout (new (contentSize)); - SubviewLayout?.Invoke (this, new (contentSize)); + OnSubViewLayout (new (contentSize)); + SubViewLayout?.Invoke (this, new (contentSize)); // The Adornments already have their Frame's set by SetRelativeLayout so we call LayoutSubViews vs. Layout here. - if (Margin is { Subviews.Count: > 0 }) + if (Margin is { SubViews.Count: > 0 }) { - Margin.LayoutSubviews (); + Margin.LayoutSubViews (); } - if (Border is { Subviews.Count: > 0 }) + if (Border is { SubViews.Count: > 0 }) { - Border.LayoutSubviews (); + Border.LayoutSubViews (); } - if (Padding is { Subviews.Count: > 0 }) + if (Padding is { SubViews.Count: > 0 }) { - Padding.LayoutSubviews (); + Padding.LayoutSubViews (); } // Sort out the dependencies of the X, Y, Width, Height properties @@ -669,44 +669,44 @@ internal void LayoutSubviews () NeedsLayout = layoutStillNeeded; - OnSubviewsLaidOut (new (contentSize)); - SubviewsLaidOut?.Invoke (this, new (contentSize)); + OnSubViewsLaidOut (new (contentSize)); + SubViewsLaidOut?.Invoke (this, new (contentSize)); } /// - /// Called from before any subviews + /// Called from before any subviews /// have been laid out. /// /// /// Override to perform tasks when the layout is changing. /// - protected virtual void OnSubviewLayout (LayoutEventArgs args) { } + protected virtual void OnSubViewLayout (LayoutEventArgs args) { } /// - /// Raised by before any subviews + /// Raised by before any subviews /// have been laid out. /// /// /// Subscribe to this event to perform tasks when the layout is changing. /// - public event EventHandler? SubviewLayout; + public event EventHandler? SubViewLayout; /// - /// Called from after all sub-views + /// Called from after all sub-views /// have been laid out. /// /// /// Override to perform tasks after the has been resized or the layout has /// otherwise changed. /// - protected virtual void OnSubviewsLaidOut (LayoutEventArgs args) { } + protected virtual void OnSubViewsLaidOut (LayoutEventArgs args) { } /// Raised after all sub-views have been laid out. /// /// Subscribe to this event to perform tasks after the has been resized or the layout has /// otherwise changed. /// - public event EventHandler? SubviewsLaidOut; + public event EventHandler? SubViewsLaidOut; #endregion Core Layout API @@ -743,23 +743,23 @@ public void SetNeedsLayout () { NeedsLayout = true; - if (Margin is { Subviews.Count: > 0 }) + if (Margin is { SubViews.Count: > 0 }) { Margin.SetNeedsLayout (); } - if (Border is { Subviews.Count: > 0 }) + if (Border is { SubViews.Count: > 0 }) { Border.SetNeedsLayout (); } - if (Padding is { Subviews.Count: > 0 }) + if (Padding is { SubViews.Count: > 0 }) { Padding.SetNeedsLayout (); } // Use a stack to avoid recursion - Stack stack = new (Subviews); + Stack stack = new (SubViews); while (stack.Count > 0) { @@ -769,22 +769,22 @@ public void SetNeedsLayout () { current.NeedsLayout = true; - if (current.Margin is { Subviews.Count: > 0 }) + if (current.Margin is { SubViews.Count: > 0 }) { current.Margin.SetNeedsLayout (); } - if (current.Border is { Subviews.Count: > 0 }) + if (current.Border is { SubViews.Count: > 0 }) { current.Border.SetNeedsLayout (); } - if (current.Padding is { Subviews.Count: > 0 }) + if (current.Padding is { SubViews.Count: > 0 }) { current.Padding.SetNeedsLayout (); } - foreach (View subview in current.Subviews) + foreach (View subview in current.SubViews) { stack.Push (subview); } @@ -833,7 +833,7 @@ public void SetNeedsLayout () /// internal void CollectAll (View from, ref HashSet nNodes, ref HashSet<(View, View)> nEdges) { - foreach (View? v in from.InternalSubviews) + foreach (View? v in from.InternalSubViews) { nNodes.Add (v); CollectPos (v.X, v, ref nNodes, ref nEdges); @@ -1035,7 +1035,7 @@ private Size GetContainerSize () /// The new y location that will ensure will be fully visible. /// /// Either (if does not have a Super View) or - /// 's SuperView. This can be used to ensure LayoutSubviews is called on the correct View. + /// 's SuperView. This can be used to ensure LayoutSubViews is called on the correct View. /// internal static View? GetLocationEnsuringFullVisibility ( View viewToMove, @@ -1184,7 +1184,7 @@ private Pos VerifyIsInitialized (Pos pos, string member) /// Gets or sets whether validation of and occurs. /// /// Setting this to will enable validation of , , - /// , and during set operations and in . If invalid + /// , and during set operations and in . If invalid /// settings are discovered exceptions will be thrown indicating the error. This will impose a performance penalty and /// thus should only be used for debugging. /// @@ -1207,7 +1207,7 @@ private void CheckDimAuto () var heightAuto = Height as DimAuto; // Verify none of the subviews are using Dim objects that depend on the SuperView's dimensions. - foreach (View view in Subviews) + foreach (View view in SubViews) { if (widthAuto is { } && widthAuto.Style.FastHasFlags (DimAutoStyle.Content) && ContentSizeTracksViewport) { diff --git a/Terminal.Gui/View/View.Mouse.cs b/Terminal.Gui/View/View.Mouse.cs index bdce9b5e29..b0f802af8e 100644 --- a/Terminal.Gui/View/View.Mouse.cs +++ b/Terminal.Gui/View/View.Mouse.cs @@ -113,7 +113,7 @@ private void SetupMouse () } /// - /// Called when the mouse moves over the View's and no other non-Subview occludes it. + /// Called when the mouse moves over the View's and no other non-SubView occludes it. /// will /// be raised when the mouse is no longer over the . /// @@ -808,13 +808,13 @@ internal bool SetPressedHighlight (HighlightStyle newHighlightStyle) View? subview = null; - for (int i = start.InternalSubviews.Count - 1; i >= 0; i--) + for (int i = start.InternalSubViews.Count - 1; i >= 0; i--) { - if (start.InternalSubviews [i].Visible - && start.InternalSubviews [i].Contains (new (startOffsetX + start.Viewport.X, startOffsetY + start.Viewport.Y)) - && (!ignoreTransparent || !start.InternalSubviews [i].ViewportSettings.HasFlag (ViewportSettings.TransparentMouse))) + if (start.InternalSubViews [i].Visible + && start.InternalSubViews [i].Contains (new (startOffsetX + start.Viewport.X, startOffsetY + start.Viewport.Y)) + && (!ignoreTransparent || !start.InternalSubViews [i].ViewportSettings.HasFlag (ViewportSettings.TransparentMouse))) { - subview = start.InternalSubviews [i]; + subview = start.InternalSubViews [i]; currentLocation.X = startOffsetX + start.Viewport.X; currentLocation.Y = startOffsetY + start.Viewport.Y; diff --git a/Terminal.Gui/View/View.Navigation.cs b/Terminal.Gui/View/View.Navigation.cs index 6799edb9d1..86128796ef 100644 --- a/Terminal.Gui/View/View.Navigation.cs +++ b/Terminal.Gui/View/View.Navigation.cs @@ -265,7 +265,7 @@ public bool CanFocus public event EventHandler? CanFocusChanged; /// - /// Focuses the deepest focusable Subview if one exists. If there are no focusable Subviews then the focus is set to + /// Focuses the deepest focusable SubView if one exists. If there are no focusable SubViews then the focus is set to /// the view itself. /// /// @@ -283,12 +283,12 @@ public bool FocusDeepest (NavigationDirection direction, TabBehavior? behavior) return SetFocus (); } - /// Gets the currently focused Subview or Adornment of this view, or if nothing is focused. + /// Gets the currently focused SubView or Adornment of this view, or if nothing is focused. public View? Focused { get { - View? focused = Subviews.FirstOrDefault (v => v.HasFocus); + View? focused = SubViews.FirstOrDefault (v => v.HasFocus); if (focused is { }) { @@ -319,9 +319,9 @@ public View? Focused public bool IsCurrentTop => Application.Top == this; /// - /// Returns the most focused Subview down the subview-hierarchy. + /// Returns the most focused SubView down the subview-hierarchy. /// - /// The most focused Subview, or if no Subview is focused. + /// The most focused SubView, or if no SubView is focused. public View? MostFocused { get @@ -589,7 +589,7 @@ public bool SetFocus () if (Arrangement.HasFlag (ViewArrangement.Overlapped)) { - SuperView?.MoveSubviewToEnd (this); + SuperView?.MoveSubViewToEnd (this); } // Focus work is done. Notify. @@ -902,39 +902,39 @@ protected virtual void OnHasFocusChanged (bool newHasFocus, View? previousFocuse /// internal View [] GetFocusChain (NavigationDirection direction, TabBehavior? behavior) { - IEnumerable? filteredSubviews; + IEnumerable? filteredSubViews; if (behavior.HasValue) { - filteredSubviews = _subviews?.Where (v => v.TabStop == behavior && v is { CanFocus: true, Visible: true, Enabled: true }); + filteredSubViews = _subviews?.Where (v => v.TabStop == behavior && v is { CanFocus: true, Visible: true, Enabled: true }); } else { - filteredSubviews = _subviews?.Where (v => v is { CanFocus: true, Visible: true, Enabled: true }); + filteredSubViews = _subviews?.Where (v => v is { CanFocus: true, Visible: true, Enabled: true }); } // How about in Adornments? if (Padding is { CanFocus: true, Visible: true, Enabled: true } && Padding.TabStop == behavior) { - filteredSubviews = filteredSubviews?.Append (Padding); + filteredSubViews = filteredSubViews?.Append (Padding); } if (Border is { CanFocus: true, Visible: true, Enabled: true } && Border.TabStop == behavior) { - filteredSubviews = filteredSubviews?.Append (Border); + filteredSubViews = filteredSubViews?.Append (Border); } if (Margin is { CanFocus: true, Visible: true, Enabled: true } && Margin.TabStop == behavior) { - filteredSubviews = filteredSubviews?.Append (Margin); + filteredSubViews = filteredSubViews?.Append (Margin); } if (direction == NavigationDirection.Backward) { - filteredSubviews = filteredSubviews?.Reverse (); + filteredSubViews = filteredSubViews?.Reverse (); } - return filteredSubviews?.ToArray () ?? Array.Empty (); + return filteredSubViews?.ToArray () ?? Array.Empty (); } private TabBehavior? _tabStop; diff --git a/Terminal.Gui/View/View.cs b/Terminal.Gui/View/View.cs index bf4fc0d8cb..5d1a6c6900 100644 --- a/Terminal.Gui/View/View.cs +++ b/Terminal.Gui/View/View.cs @@ -81,9 +81,9 @@ protected virtual void Dispose (bool disposing) DisposeAdornments (); DisposeScrollBars (); - for (int i = InternalSubviews.Count - 1; i >= 0; i--) + for (int i = InternalSubViews.Count - 1; i >= 0; i--) { - View subview = InternalSubviews [i]; + View subview = InternalSubViews [i]; Remove (subview); subview.Dispose (); } @@ -98,7 +98,7 @@ protected virtual void Dispose (bool disposing) _disposedValue = true; } - Debug.Assert (InternalSubviews.Count == 0); + Debug.Assert (InternalSubViews.Count == 0); } #region Constructors and Initialization @@ -213,7 +213,7 @@ public virtual void BeginInit () /// Signals the View that initialization is ending. See . /// - /// Initializes all Subviews and Invokes the event. + /// Initializes all SubViews and Invokes the event. /// public virtual void EndInit () { diff --git a/Terminal.Gui/View/ViewArrangement.cs b/Terminal.Gui/View/ViewArrangement.cs index b4843f7dd5..921fe1af9c 100644 --- a/Terminal.Gui/View/ViewArrangement.cs +++ b/Terminal.Gui/View/ViewArrangement.cs @@ -62,7 +62,7 @@ public enum ViewArrangement Resizable = LeftResizable | RightResizable | TopResizable | BottomResizable, /// - /// The view overlaps other views (the order of dicates the Z-order). If this flag is not + /// The view overlaps other views (the order of dicates the Z-order). If this flag is not /// set the view will operate in tiled mode. /// /// When set, Tab and Shift-Tab will be constrained to the subviews of the view (normally, they will navigate to diff --git a/Terminal.Gui/View/ViewportSettings.cs b/Terminal.Gui/View/ViewportSettings.cs index bedc9a43ca..38ab43f810 100644 --- a/Terminal.Gui/View/ViewportSettings.cs +++ b/Terminal.Gui/View/ViewportSettings.cs @@ -142,9 +142,9 @@ public enum ViewportSettings /// /// If set the View will be transparent: The will not be cleared when the View is drawn and the clip region - /// will be set to clip the View's and . + /// will be set to clip the View's and . /// - /// Only the topmost View in a Subview Hierarchy can be transparent. Any subviews of the topmost transparent view + /// Only the topmost View in a SubView Hierarchy can be transparent. Any subviews of the topmost transparent view /// will have indeterminate draw behavior. /// /// @@ -154,7 +154,7 @@ public enum ViewportSettings Transparent = 0b_0001_0000_0000, /// - /// If set the View will be transparent to mouse events: Any mouse event that occurs over the View (and it's Subviews) will be passed to the + /// If set the View will be transparent to mouse events: Any mouse event that occurs over the View (and it's SubViews) will be passed to the /// Views below it. /// /// Combine this with to get a view that is both visually transparent and transparent to the mouse. diff --git a/Terminal.Gui/Views/Bar.cs b/Terminal.Gui/Views/Bar.cs index d5b72c1857..70613dfa86 100644 --- a/Terminal.Gui/Views/Bar.cs +++ b/Terminal.Gui/Views/Bar.cs @@ -144,12 +144,12 @@ public AlignmentModes AlignmentModes } // TODO: Move this to View - /// Inserts a in the specified index of . + /// Inserts a in the specified index of . /// The zero-based index at which item should be inserted. /// The item to insert. public void AddShortcutAt (int index, Shortcut item) { - List savedSubViewList = Subviews.ToList (); + List savedSubViewList = SubViews.ToList (); int count = savedSubViewList.Count; RemoveAll (); @@ -172,18 +172,18 @@ public void AddShortcutAt (int index, Shortcut item) // TODO: Move this to View - /// Removes a at specified index of . + /// Removes a at specified index of . /// The zero-based index of the item to remove. /// The removed. public Shortcut? RemoveShortcut (int index) { View? toRemove = null; - for (var i = 0; i < Subviews.Count; i++) + for (var i = 0; i < SubViews.Count; i++) { if (i == index) { - toRemove = Subviews [i]; + toRemove = SubViews [i]; } } @@ -198,7 +198,7 @@ public void AddShortcutAt (int index, Shortcut item) } /// - protected override void OnSubviewLayout (LayoutEventArgs args) + protected override void OnSubViewLayout (LayoutEventArgs args) { LayoutBarItems (args.OldContentSize); } @@ -210,9 +210,9 @@ private void LayoutBarItems (Size contentSize) switch (Orientation) { case Orientation.Horizontal: - for (var index = 0; index < Subviews.Count; index++) + for (var index = 0; index < SubViews.Count; index++) { - View barItem = Subviews [index]; + View barItem = SubViews [index]; barItem.ColorScheme = ColorScheme; barItem.X = Pos.Align (Alignment.Start, AlignmentModes); @@ -227,7 +227,7 @@ private void LayoutBarItems (Size contentSize) var minKeyWidth = 0; - List shortcuts = Subviews.Where (s => s is Shortcut && s.Visible).Cast ().ToList (); + List shortcuts = SubViews.Where (s => s is Shortcut && s.Visible).Cast ().ToList (); foreach (Shortcut shortcut in shortcuts) { @@ -237,9 +237,9 @@ private void LayoutBarItems (Size contentSize) var _maxBarItemWidth = 0; - for (var index = 0; index < Subviews.Count; index++) + for (var index = 0; index < SubViews.Count; index++) { - View barItem = Subviews [index]; + View barItem = SubViews [index]; barItem.ColorScheme = ColorScheme; @@ -274,7 +274,7 @@ private void LayoutBarItems (Size contentSize) } - foreach (var subView in Subviews) + foreach (var subView in SubViews) { if (subView is not Line) { @@ -284,7 +284,7 @@ private void LayoutBarItems (Size contentSize) } else { - foreach (var subView in Subviews) + foreach (var subView in SubViews) { if (subView is not Line) { diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 687b94f349..02e42ed60c 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -57,14 +57,14 @@ public ComboBox () Initialized += (s, e) => ProcessLayout (); // On resize - SubviewsLaidOut += (sender, a) => ProcessLayout (); + SubViewsLaidOut += (sender, a) => ProcessLayout (); IsAddedChanged += (s, e) => { // Determine if this view is hosted inside a dialog and is the only control for (View view = SuperView; view != null; view = view.SuperView) { - if (view is Dialog && SuperView is { } && SuperView.Subviews.Count == 1 && SuperView.Subviews [0] == this) + if (view is Dialog && SuperView is { } && SuperView.SubViews.Count == 1 && SuperView.SubViews [0] == this) { _autoHide = false; @@ -199,7 +199,7 @@ public IListDataSource Source _source = value; // Only need to refresh list if its been added to a container view - if (SuperView is { } && SuperView.Subviews.Contains (this)) + if (SuperView is { } && SuperView.SubViews.Contains (this)) { Text = string.Empty; SetNeedsDraw (); @@ -513,7 +513,7 @@ private void HideList () Reset (true); _listview.ClearViewport (); _listview.TabStop = TabBehavior.NoStop; - SuperView?.MoveSubviewToStart (this); + SuperView?.MoveSubViewToStart (this); // BUGBUG: SetNeedsDraw takes Viewport relative coordinates, not Screen Rectangle rect = _listview.ViewportToScreen (_listview.IsInitialized ? _listview.Viewport : Rectangle.Empty); @@ -658,7 +658,7 @@ private void Reset (bool keepSearchText = false) _listview.SetSource (_searchSet); _listview.Height = CalculateHeight (); - if (Subviews.Count > 0 && HasFocus) + if (SubViews.Count > 0 && HasFocus) { _search.SetFocus (); } @@ -814,7 +814,7 @@ private void ShowList () _listview.ClearViewport (); _listview.Height = CalculateHeight (); - SuperView?.MoveSubviewToStart (this); + SuperView?.MoveSubViewToStart (this); } private bool UnixEmulation () diff --git a/Terminal.Gui/Views/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs index b80dcacabe..b21da3d12c 100644 --- a/Terminal.Gui/Views/FileDialog.cs +++ b/Terminal.Gui/Views/FileDialog.cs @@ -505,7 +505,7 @@ public override void OnLoaded () { _btnCancel.X = Pos.Func (CalculateOkButtonPosX); _btnOk.X = Pos.Right (_btnCancel) + 1; - MoveSubviewTowardsStart (_btnCancel); + MoveSubViewTowardsStart (_btnCancel); } SetNeedsDraw (); diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs index c2efbb7de0..0045d901a6 100644 --- a/Terminal.Gui/Views/HexView.cs +++ b/Terminal.Gui/Views/HexView.cs @@ -106,10 +106,10 @@ public HexView (Stream? source) MouseBindings.Add (MouseFlags.WheeledUp, Command.ScrollUp); MouseBindings.Add (MouseFlags.WheeledDown, Command.ScrollDown); - SubviewsLaidOut += HexViewSubviewsLaidOut; + SubViewsLaidOut += HexViewSubViewsLaidOut; } - private void HexViewSubviewsLaidOut (object? sender, LayoutEventArgs e) + private void HexViewSubViewsLaidOut (object? sender, LayoutEventArgs e) { SetBytesPerLine (); SetContentSize (new (GetLeftSideStartColumn () + BytesPerLine / NUM_BYTES_PER_HEX_COLUMN * HEX_COLUMN_WIDTH + BytesPerLine - 1, (int)((GetEditedSize ()) / BytesPerLine) + 1)); diff --git a/Terminal.Gui/Views/Label.cs b/Terminal.Gui/Views/Label.cs index 2e8ccbc829..7e72ea2b7f 100644 --- a/Terminal.Gui/Views/Label.cs +++ b/Terminal.Gui/Views/Label.cs @@ -1,10 +1,10 @@ namespace Terminal.Gui; /// -/// The Label displays text that describes the View next in the . When +/// The Label displays text that describes the View next in the . When /// Label /// receives a command it will pass it to the next in -/// . +/// . /// /// /// @@ -13,7 +13,7 @@ /// /// If is and the use clicks on the Label, /// the will be invoked on the next in -/// . +/// . /// /// public class Label : View, IDesignable @@ -75,12 +75,12 @@ public override Rune HotKeySpecifier if (HotKey.IsValid) { - int me = SuperView?.Subviews.IndexOf (this) ?? -1; + int me = SuperView?.SubViews.IndexOf (this) ?? -1; - if (me != -1 && me < SuperView?.Subviews.Count - 1) + if (me != -1 && me < SuperView?.SubViews.Count - 1) { - return SuperView?.Subviews [me + 1].InvokeCommand (Command.HotKey) == true; + return SuperView?.SubViews [me + 1].InvokeCommand (Command.HotKey) == true; } } diff --git a/Terminal.Gui/Views/Menu/MenuBar.cs b/Terminal.Gui/Views/Menu/MenuBar.cs index 98d5a0a259..129355308f 100644 --- a/Terminal.Gui/Views/Menu/MenuBar.cs +++ b/Terminal.Gui/Views/Menu/MenuBar.cs @@ -559,7 +559,7 @@ private void CloseOtherOpenedMenuBar () if (Application.Top is { }) { // Close others menu bar opened - Menu? menu = Application.Top.Subviews.FirstOrDefault (v => v is Menu m && m.Host != this && m.Host.IsMenuOpen) as Menu; + Menu? menu = Application.Top.SubViews.FirstOrDefault (v => v is Menu m && m.Host != this && m.Host.IsMenuOpen) as Menu; menu?.Host.CleanUp (); } } diff --git a/Terminal.Gui/Views/MenuBarv2.cs b/Terminal.Gui/Views/MenuBarv2.cs index e7c5011d86..4f1434c348 100644 --- a/Terminal.Gui/Views/MenuBarv2.cs +++ b/Terminal.Gui/Views/MenuBarv2.cs @@ -22,7 +22,7 @@ public MenuBarv2 (IEnumerable shortcuts) : base (shortcuts) ColorScheme = Colors.ColorSchemes ["Menu"]; Orientation = Orientation.Horizontal; - SubviewLayout += MenuBarv2_LayoutStarted; + SubViewLayout += MenuBarv2_LayoutStarted; } // MenuBarv2 arranges the items horizontally. diff --git a/Terminal.Gui/Views/Menuv2.cs b/Terminal.Gui/Views/Menuv2.cs index 555f585c6e..4449ad5e01 100644 --- a/Terminal.Gui/Views/Menuv2.cs +++ b/Terminal.Gui/Views/Menuv2.cs @@ -47,11 +47,11 @@ private void Menuv2_Initialized (object sender, EventArgs e) // The first item has no left border, the last item has no right border. // The Shortcuts are configured with the command, help, and key views aligned in reverse order (EndToStart). /// - protected override void OnSubviewLayout (LayoutEventArgs args) + protected override void OnSubViewLayout (LayoutEventArgs args) { - for (int index = 0; index < Subviews.Count; index++) + for (int index = 0; index < SubViews.Count; index++) { - View barItem = Subviews [index]; + View barItem = SubViews [index]; if (!barItem.Visible) { @@ -59,7 +59,7 @@ protected override void OnSubviewLayout (LayoutEventArgs args) } } - base.OnSubviewLayout (args); + base.OnSubViewLayout (args); } /// diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs index 015157dc69..5fc2b2c1b2 100644 --- a/Terminal.Gui/Views/RadioGroup.cs +++ b/Terminal.Gui/Views/RadioGroup.cs @@ -42,7 +42,7 @@ public RadioGroup () // By default, single click is already bound to Command.Select MouseBindings.Add (MouseFlags.Button1DoubleClicked, Command.Accept); - SubviewLayout += RadioGroup_LayoutStarted; + SubViewLayout += RadioGroup_LayoutStarted; HighlightStyle = HighlightStyle.PressedOutside | HighlightStyle.Pressed; } diff --git a/Terminal.Gui/Views/ScrollBar/ScrollBar.cs b/Terminal.Gui/Views/ScrollBar/ScrollBar.cs index 44b50fb09a..1d9885c2af 100644 --- a/Terminal.Gui/Views/ScrollBar/ScrollBar.cs +++ b/Terminal.Gui/Views/ScrollBar/ScrollBar.cs @@ -113,7 +113,7 @@ private void ShowHide () _slider.Position = _sliderPosition.Value; } - private void PositionSubviews () + private void PositionSubViews () { if (Orientation == Orientation.Vertical) { @@ -180,7 +180,7 @@ public void OnOrientationChanged (Orientation newOrientation) TextAlignment = Alignment.Center; VerticalTextAlignment = Alignment.Center; _slider.Orientation = newOrientation; - PositionSubviews (); + PositionSubViews (); OrientationChanged?.Invoke (this, new (newOrientation)); } diff --git a/Terminal.Gui/Views/Shortcut.cs b/Terminal.Gui/Views/Shortcut.cs index 9cb02ca3cf..601b428785 100644 --- a/Terminal.Gui/Views/Shortcut.cs +++ b/Terminal.Gui/Views/Shortcut.cs @@ -132,7 +132,7 @@ public Shortcut (Key key, string? commandText, Action? action, string? helpText Action = action; - SubviewLayout += OnLayoutStarted; + SubViewLayout += OnLayoutStarted; ShowHide (); } @@ -221,7 +221,7 @@ private void ForceCalculateNaturalWidth () HelpView.SetRelativeLayout (Application.Screen.Size); KeyView.SetRelativeLayout (Application.Screen.Size); - _minimumNaturalWidth = PosAlign.CalculateMinDimension (0, Subviews, Dimension.Width); + _minimumNaturalWidth = PosAlign.CalculateMinDimension (0, SubViews, Dimension.Width); // Reset our relative layout SetRelativeLayout (SuperView?.GetContentSize () ?? Application.Screen.Size); diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs index 2008f22e49..a0cc6b3356 100644 --- a/Terminal.Gui/Views/Slider.cs +++ b/Terminal.Gui/Views/Slider.cs @@ -59,7 +59,7 @@ private void SetInitialProperties ( // BUGBUG: This should not be needed - Need to ensure SetRelativeLayout gets called during EndInit Initialized += (s, e) => { SetContentSize (); }; - SubviewLayout += (s, e) => { SetContentSize (); }; + SubViewLayout += (s, e) => { SetContentSize (); }; } // TODO: Make configurable via ConfigurationManager diff --git a/Terminal.Gui/Views/StatusBar.cs b/Terminal.Gui/Views/StatusBar.cs index 2f1ed36dc4..d53e991b07 100644 --- a/Terminal.Gui/Views/StatusBar.cs +++ b/Terminal.Gui/Views/StatusBar.cs @@ -26,7 +26,7 @@ public StatusBar (IEnumerable shortcuts) : base (shortcuts) BorderStyle = LineStyle.Dashed; ColorScheme = Colors.ColorSchemes ["Menu"]; - SubviewLayout += StatusBar_LayoutStarted; + SubViewLayout += StatusBar_LayoutStarted; } // StatusBar arranges the items horizontally. @@ -34,13 +34,13 @@ public StatusBar (IEnumerable shortcuts) : base (shortcuts) // The Shortcuts are configured with the command, help, and key views aligned in reverse order (EndToStart). private void StatusBar_LayoutStarted (object sender, LayoutEventArgs e) { - for (int index = 0; index < Subviews.Count; index++) + for (int index = 0; index < SubViews.Count; index++) { - View barItem = Subviews [index]; + View barItem = SubViews [index]; barItem.BorderStyle = BorderStyle; - if (index == Subviews.Count - 1) + if (index == SubViews.Count - 1) { barItem.Border.Thickness = new Thickness (0, 0, 0, 0); } diff --git a/Terminal.Gui/Views/TabView/TabRow.cs b/Terminal.Gui/Views/TabView/TabRow.cs index 2ca80a69ae..a34d4075db 100644 --- a/Terminal.Gui/Views/TabView/TabRow.cs +++ b/Terminal.Gui/Views/TabView/TabRow.cs @@ -115,7 +115,7 @@ protected override void OnHasFocusChanged (bool newHasFocus, View? previousFocus } /// - protected override void OnSubviewLayout (LayoutEventArgs args) + protected override void OnSubViewLayout (LayoutEventArgs args) { _host._tabLocations = _host.CalculateViewport (Viewport).ToArray (); @@ -123,7 +123,7 @@ protected override void OnSubviewLayout (LayoutEventArgs args) RenderUnderline (); - base.OnSubviewLayout (args); + base.OnSubViewLayout (args); } /// @@ -765,7 +765,7 @@ private void RenderUnderline () _leftScrollIndicator.Visible = true; // Ensures this is clicked instead of the first tab - MoveSubviewToEnd (_leftScrollIndicator); + MoveSubViewToEnd (_leftScrollIndicator); } else { @@ -782,7 +782,7 @@ private void RenderUnderline () _rightScrollIndicator.Visible = true; // Ensures this is clicked instead of the last tab if under this - MoveSubviewToStart (_rightScrollIndicator); + MoveSubViewToStart (_rightScrollIndicator); } else { diff --git a/Terminal.Gui/Views/TabView/TabView.cs b/Terminal.Gui/Views/TabView/TabView.cs index 73f286b564..5dc14b8bf6 100644 --- a/Terminal.Gui/Views/TabView/TabView.cs +++ b/Terminal.Gui/Views/TabView/TabView.cs @@ -160,7 +160,7 @@ private bool TabCanSetFocus () private void ContainerViewCanFocus (object sender, EventArgs eventArgs) { - _containerView.CanFocus = _containerView.Subviews.Count (v => v.CanFocus) > 0; + _containerView.CanFocus = _containerView.SubViews.Count (v => v.CanFocus) > 0; } private TabStyle _style = new (); diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs index a8a925d2c7..63e1207da7 100644 --- a/Terminal.Gui/Views/TextView.cs +++ b/Terminal.Gui/Views/TextView.cs @@ -1901,7 +1901,7 @@ public TextView () IsAddedChanged += TextView_IsAddedChanged!; - SubviewsLaidOut += TextView_LayoutComplete; + SubViewsLaidOut += TextView_LayoutComplete; // Things this view knows how to do diff --git a/Terminal.Gui/Views/TileView.cs b/Terminal.Gui/Views/TileView.cs index c2693f1914..f3aed9c2ab 100644 --- a/Terminal.Gui/Views/TileView.cs +++ b/Terminal.Gui/Views/TileView.cs @@ -23,7 +23,7 @@ public TileView (int tiles) CanFocus = true; RebuildForTileCount (tiles); - SubviewLayout += (_, _) => + SubViewLayout += (_, _) => { Rectangle viewport = Viewport; @@ -100,14 +100,14 @@ public int IndexOf (View toFind, bool recursive = false) return i; } - if (v.Subviews.Contains (toFind)) + if (v.SubViews.Contains (toFind)) { return i; } if (recursive) { - if (RecursiveContains (v.Subviews, toFind)) + if (RecursiveContains (v.SubViews, toFind)) { return i; } @@ -485,7 +485,7 @@ public bool TrySplitTile (int idx, int numberOfPanels, out TileView result) }; // Take everything out of the View we are moving - View [] childViews = toMove!.Subviews.ToArray (); + View [] childViews = toMove!.SubViews.ToArray (); toMove.RemoveAll (); // Remove the view itself and replace it with the new TileView @@ -533,7 +533,7 @@ private List GetAllLineViewsRecursively (View v) { List lines = new (); - foreach (View sub in v.Subviews) + foreach (View sub in v.SubViews) { if (sub is TileViewLineView s) { @@ -756,7 +756,7 @@ private bool RecursiveContains (IEnumerable haystack, View needle) return true; } - if (RecursiveContains (v.Subviews, needle)) + if (RecursiveContains (v.SubViews, needle)) { return true; } diff --git a/Terminal.Gui/Views/Toplevel.cs b/Terminal.Gui/Views/Toplevel.cs index 7861fcfd0b..1ecaf5ec1b 100644 --- a/Terminal.Gui/Views/Toplevel.cs +++ b/Terminal.Gui/Views/Toplevel.cs @@ -66,15 +66,15 @@ public Toplevel () #endregion - #region Subviews + #region SubViews // TODO: Deprecate - Any view can host a menubar in v2 /// Gets the latest added into this Toplevel. - public MenuBar? MenuBar => (MenuBar?)Subviews?.LastOrDefault (s => s is MenuBar); + public MenuBar? MenuBar => (MenuBar?)SubViews?.LastOrDefault (s => s is MenuBar); //// TODO: Deprecate - Any view can host a statusbar in v2 ///// Gets the latest added into this Toplevel. - //public StatusBar? StatusBar => (StatusBar?)Subviews?.LastOrDefault (s => s is StatusBar); + //public StatusBar? StatusBar => (StatusBar?)SubViews?.LastOrDefault (s => s is StatusBar); #endregion @@ -127,7 +127,7 @@ public virtual void OnLoaded () { IsLoaded = true; - foreach (var view in Subviews.Where (v => v is Toplevel)) + foreach (var view in SubViews.Where (v => v is Toplevel)) { var tl = (Toplevel)view; tl.OnLoaded (); @@ -180,7 +180,7 @@ internal virtual bool OnClosing (ToplevelClosingEventArgs ev) /// internal virtual void OnReady () { - foreach (var view in Subviews.Where (v => v is Toplevel)) + foreach (var view in SubViews.Where (v => v is Toplevel)) { var tl = (Toplevel)view; tl.OnReady (); @@ -192,7 +192,7 @@ internal virtual void OnReady () /// Called from before the is disposed. internal virtual void OnUnloaded () { - foreach (var view in Subviews.Where (v => v is Toplevel)) + foreach (var view in SubViews.Where (v => v is Toplevel)) { var tl = (Toplevel)view; tl.OnUnloaded (); @@ -235,7 +235,7 @@ out int ny return; } - //var layoutSubviews = false; + //var layoutSubViews = false; var maxWidth = 0; if (superView.Margin is { } && superView == top.SuperView) @@ -251,25 +251,25 @@ out int ny if (top?.X is null or PosAbsolute && top?.Frame.X != nx) { top!.X = nx; - //layoutSubviews = true; + //layoutSubViews = true; } if (top?.Y is null or PosAbsolute && top?.Frame.Y != ny) { top!.Y = ny; - //layoutSubviews = true; + //layoutSubViews = true; } } - //if (superView.IsLayoutNeeded () || layoutSubviews) + //if (superView.IsLayoutNeeded () || layoutSubViews) //{ - // superView.LayoutSubviews (); + // superView.LayoutSubViews (); //} //if (IsLayoutNeeded ()) //{ - // LayoutSubviews (); + // LayoutSubViews (); //} } diff --git a/Terminal.Gui/Views/Wizard/Wizard.cs b/Terminal.Gui/Views/Wizard/Wizard.cs index 2155c7cc14..0bff72f2f7 100644 --- a/Terminal.Gui/Views/Wizard/Wizard.cs +++ b/Terminal.Gui/Views/Wizard/Wizard.cs @@ -357,7 +357,7 @@ public bool GoToStep (WizardStep? newStep) UpdateButtonsAndTitle (); // Set focus on the contentview - newStep?.Subviews.ToArray () [0].SetFocus (); + newStep?.SubViews.ToArray () [0].SetFocus (); if (OnStepChanged (oldStep, _currentStep)) { @@ -501,7 +501,7 @@ private void SizeStep (WizardStep step) step.Height = Dim.Fill ( Dim.Func ( () => IsInitialized - ? Subviews.First (view => view.Y.Has (out _)).Frame.Height + 1 + ? SubViews.First (view => view.Y.Has (out _)).Frame.Height + 1 : 1)); // for button frame (+1 for lineView) step.Width = Dim.Fill (); } @@ -513,7 +513,7 @@ private void SizeStep (WizardStep step) step.Height = Dim.Fill ( Dim.Func ( () => IsInitialized - ? Subviews.First (view => view.Y.Has (out _)).Frame.Height + 1 + ? SubViews.First (view => view.Y.Has (out _)).Frame.Height + 1 : 2)); // for button frame (+1 for lineView) step.Width = Dim.Fill (); } diff --git a/Terminal.Gui/Views/Wizard/WizardStep.cs b/Terminal.Gui/Views/Wizard/WizardStep.cs index afb750ffba..cf1b781da7 100644 --- a/Terminal.Gui/Views/Wizard/WizardStep.cs +++ b/Terminal.Gui/Views/Wizard/WizardStep.cs @@ -88,7 +88,7 @@ public WizardStep () // scrollBar.OtherScrollBarView.Size = helpTextView.Maxlength; // scrollBar.OtherScrollBarView.Position = helpTextView.LeftColumn; // } - // scrollBar.LayoutSubviews (); + // scrollBar.LayoutSubViews (); // scrollBar.Refresh (); //}; //base.Add (scrollBar); @@ -151,7 +151,7 @@ public override View Add (View? view) container?.Remove (view); } - if (_contentView.InternalSubviews.Count < 1) + if (_contentView.InternalSubViews.Count < 1) { CanFocus = false; } @@ -176,7 +176,7 @@ internal void ShowHide () _helpTextView.Height = Dim.Height(_contentView); _helpTextView.Width = Dim.Fill (); - if (_contentView.InternalSubviews?.Count > 0) + if (_contentView.InternalSubViews?.Count > 0) { if (_helpTextView.Text.Length > 0) { @@ -199,7 +199,7 @@ internal void ShowHide () // Error - no pane shown } - _contentView.Visible = _contentView.InternalSubviews?.Count > 0; + _contentView.Visible = _contentView.InternalSubViews?.Count > 0; _helpTextView.Visible = _helpTextView.Text.Length > 0; } } // end of WizardStep class diff --git a/Tests/IntegrationTests/UICatalog/ScenarioTests.cs b/Tests/IntegrationTests/UICatalog/ScenarioTests.cs index 3de2735f43..b41ed021e9 100644 --- a/Tests/IntegrationTests/UICatalog/ScenarioTests.cs +++ b/Tests/IntegrationTests/UICatalog/ScenarioTests.cs @@ -294,7 +294,7 @@ public void Run_All_Views_Tester_Scenario () // Remove existing class, if any if (_curView != null) { - _curView.SubviewsLaidOut -= LayoutCompleteHandler; + _curView.SubViewsLaidOut -= LayoutCompleteHandler; _hostPane.Remove (_curView); _curView.Dispose (); _curView = null; @@ -358,7 +358,7 @@ public void Run_All_Views_Tester_Scenario () top.Add (_leftPane, _settingsPane, _hostPane); - top.LayoutSubviews (); + top.LayoutSubViews (); _curView = CreateClass (_viewClasses.First ().Value); @@ -593,13 +593,13 @@ View CreateClass (Type type) _hostPane.Add (view); //DimPosChanged (); - _hostPane.LayoutSubviews (); + _hostPane.LayoutSubViews (); _hostPane.ClearViewport (); _hostPane.SetNeedsDraw (); UpdateSettings (view); UpdateTitle (view); - view.SubviewsLaidOut += LayoutCompleteHandler; + view.SubViewsLaidOut += LayoutCompleteHandler; return view; } diff --git a/Tests/StressTests/ScenariosStressTests.cs b/Tests/StressTests/ScenariosStressTests.cs index a59c4f1878..0944d83822 100644 --- a/Tests/StressTests/ScenariosStressTests.cs +++ b/Tests/StressTests/ScenariosStressTests.cs @@ -150,19 +150,19 @@ void OnApplicationNotifyNewRunState (object? sender, RunStateEventArgs e) { // Get a list of all subviews under Application.Top (and their subviews, etc.) // and subscribe to their DrawComplete event - void SubscribeAllSubviews (View view) + void SubscribeAllSubViews (View view) { view.DrawComplete += (s, a) => drawCompleteCount++; - view.SubviewsLaidOut += (s, a) => laidOutCount++; + view.SubViewsLaidOut += (s, a) => laidOutCount++; view.IsAddedChanged += (s, a) => addedCount++; - foreach (View subview in view.Subviews) + foreach (View subview in view.SubViews) { - SubscribeAllSubviews (subview); + SubscribeAllSubViews (subview); } } - SubscribeAllSubviews (Application.Top!); + SubscribeAllSubViews (Application.Top!); } // If the scenario doesn't close within the abort time, this will force it to quit diff --git a/Tests/UnitTests/Dialogs/WizardTests.cs b/Tests/UnitTests/Dialogs/WizardTests.cs index a73d0e15f1..71504333b9 100644 --- a/Tests/UnitTests/Dialogs/WizardTests.cs +++ b/Tests/UnitTests/Dialogs/WizardTests.cs @@ -462,7 +462,7 @@ public void OneStepWizard_Shows () var wizard = new Wizard { Title = title, Width = width, Height = height }; wizard.AddStep (new() { Title = stepTitle }); - //wizard.LayoutSubviews (); + //wizard.LayoutSubViews (); var firstIteration = false; RunState runstate = Application.Begin (wizard); Application.RunIteration (ref runstate, firstIteration); diff --git a/Tests/UnitTests/FileServices/FileDialogTests.cs b/Tests/UnitTests/FileServices/FileDialogTests.cs index 269670509b..bb074a8a17 100644 --- a/Tests/UnitTests/FileServices/FileDialogTests.cs +++ b/Tests/UnitTests/FileServices/FileDialogTests.cs @@ -33,7 +33,7 @@ public void CancelSelection (bool cancel) public void DirectTyping_Allowed () { FileDialog dlg = GetInitializedFileDialog (); - TextField tf = dlg.Subviews.OfType ().First (t => t.HasFocus); + TextField tf = dlg.SubViews.OfType ().First (t => t.HasFocus); tf.ClearAllSelection (); tf.CursorPosition = tf.Text.Length; Assert.True (tf.HasFocus); @@ -321,7 +321,7 @@ public void OnLoad_TextBoxIsFocused () { FileDialog dlg = GetInitializedFileDialog (); - View tf = dlg.Subviews.FirstOrDefault (t => t.HasFocus); + View tf = dlg.SubViews.FirstOrDefault (t => t.HasFocus); Assert.NotNull (tf); Assert.IsType (tf); dlg.Dispose (); @@ -793,9 +793,9 @@ private TextField GetTextField (FileDialog dlg, FileDialogPart part) switch (part) { case FileDialogPart.Path: - return dlg.Subviews.OfType ().ElementAt (0); + return dlg.SubViews.OfType ().ElementAt (0); case FileDialogPart.SearchField: - return dlg.Subviews.OfType ().ElementAt (1); + return dlg.SubViews.OfType ().ElementAt (1); default: throw new ArgumentOutOfRangeException (nameof (part), part, null); } @@ -803,8 +803,8 @@ private TextField GetTextField (FileDialog dlg, FileDialogPart part) private TableView GetTableView (FileDialog dlg) { - var tile = dlg.Subviews.OfType ().Single (); - return (TableView)tile.Tiles.ElementAt (1).ContentView.Subviews.ElementAt(0); + var tile = dlg.SubViews.OfType ().Single (); + return (TableView)tile.Tiles.ElementAt (1).ContentView.SubViews.ElementAt(0); } private enum FileDialogPart diff --git a/Tests/UnitTests/View/Adornment/BorderTests.cs b/Tests/UnitTests/View/Adornment/BorderTests.cs index 42cb210b34..d99787ffbb 100644 --- a/Tests/UnitTests/View/Adornment/BorderTests.cs +++ b/Tests/UnitTests/View/Adornment/BorderTests.cs @@ -838,7 +838,7 @@ public void View_SetBorderStyle () │ ┊ ┊ └─┴┄┘")] [SetupFakeDriver] - public void SuperViewRendersLineCanvas_No_Subviews_AutoJoinsLines (bool superViewRendersLineCanvas, string expected) + public void SuperViewRendersLineCanvas_No_SubViews_AutoJoinsLines (bool superViewRendersLineCanvas, string expected) { View superView = new View () { diff --git a/Tests/UnitTests/View/Draw/AllViewsDrawTests.cs b/Tests/UnitTests/View/Draw/AllViewsDrawTests.cs index 9cbac00b30..09db78a05a 100644 --- a/Tests/UnitTests/View/Draw/AllViewsDrawTests.cs +++ b/Tests/UnitTests/View/Draw/AllViewsDrawTests.cs @@ -35,10 +35,10 @@ public void AllViews_Draw_Does_Not_Layout (Type viewType) view.DrawComplete += (s, e) => drawCompleteCount++; var layoutStartedCount = 0; - view.SubviewLayout += (s, e) => layoutStartedCount++; + view.SubViewLayout += (s, e) => layoutStartedCount++; var layoutCompleteCount = 0; - view.SubviewsLaidOut += (s, e) => layoutCompleteCount++; + view.SubViewsLaidOut += (s, e) => layoutCompleteCount++; view.SetNeedsLayout (); view.Layout (); diff --git a/Tests/UnitTests/View/Draw/ClearViewportTests.cs b/Tests/UnitTests/View/Draw/ClearViewportTests.cs index 236e66506e..b9c1dcca8e 100644 --- a/Tests/UnitTests/View/Draw/ClearViewportTests.cs +++ b/Tests/UnitTests/View/Draw/ClearViewportTests.cs @@ -115,7 +115,7 @@ public void Clear_ClearsEntireViewport () superView.Add (view); superView.BeginInit (); superView.EndInit (); - superView.LayoutSubviews (); + superView.LayoutSubViews (); superView.Draw (); @@ -165,7 +165,7 @@ public void Clear_WithClearVisibleContentOnly_ClearsVisibleContentOnly () superView.Add (view); superView.BeginInit (); superView.EndInit (); - superView.LayoutSubviews (); + superView.LayoutSubViews (); superView.Draw (); diff --git a/Tests/UnitTests/View/Draw/ClipTests.cs b/Tests/UnitTests/View/Draw/ClipTests.cs index 7eccc918d4..d3d1ed039e 100644 --- a/Tests/UnitTests/View/Draw/ClipTests.cs +++ b/Tests/UnitTests/View/Draw/ClipTests.cs @@ -79,7 +79,7 @@ public void FillRect_Fills_HonorsClip (int x, int y, int width, int height) superView.Add (view); superView.BeginInit (); superView.EndInit (); - superView.LayoutSubviews (); + superView.LayoutSubViews (); superView.Draw (); diff --git a/Tests/UnitTests/View/Draw/DrawTests.cs b/Tests/UnitTests/View/Draw/DrawTests.cs index eed5c35323..2fd95d5f8e 100644 --- a/Tests/UnitTests/View/Draw/DrawTests.cs +++ b/Tests/UnitTests/View/Draw/DrawTests.cs @@ -407,7 +407,7 @@ public void Draw_Negative_Viewport_Horizontal_Without_New_Lines () // BUGBUG: v2 - it's bogus to reference .Frame before BeginInit. And why is the clip being set anyway??? - top.SubviewsLaidOut += Top_LayoutComplete; + top.SubViewsLaidOut += Top_LayoutComplete; Application.Begin (top); Application.LayoutAndDraw (); diff --git a/Tests/UnitTests/View/Draw/NeedsDrawTests.cs b/Tests/UnitTests/View/Draw/NeedsDrawTests.cs index 21a09589f9..4d2a9af45f 100644 --- a/Tests/UnitTests/View/Draw/NeedsDrawTests.cs +++ b/Tests/UnitTests/View/Draw/NeedsDrawTests.cs @@ -39,13 +39,13 @@ public void Frame_Set_After_Initialize_Update_NeededDisplay () RunState runState = Application.Begin (top); - top.SubviewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 80, 25), top._needsDrawRect); }; + top.SubViewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 80, 25), top._needsDrawRect); }; - frame.SubviewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 40, 8), frame._needsDrawRect); }; + frame.SubViewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 40, 8), frame._needsDrawRect); }; - label.SubviewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 38, 1), label._needsDrawRect); }; + label.SubViewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 38, 1), label._needsDrawRect); }; - view.SubviewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 13, 1), view._needsDrawRect); }; + view.SubViewsLaidOut += (s, e) => { Assert.Equal (new (0, 0, 13, 1), view._needsDrawRect); }; Assert.Equal (new (0, 0, 80, 25), top.Frame); Assert.Equal (new (20, 8, 40, 8), frame.Frame); diff --git a/Tests/UnitTests/View/Draw/TransparentTests.cs b/Tests/UnitTests/View/Draw/TransparentTests.cs index 81747914ab..946b3a4f5a 100644 --- a/Tests/UnitTests/View/Draw/TransparentTests.cs +++ b/Tests/UnitTests/View/Draw/TransparentTests.cs @@ -56,7 +56,7 @@ public void Transparent_Text_Occludes () [Fact] [SetupFakeDriver] - public void Transparent_Subview_Occludes () + public void Transparent_SubView_Occludes () { var super = new View { diff --git a/Tests/UnitTests/View/Layout/Dim.Tests.cs b/Tests/UnitTests/View/Layout/Dim.Tests.cs index 5b1698371e..1b0287f803 100644 --- a/Tests/UnitTests/View/Layout/Dim.Tests.cs +++ b/Tests/UnitTests/View/Layout/Dim.Tests.cs @@ -175,7 +175,7 @@ public void Only_DimAbsolute_And_DimFactor_As_A_Different_Procedure_For_Assignin w.Width = 200; Assert.True (t.NeedsLayout); w.Height = 200; - t.LayoutSubviews (); + t.LayoutSubViews (); Assert.Equal ("Absolute(200)", w.Width.ToString ()); Assert.Equal ("Absolute(200)", w.Height.ToString ()); diff --git a/Tests/UnitTests/View/Layout/LayoutTests.cs b/Tests/UnitTests/View/Layout/LayoutTests.cs index 46b088394b..3967cd9ae6 100644 --- a/Tests/UnitTests/View/Layout/LayoutTests.cs +++ b/Tests/UnitTests/View/Layout/LayoutTests.cs @@ -33,10 +33,10 @@ public void AllViews_Layout_Does_Not_Draw (Type viewType) view.DrawingContent += (s, e) => drawContentCount++; var layoutStartedCount = 0; - view.SubviewLayout += (s, e) => layoutStartedCount++; + view.SubViewLayout += (s, e) => layoutStartedCount++; var layoutCompleteCount = 0; - view.SubviewsLaidOut += (s, e) => layoutCompleteCount++; + view.SubViewsLaidOut += (s, e) => layoutCompleteCount++; view.SetNeedsLayout (); view.SetNeedsDraw(); diff --git a/Tests/UnitTests/View/Layout/Pos.CombineTests.cs b/Tests/UnitTests/View/Layout/Pos.CombineTests.cs index a3b8b50459..58a6c4761a 100644 --- a/Tests/UnitTests/View/Layout/Pos.CombineTests.cs +++ b/Tests/UnitTests/View/Layout/Pos.CombineTests.cs @@ -98,7 +98,7 @@ public void PosCombine_Refs_SuperView_Throws () f.X = Pos.X (Application.Top) + Pos.X (v2) - Pos.X (v1); f.Y = Pos.Y (Application.Top) + Pos.Y (v2) - Pos.Y (v1); - Application.Top.SubviewsLaidOut += (s, e) => + Application.Top.SubViewsLaidOut += (s, e) => { Assert.Equal (0, Application.Top.Frame.X); Assert.Equal (0, Application.Top.Frame.Y); diff --git a/Tests/UnitTests/View/Mouse/GetViewsUnderMouseTests.cs b/Tests/UnitTests/View/Mouse/GetViewsUnderMouseTests.cs index 474dfa687f..08bb8221ed 100644 --- a/Tests/UnitTests/View/Mouse/GetViewsUnderMouseTests.cs +++ b/Tests/UnitTests/View/Mouse/GetViewsUnderMouseTests.cs @@ -523,7 +523,7 @@ public void Returns_Correct_If_Start_Has_Offset_Viewport (int offset, int testX, [InlineData (2, 3, false)] [InlineData (5, 6, false)] [InlineData (6, 7, false)] - public void Returns_Correct_If_Start_Has_Adornment_WithSubview (int testX, int testY, bool expectedSubViewFound) + public void Returns_Correct_If_Start_Has_Adornment_WithSubView (int testX, int testY, bool expectedSubViewFound) { Application.Top = new () { @@ -622,7 +622,7 @@ public void Returns_Correct_If_SubView_Has_Adornments (int testX, int testY, boo [InlineData (5, 6, false)] [InlineData (6, 5, false)] [InlineData (5, 5, true)] - public void Returns_Correct_If_SubView_Has_Adornment_WithSubview (int testX, int testY, bool expectedSubViewFound) + public void Returns_Correct_If_SubView_Has_Adornment_WithSubView (int testX, int testY, bool expectedSubViewFound) { Application.Top = new () { @@ -639,21 +639,21 @@ public void Returns_Correct_If_SubView_Has_Adornment_WithSubview (int testX, int // This subview will be at the bottom-right-corner of subview // So screen-relative location will be X + Width - 1 = 5 - var paddingSubview = new View + var paddingSubView = new View { X = Pos.AnchorEnd (1), Y = Pos.AnchorEnd (1), Width = 1, Height = 1 }; - subview.Padding.Add (paddingSubview); + subview.Padding.Add (paddingSubView); Application.Top.Add (subview); Application.Top.BeginInit (); Application.Top.EndInit (); View? found = View.GetViewsUnderMouse (new (testX, testY)).LastOrDefault (); - Assert.Equal (expectedSubViewFound, found == paddingSubview); + Assert.Equal (expectedSubViewFound, found == paddingSubView); Application.Top.Dispose (); Application.ResetState (true); } @@ -669,7 +669,7 @@ public void Returns_Correct_If_SubView_Has_Adornment_WithSubview (int testX, int [InlineData (5, 6, false)] [InlineData (6, 5, false)] [InlineData (5, 5, true)] - public void Returns_Correct_If_SubView_Is_Scrolled_And_Has_Adornment_WithSubview (int testX, int testY, bool expectedSubViewFound) + public void Returns_Correct_If_SubView_Is_Scrolled_And_Has_Adornment_WithSubView (int testX, int testY, bool expectedSubViewFound) { Application.Top = new () { @@ -690,21 +690,21 @@ public void Returns_Correct_If_SubView_Is_Scrolled_And_Has_Adornment_WithSubview // This subview will be at the bottom-right-corner of subview // So screen-relative location will be X + Width - 1 = 5 - var paddingSubview = new View + var paddingSubView = new View { X = Pos.AnchorEnd (1), Y = Pos.AnchorEnd (1), Width = 1, Height = 1 }; - subview.Padding.Add (paddingSubview); + subview.Padding.Add (paddingSubView); Application.Top.Add (subview); Application.Top.BeginInit (); Application.Top.EndInit (); View? found = View.GetViewsUnderMouse (new (testX, testY)).LastOrDefault (); - Assert.Equal (expectedSubViewFound, found == paddingSubview); + Assert.Equal (expectedSubViewFound, found == paddingSubView); Application.Top.Dispose (); Application.ResetState (true); } @@ -762,7 +762,7 @@ public void Returns_Correct_With_NestedSubViews (int testX, int testY, int expec [InlineData (2, 2, new [] { "top", "view", "subView" })] [InlineData (3, 3, new [] { "top" })] // clipped [InlineData (2, 3, new [] { "top" })] // clipped - public void GetViewsUnderMouse_Tiled_Subviews (int mouseX, int mouseY, string [] viewIdStrings) + public void GetViewsUnderMouse_Tiled_SubViews (int mouseX, int mouseY, string [] viewIdStrings) { // Arrange Application.Top = new () diff --git a/Tests/UnitTests/View/Navigation/AddRemoveTests.cs b/Tests/UnitTests/View/Navigation/AddRemoveTests.cs index 253dd6dbda..fcfc5ce666 100644 --- a/Tests/UnitTests/View/Navigation/AddRemoveTests.cs +++ b/Tests/UnitTests/View/Navigation/AddRemoveTests.cs @@ -6,7 +6,7 @@ namespace Terminal.Gui.ViewTests; public class AddRemoveNavigationTests () : TestsAllViews { [Fact] - public void Add_First_Subview_Gets_Focus () + public void Add_First_SubView_Gets_Focus () { View top = new View () { @@ -31,7 +31,7 @@ public void Add_First_Subview_Gets_Focus () } [Fact] - public void Add_Subsequent_Subview_Gets_Focus () + public void Add_Subsequent_SubView_Gets_Focus () { View top = new View () { @@ -66,7 +66,7 @@ public void Add_Subsequent_Subview_Gets_Focus () } [Fact] - public void Add_Nested_Subviews_Deepest_Gets_Focus () + public void Add_Nested_SubViews_Deepest_Gets_Focus () { View top = new View () { @@ -101,7 +101,7 @@ public void Add_Nested_Subviews_Deepest_Gets_Focus () [Fact] - public void Remove_Subview_Raises_HasFocusChanged () + public void Remove_SubView_Raises_HasFocusChanged () { var top = new View { @@ -177,7 +177,7 @@ public void Remove_Subview_Raises_HasFocusChanged () [Fact] - public void Remove_Focused_Subview_Keeps_Focus_And_SubView_Looses_Focus () + public void Remove_Focused_SubView_Keeps_Focus_And_SubView_Looses_Focus () { View top = new View () { @@ -205,7 +205,7 @@ public void Remove_Focused_Subview_Keeps_Focus_And_SubView_Looses_Focus () } [Fact] - public void Remove_Focused_Subview_Keeps_Focus_And_SubView_Looses_Focus_And_Next_Gets_Focus () + public void Remove_Focused_SubView_Keeps_Focus_And_SubView_Looses_Focus_And_Next_Gets_Focus () { View top = new View () { diff --git a/Tests/UnitTests/View/Navigation/AdvanceFocusTests.cs b/Tests/UnitTests/View/Navigation/AdvanceFocusTests.cs index efa89d7218..9ae00fbc80 100644 --- a/Tests/UnitTests/View/Navigation/AdvanceFocusTests.cs +++ b/Tests/UnitTests/View/Navigation/AdvanceFocusTests.cs @@ -75,7 +75,7 @@ public void AdvanceFocus_Change_CanFocus_Works ([CombinatorialValues (TabBehavio [Fact] - public void AdvanceFocus_Subviews_TabStop () + public void AdvanceFocus_SubViews_TabStop () { TabBehavior behavior = TabBehavior.TabStop; var top = new View { Id = "top", CanFocus = true }; @@ -106,24 +106,24 @@ public void AdvanceFocus_Subviews_TabStop () } [Fact] - public void AdvanceFocus_Compound_Subview_TabStop () + public void AdvanceFocus_Compound_SubView_TabStop () { TabBehavior behavior = TabBehavior.TabStop; var top = new View { Id = "top", CanFocus = true }; - var compoundSubview = new View + var compoundSubView = new View { CanFocus = true, - Id = "compoundSubview", + Id = "compoundSubView", TabStop = behavior }; var v1 = new View { Id = "v1", CanFocus = true, TabStop = behavior }; var v2 = new View { Id = "v2", CanFocus = true, TabStop = behavior }; var v3 = new View { Id = "v3", CanFocus = false, TabStop = behavior }; - compoundSubview.Add (v1, v2, v3); + compoundSubView.Add (v1, v2, v3); - top.Add (compoundSubview); + top.Add (compoundSubView); // Cycle through v1 & v2 top.AdvanceFocus (NavigationDirection.Forward, behavior); @@ -140,17 +140,17 @@ public void AdvanceFocus_Compound_Subview_TabStop () Assert.False (v3.HasFocus); // Add another subview - View otherSubview = new () + View otherSubView = new () { CanFocus = true, TabStop = behavior, - Id = "otherSubview" + Id = "otherSubView" }; - top.Add (otherSubview); + top.Add (otherSubView); // Adding a focusable subview causes advancefocus - Assert.True (otherSubview.HasFocus); + Assert.True (otherSubView.HasFocus); Assert.False (v1.HasFocus); // Cycle through v1 & v2 @@ -167,7 +167,7 @@ public void AdvanceFocus_Compound_Subview_TabStop () Assert.False (v2.HasFocus); Assert.False (v3.HasFocus); - Assert.True (otherSubview.HasFocus); + Assert.True (otherSubView.HasFocus); // v2 was previously focused down the compoundSubView focus chain top.AdvanceFocus (NavigationDirection.Forward, behavior); @@ -180,7 +180,7 @@ public void AdvanceFocus_Compound_Subview_TabStop () [Fact] - public void AdvanceFocus_CompoundCompound_Subview_TabStop () + public void AdvanceFocus_CompoundCompound_SubView_TabStop () { TabBehavior behavior = TabBehavior.TabStop; var top = new View { Id = "top", CanFocus = true }; @@ -189,34 +189,34 @@ public void AdvanceFocus_CompoundCompound_Subview_TabStop () var topv3 = new View { Id = "topv3", CanFocus = false, TabStop = behavior }; top.Add (topv1, topv2, topv3); - var compoundSubview = new View + var compoundSubView = new View { CanFocus = true, - Id = "compoundSubview", + Id = "compoundSubView", TabStop = behavior }; var v1 = new View { Id = "v1", CanFocus = true, TabStop = behavior }; var v2 = new View { Id = "v2", CanFocus = true, TabStop = behavior }; var v3 = new View { Id = "v3", CanFocus = false, TabStop = behavior }; - compoundSubview.Add (v1, v2, v3); + compoundSubView.Add (v1, v2, v3); - var compoundCompoundSubview = new View + var compoundCompoundSubView = new View { CanFocus = true, - Id = "compoundCompoundSubview", + Id = "compoundCompoundSubView", TabStop = behavior }; var v4 = new View { Id = "v4", CanFocus = true, TabStop = behavior }; var v5 = new View { Id = "v5", CanFocus = true, TabStop = behavior }; var v6 = new View { Id = "v6", CanFocus = false, TabStop = behavior }; - compoundCompoundSubview.Add (v4, v5, v6); + compoundCompoundSubView.Add (v4, v5, v6); - compoundSubview.Add (compoundCompoundSubview); + compoundSubView.Add (compoundCompoundSubView); - top.Add (compoundSubview); + top.Add (compoundSubView); top.SetFocus (); Assert.True (topv1.HasFocus); @@ -242,17 +242,17 @@ public void AdvanceFocus_CompoundCompound_Subview_TabStop () Assert.True (topv2.HasFocus); // Add another top subview. Should cycle to it after v5 - View otherSubview = new () + View otherSubView = new () { CanFocus = true, TabStop = behavior, - Id = "otherSubview" + Id = "otherSubView" }; - top.Add (otherSubview); + top.Add (otherSubView); // Adding a focusable subview causes advancefocus - Assert.True (otherSubview.HasFocus); + Assert.True (otherSubView.HasFocus); // Cycle through topv1, topv2, v1, v2, v4, v5 top.AdvanceFocus (NavigationDirection.Forward, behavior); @@ -265,7 +265,7 @@ public void AdvanceFocus_CompoundCompound_Subview_TabStop () Assert.True (v5.HasFocus); top.AdvanceFocus (NavigationDirection.Forward, behavior); - Assert.True (otherSubview.HasFocus); + Assert.True (otherSubView.HasFocus); // Should cycle back to topv1 top.AdvanceFocus (NavigationDirection.Forward, behavior); @@ -275,23 +275,23 @@ public void AdvanceFocus_CompoundCompound_Subview_TabStop () } [Fact] - public void AdvanceFocus_Compound_Subview_TabGroup () + public void AdvanceFocus_Compound_SubView_TabGroup () { var top = new View { Id = "top", CanFocus = true, TabStop = TabBehavior.TabGroup }; - var compoundSubview = new View + var compoundSubView = new View { CanFocus = true, - Id = "compoundSubview", + Id = "compoundSubView", TabStop = TabBehavior.TabGroup }; var tabStopView = new View { Id = "tabStop", CanFocus = true, TabStop = TabBehavior.TabStop }; var tabGroupView1 = new View { Id = "tabGroup1", CanFocus = true, TabStop = TabBehavior.TabGroup }; var tabGroupView2 = new View { Id = "tabGroup2", CanFocus = true, TabStop = TabBehavior.TabGroup }; - compoundSubview.Add (tabStopView, tabGroupView1, tabGroupView2); + compoundSubView.Add (tabStopView, tabGroupView1, tabGroupView2); - top.Add (compoundSubview); + top.Add (compoundSubView); top.SetFocus (); Assert.True (tabStopView.HasFocus); @@ -306,40 +306,40 @@ public void AdvanceFocus_Compound_Subview_TabGroup () Assert.True (tabGroupView2.HasFocus); // Add another TabGroup subview - View otherTabGroupSubview = new () + View otherTabGroupSubView = new () { CanFocus = true, TabStop = TabBehavior.TabGroup, - Id = "otherTabGroupSubview" + Id = "otherTabGroupSubView" }; - top.Add (otherTabGroupSubview); + top.Add (otherTabGroupSubView); // Adding a focusable subview causes advancefocus - Assert.True (otherTabGroupSubview.HasFocus); + Assert.True (otherTabGroupSubView.HasFocus); Assert.False (tabStopView.HasFocus); // TagBroup navs to the other subview top.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabGroup); - Assert.Equal (compoundSubview, top.Focused); + Assert.Equal (compoundSubView, top.Focused); Assert.True (tabStopView.HasFocus); top.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabGroup); - Assert.Equal (compoundSubview, top.Focused); + Assert.Equal (compoundSubView, top.Focused); Assert.True (tabGroupView1.HasFocus); top.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabGroup); - Assert.Equal (compoundSubview, top.Focused); + Assert.Equal (compoundSubView, top.Focused); Assert.True (tabGroupView2.HasFocus); // Now go backwards top.AdvanceFocus (NavigationDirection.Backward, TabBehavior.TabGroup); - Assert.Equal (compoundSubview, top.Focused); + Assert.Equal (compoundSubView, top.Focused); Assert.True (tabGroupView1.HasFocus); top.AdvanceFocus (NavigationDirection.Backward, TabBehavior.TabGroup); - Assert.Equal (otherTabGroupSubview, top.Focused); - Assert.True (otherTabGroupSubview.HasFocus); + Assert.Equal (otherTabGroupSubView, top.Focused); + Assert.True (otherTabGroupSubView.HasFocus); top.Dispose (); } @@ -443,7 +443,7 @@ public void AdvanceFocus_Null_And_CanFocus_False_No_Advance () } [Fact] - public void AdvanceFocus_Subviews_Raises_HasFocusChanged () + public void AdvanceFocus_SubViews_Raises_HasFocusChanged () { var top = new View { @@ -527,7 +527,7 @@ public void AdvanceFocus_Subviews_Raises_HasFocusChanged () } [Fact] - public void AdvanceFocus_Subviews_Raises_HasFocusChanging () + public void AdvanceFocus_SubViews_Raises_HasFocusChanging () { var top = new View { diff --git a/Tests/UnitTests/View/Navigation/EnabledTests.cs b/Tests/UnitTests/View/Navigation/EnabledTests.cs index 46f8a782b8..128a7cc8cc 100644 --- a/Tests/UnitTests/View/Navigation/EnabledTests.cs +++ b/Tests/UnitTests/View/Navigation/EnabledTests.cs @@ -23,7 +23,7 @@ public void Enabled_False_Leaves () } [Fact] - public void Enabled_False_Leaves_Subview () + public void Enabled_False_Leaves_SubView () { var view = new View { @@ -50,7 +50,7 @@ public void Enabled_False_Leaves_Subview () } [Fact] - public void Enabled_False_Leaves_Subview2 () + public void Enabled_False_Leaves_SubView2 () { var view = new Window { @@ -77,7 +77,7 @@ public void Enabled_False_Leaves_Subview2 () } [Fact] - public void Enabled_False_On_Subview_Leaves_Just_Subview () + public void Enabled_False_On_SubView_Leaves_Just_SubView () { var view = new View { @@ -104,7 +104,7 @@ public void Enabled_False_On_Subview_Leaves_Just_Subview () } [Fact] - public void Enabled_False_Focuses_Deepest_Focusable_Subview () + public void Enabled_False_Focuses_Deepest_Focusable_SubView () { var view = new View { @@ -152,7 +152,7 @@ public void Enabled_False_Focuses_Deepest_Focusable_Subview () } [Fact] - public void Enabled_True_Subview_Focuses_SubView () + public void Enabled_True_SubView_Focuses_SubView () { var view = new View { @@ -179,7 +179,7 @@ public void Enabled_True_Subview_Focuses_SubView () } [Fact] - public void Enabled_True_On_Subview_Focuses () + public void Enabled_True_On_SubView_Focuses () { var view = new View { @@ -206,7 +206,7 @@ public void Enabled_True_On_Subview_Focuses () } [Fact] - public void Enabled_True_Focuses_Deepest_Focusable_Subview () + public void Enabled_True_Focuses_Deepest_Focusable_SubView () { var view = new View { @@ -255,7 +255,7 @@ public void Enabled_True_Focuses_Deepest_Focusable_Subview () [Fact] [AutoInitShutdown] - public void _Enabled_Sets_Also_Sets_Subviews () + public void _Enabled_Sets_Also_Sets_SubViews () { var wasClicked = false; var button = new Button { Text = "Click Me" }; diff --git a/Tests/UnitTests/View/Navigation/HasFocusChangeEventTests.cs b/Tests/UnitTests/View/Navigation/HasFocusChangeEventTests.cs index bba863af61..35c6bac091 100644 --- a/Tests/UnitTests/View/Navigation/HasFocusChangeEventTests.cs +++ b/Tests/UnitTests/View/Navigation/HasFocusChangeEventTests.cs @@ -471,7 +471,7 @@ public void HasFocusChanging_SubView_Can_Cancel () [Fact] - public void HasFocusChanging_SetFocus_On_Subview_If_SubView_Cancels () + public void HasFocusChanging_SetFocus_On_SubView_If_SubView_Cancels () { var hasFocusTrueCount = 0; var hasFocusFalseCount = 0; @@ -982,7 +982,7 @@ public void HasFocusChanged_CompoundSubView_Raises () [Fact] - public void HasFocusChanged_NewValue_False_Hide_Subview () + public void HasFocusChanged_NewValue_False_Hide_SubView () { var subView1 = new View { diff --git a/Tests/UnitTests/View/Navigation/HasFocusTests.cs b/Tests/UnitTests/View/Navigation/HasFocusTests.cs index 59d22ef73d..04b8161115 100644 --- a/Tests/UnitTests/View/Navigation/HasFocusTests.cs +++ b/Tests/UnitTests/View/Navigation/HasFocusTests.cs @@ -48,7 +48,7 @@ public void HasFocus_False_WithSuperView_Does_Not_Change_SuperView () } [Fact] - public void HasFocus_False_WithSubview_Leaves_All () + public void HasFocus_False_WithSubView_Leaves_All () { var view = new View () { @@ -158,7 +158,7 @@ public void HasFocus_False_CompoundSubView_Leaves_All () } [Fact] - public void HasFocus_False_Subview_Raises_HasFocusChanged () + public void HasFocus_False_SubView_Raises_HasFocusChanged () { var top = new View { diff --git a/Tests/UnitTests/View/Navigation/NavigationTests.cs b/Tests/UnitTests/View/Navigation/NavigationTests.cs index d720676634..dafdfc4dc9 100644 --- a/Tests/UnitTests/View/Navigation/NavigationTests.cs +++ b/Tests/UnitTests/View/Navigation/NavigationTests.cs @@ -328,7 +328,7 @@ public void AllViews_Visible_False_No_HasFocus_Events (Type viewType) // View.Focused - No subviews [Fact] - public void Focused_NoSubviews () + public void Focused_NoSubViews () { var view = new View (); Assert.Null (view.Focused); @@ -338,7 +338,7 @@ public void Focused_NoSubviews () } [Fact] - public void GetMostFocused_NoSubviews_Returns_Null () + public void GetMostFocused_NoSubViews_Returns_Null () { var view = new View (); Assert.Null (view.Focused); diff --git a/Tests/UnitTests/View/Navigation/VisibleTests.cs b/Tests/UnitTests/View/Navigation/VisibleTests.cs index aa037c16eb..e537ef3e65 100644 --- a/Tests/UnitTests/View/Navigation/VisibleTests.cs +++ b/Tests/UnitTests/View/Navigation/VisibleTests.cs @@ -22,7 +22,7 @@ public void Visible_False_Leaves () } [Fact] - public void Visible_False_Leaves_Subview () + public void Visible_False_Leaves_SubView () { var view = new View { @@ -49,7 +49,7 @@ public void Visible_False_Leaves_Subview () } [Fact] - public void Visible_False_Leaves_Subview2 () + public void Visible_False_Leaves_SubView2 () { var view = new Window { @@ -76,7 +76,7 @@ public void Visible_False_Leaves_Subview2 () } [Fact] - public void Visible_False_On_Subview_Leaves_Just_Subview () + public void Visible_False_On_SubView_Leaves_Just_SubView () { var view = new View { @@ -103,7 +103,7 @@ public void Visible_False_On_Subview_Leaves_Just_Subview () } [Fact] - public void Visible_False_Focuses_Deepest_Focusable_Subview () + public void Visible_False_Focuses_Deepest_Focusable_SubView () { var view = new View { @@ -151,7 +151,7 @@ public void Visible_False_Focuses_Deepest_Focusable_Subview () } [Fact] - public void Visible_True_Subview_Focuses_SubView () + public void Visible_True_SubView_Focuses_SubView () { var view = new View { @@ -178,7 +178,7 @@ public void Visible_True_Subview_Focuses_SubView () } [Fact] - public void Visible_True_On_Subview_Focuses () + public void Visible_True_On_SubView_Focuses () { var view = new View { @@ -205,7 +205,7 @@ public void Visible_True_On_Subview_Focuses () } [Fact] - public void Visible_True_Focuses_Deepest_Focusable_Subview () + public void Visible_True_Focuses_Deepest_Focusable_SubView () { var view = new View { diff --git a/Tests/UnitTests/View/SubviewTests.cs b/Tests/UnitTests/View/SubviewTests.cs index 0727197576..bfedabe573 100644 --- a/Tests/UnitTests/View/SubviewTests.cs +++ b/Tests/UnitTests/View/SubviewTests.cs @@ -2,10 +2,10 @@ namespace Terminal.Gui.ViewTests; -public class SubviewTests +public class SubViewTests { private readonly ITestOutputHelper _output; - public SubviewTests (ITestOutputHelper output) { _output = output; } + public SubViewTests (ITestOutputHelper output) { _output = output; } // TODO: This is a poor unit tests. Not clear what it's testing. Refactor. [Fact] diff --git a/Tests/UnitTests/View/TextTests.cs b/Tests/UnitTests/View/TextTests.cs index 6370521ec4..7c8b024f3b 100644 --- a/Tests/UnitTests/View/TextTests.cs +++ b/Tests/UnitTests/View/TextTests.cs @@ -27,7 +27,7 @@ public void Setting_With_Height_Horizontal () Assert.Equal (new (0, 0, 5, 1), label.Frame); - top.LayoutSubviews (); + top.LayoutSubViews (); top.Draw (); var expected = @" @@ -42,7 +42,7 @@ public void Setting_With_Height_Horizontal () Assert.Equal (new (0, 0, 10, 2), label.Frame); - top.LayoutSubviews (); + top.LayoutSubViews (); View.SetClipToScreen (); top.Draw (); diff --git a/Tests/UnitTests/View/ViewCommandTests.cs b/Tests/UnitTests/View/ViewCommandTests.cs index 728cc3bff1..a760f65659 100644 --- a/Tests/UnitTests/View/ViewCommandTests.cs +++ b/Tests/UnitTests/View/ViewCommandTests.cs @@ -165,7 +165,7 @@ public void Button_IsDefault_Raises_Accepted_Correctly () }; w.Add (btnA, btnB); - w.LayoutSubviews (); + w.LayoutSubViews (); Application.Top = w; Application.TopLevels.Push(w); @@ -243,7 +243,7 @@ public void Button_CanFocus_False_Raises_Accepted_Correctly () Application.TopLevels.Push (w); Assert.Same (Application.Top, w); - w.LayoutSubviews (); + w.LayoutSubViews (); // Click button just like a driver would var btnFrame = btn.FrameToScreen (); diff --git a/Tests/UnitTests/View/ViewTests.cs b/Tests/UnitTests/View/ViewTests.cs index f42cc4abd8..a61ea5fb13 100644 --- a/Tests/UnitTests/View/ViewTests.cs +++ b/Tests/UnitTests/View/ViewTests.cs @@ -57,17 +57,17 @@ void View_Disposing (object sender, EventArgs e) container1.Remove ((View)sender); } - Assert.Single (container1.Subviews); + Assert.Single (container1.SubViews); var container2 = new View { Id = "Container2" }; container2.Add (view); Assert.Equal (container2, view.SuperView); - Assert.Equal (container1.Subviews.Count, container2.Subviews.Count); + Assert.Equal (container1.SubViews.Count, container2.SubViews.Count); container2.Dispose (); - Assert.Empty (container1.Subviews); - Assert.Empty (container2.Subviews); + Assert.Empty (container1.SubViews); + Assert.Empty (container2.SubViews); Assert.Equal (1, count); Assert.Null (view.SuperView); @@ -91,7 +91,7 @@ public void Disposing_Event_Notify_All_Subscribers_On_The_Second_Container () var view = new View { Id = "View" }; container1.Add (view); Assert.Equal (container1, view.SuperView); - Assert.Single (container1.Subviews); + Assert.Single (container1.SubViews); var container2 = new View { Id = "Container2" }; var count = 0; @@ -107,11 +107,11 @@ void View_Disposing (object sender, EventArgs e) container2.Remove ((View)sender); } - Assert.Equal (container1.Subviews.Count, container2.Subviews.Count); + Assert.Equal (container1.SubViews.Count, container2.SubViews.Count); container1.Dispose (); - Assert.Empty (container1.Subviews); - Assert.Empty (container2.Subviews); + Assert.Empty (container1.SubViews); + Assert.Empty (container2.SubViews); Assert.Equal (1, count); Assert.Null (view.SuperView); @@ -136,28 +136,28 @@ public void Not_Notifying_Dispose () container1.Add (view); Assert.Equal (container1, view.SuperView); - Assert.Single (container1.Subviews); + Assert.Single (container1.SubViews); var container2 = new View { Id = "Container2" }; container2.Add (view); Assert.Equal (container2, view.SuperView); - Assert.Equal (container1.Subviews.Count, container2.Subviews.Count); + Assert.Equal (container1.SubViews.Count, container2.SubViews.Count); container1.Dispose (); - Assert.Empty (container1.Subviews); - Assert.NotEmpty (container2.Subviews); - Assert.Single (container2.Subviews); + Assert.Empty (container1.SubViews); + Assert.NotEmpty (container2.SubViews); + Assert.Single (container2.SubViews); Assert.Null (view.SuperView); // Trying access disposed properties #if DEBUG_IDISPOSABLE - Assert.True (container2.Subviews [0].WasDisposed); + Assert.True (container2.SubViews [0].WasDisposed); #endif - Assert.False (container2.Subviews [0].CanFocus); - Assert.Null (container2.Subviews [0].Margin); - Assert.Null (container2.Subviews [0].Border); - Assert.Null (container2.Subviews [0].Padding); + Assert.False (container2.SubViews [0].CanFocus); + Assert.Null (container2.SubViews [0].Margin); + Assert.Null (container2.SubViews [0].Border); + Assert.Null (container2.SubViews [0].Padding); Assert.Null (view.SuperView); container2.Dispose (); @@ -218,7 +218,7 @@ public void New_Initializes () Assert.Equal (0, r.Y); Assert.False (r.IsCurrentTop); Assert.Empty (r.Id); - Assert.Empty (r.Subviews); + Assert.Empty (r.SubViews); Assert.False (r.WantContinuousButtonPressed); Assert.False (r.WantMousePositionReports); Assert.Null (r.SuperView); @@ -242,7 +242,7 @@ public void New_Initializes () Assert.Equal (0, r.Y); Assert.False (r.IsCurrentTop); Assert.Empty (r.Id); - Assert.Empty (r.Subviews); + Assert.Empty (r.SubViews); Assert.False (r.WantContinuousButtonPressed); Assert.False (r.WantMousePositionReports); Assert.Null (r.SuperView); @@ -266,7 +266,7 @@ public void New_Initializes () Assert.Equal (2, r.Y); Assert.False (r.IsCurrentTop); Assert.Empty (r.Id); - Assert.Empty (r.Subviews); + Assert.Empty (r.SubViews); Assert.False (r.WantContinuousButtonPressed); Assert.False (r.WantMousePositionReports); Assert.Null (r.SuperView); @@ -299,7 +299,7 @@ public void New_Initializes () #else Assert.Equal (string.Empty, r.Id); #endif - Assert.Empty (r.Subviews); + Assert.Empty (r.SubViews); Assert.False (r.WantContinuousButtonPressed); Assert.False (r.WantMousePositionReports); Assert.Null (r.SuperView); @@ -342,7 +342,7 @@ public void Test_Nested_Views_With_Height_Equal_To_One () v.BeginInit (); v.EndInit (); - v.LayoutSubviews (); + v.LayoutSubViews (); v.Draw (); var looksLike = @@ -368,7 +368,7 @@ public void View_With_No_Difference_Between_An_Object_Initializer_Compute_And_A_ super.Add (view); super.BeginInit (); super.EndInit (); - super.LayoutSubviews (); + super.LayoutSubViews (); Assert.Equal (1, view.X); Assert.Equal (2, view.Y); @@ -379,7 +379,7 @@ public void View_With_No_Difference_Between_An_Object_Initializer_Compute_And_A_ Assert.False (view.Viewport.IsEmpty); Assert.Equal (new (0, 0, 3, 4), view.Viewport); - view.LayoutSubviews (); + view.LayoutSubViews (); Assert.Equal (1, view.X); Assert.Equal (2, view.Y); @@ -423,7 +423,7 @@ public void View_With_No_Difference_Between_An_Object_Initializer_Compute_And_A_ super.Add (view); super.BeginInit (); super.EndInit (); - super.LayoutSubviews (); + super.LayoutSubViews (); Assert.Equal (1, view.X); Assert.Equal (2, view.Y); Assert.Equal (3, view.Width); @@ -488,7 +488,7 @@ public void Visible_Clear_The_View_Output () [Fact] [AutoInitShutdown] - public void Visible_Sets_Also_Sets_Subviews () + public void Visible_Sets_Also_Sets_SubViews () { var button = new Button { Text = "Click Me" }; var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () }; diff --git a/Tests/UnitTests/Views/AllViewsTests.cs b/Tests/UnitTests/Views/AllViewsTests.cs index 9d8f30a352..0845aff905 100644 --- a/Tests/UnitTests/Views/AllViewsTests.cs +++ b/Tests/UnitTests/Views/AllViewsTests.cs @@ -47,7 +47,7 @@ public void AllViews_Center_Properly (Type viewType) frame.Add (view); frame.BeginInit (); frame.EndInit (); - frame.LayoutSubviews (); + frame.LayoutSubViews (); // What's the natural width/height? int expectedX = (frame.Frame.Width - view.Frame.Width) / 2; diff --git a/Tests/UnitTests/Views/BarTests.cs b/Tests/UnitTests/Views/BarTests.cs index d5e50c7dcb..0fb88fea32 100644 --- a/Tests/UnitTests/Views/BarTests.cs +++ b/Tests/UnitTests/Views/BarTests.cs @@ -22,7 +22,7 @@ public void Constructor_Defaults () public void Constructor_InitializesEmpty_WhenNoShortcutsProvided () { var bar = new Bar (); - Assert.Empty (bar.Subviews); + Assert.Empty (bar.SubViews); } [Fact] @@ -36,10 +36,10 @@ public void Constructor_InitializesWithShortcuts_WhenProvided () var bar = new Bar (shortcuts); - Assert.Equal (shortcuts.Count, bar.Subviews.Count); + Assert.Equal (shortcuts.Count, bar.SubViews.Count); for (int i = 0; i < shortcuts.Count; i++) { - Assert.Same (shortcuts [i], bar.Subviews [i]); + Assert.Same (shortcuts [i], bar.SubViews [i]); } } @@ -70,7 +70,7 @@ public void AddShortcutAt_InsertsShortcutCorrectly () var shortcut = new Shortcut (Key.Empty, "Command", null, null); bar.AddShortcutAt (0, shortcut); - Assert.Contains (shortcut, bar.Subviews); + Assert.Contains (shortcut, bar.SubViews); } [Fact] @@ -83,8 +83,8 @@ public void RemoveShortcut_RemovesShortcutCorrectly () var removedShortcut = bar.RemoveShortcut (0); Assert.Same (shortcut1, removedShortcut); - Assert.DoesNotContain (shortcut1, bar.Subviews); - Assert.Contains (shortcut2, bar.Subviews); + Assert.DoesNotContain (shortcut1, bar.SubViews); + Assert.Contains (shortcut2, bar.SubViews); } [Fact] @@ -95,11 +95,11 @@ public void Layout_ChangesBasedOnOrientation () var bar = new Bar (new List { shortcut1, shortcut2 }); bar.Orientation = Orientation.Horizontal; - bar.LayoutSubviews (); + bar.LayoutSubViews (); // TODO: Assert specific layout expectations for horizontal orientation bar.Orientation = Orientation.Vertical; - bar.LayoutSubviews (); + bar.LayoutSubViews (); // TODO: Assert specific layout expectations for vertical orientation } } diff --git a/Tests/UnitTests/Views/ColorPicker16Tests.cs b/Tests/UnitTests/Views/ColorPicker16Tests.cs index 38d46947f5..53182a950b 100644 --- a/Tests/UnitTests/Views/ColorPicker16Tests.cs +++ b/Tests/UnitTests/Views/ColorPicker16Tests.cs @@ -14,7 +14,7 @@ public void Constructors () colorPicker.BeginInit (); colorPicker.EndInit (); - colorPicker.LayoutSubviews (); + colorPicker.LayoutSubViews (); Assert.Equal (new (0, 0, 32, 4), colorPicker.Frame); } diff --git a/Tests/UnitTests/Views/ColorPickerTests.cs b/Tests/UnitTests/Views/ColorPickerTests.cs index 076e2a8fa0..0b79a83922 100644 --- a/Tests/UnitTests/Views/ColorPickerTests.cs +++ b/Tests/UnitTests/Views/ColorPickerTests.cs @@ -80,7 +80,7 @@ public void ColorPicker_ChangeValueOnUI_UpdatesAllUIElements () Assert.Equal ("#000000", hex.Text); // Change value using text field - TextField rBarTextField = cp.Subviews.OfType ().First (tf => tf.Text == "0"); + TextField rBarTextField = cp.SubViews.OfType ().First (tf => tf.Text == "0"); rBarTextField.SetFocus (); rBarTextField.Text = "128"; @@ -188,7 +188,7 @@ public void ColorPicker_ClickingDifferentBars_ChangesFocus () ScreenPosition = new (0, 1) }); - //cp.Subviews.OfType () + //cp.SubViews.OfType () // .Single () // .OnMouseEvent ( // new () @@ -209,7 +209,7 @@ public void ColorPicker_ClickingDifferentBars_ChangesFocus () ScreenPosition = new (0, 2) }); - //cp.Subviews.OfType () + //cp.SubViews.OfType () // .Single () // .OnMouseEvent ( // new () @@ -232,7 +232,7 @@ public void ColorPicker_Construct_DefaultValue () ColorPicker cp = GetColorPicker (ColorModel.HSV, false); // Should be only a single text field (Hex) because ShowTextFields is false - Assert.Single (cp.Subviews.OfType ()); + Assert.Single (cp.SubViews.OfType ()); cp.Draw (); @@ -426,7 +426,7 @@ public void ColorPicker_InvalidHexInput_DoesNotChangeColor () cp.Draw (); // Enter invalid hex value - TextField hexField = cp.Subviews.OfType ().First (tf => tf.Text == "#000000"); + TextField hexField = cp.SubViews.OfType ().First (tf => tf.Text == "#000000"); hexField.SetFocus (); hexField.Text = "#ZZZZZZ"; Assert.True (hexField.HasFocus); @@ -698,7 +698,7 @@ public void ColorPicker_SyncBetweenTextFieldAndBars () cp.Draw (); // Change value using the bar - RBar rBar = cp.Subviews.OfType ().First (); + RBar rBar = cp.SubViews.OfType ().First (); rBar.Value = 128; cp.Draw (); @@ -838,7 +838,7 @@ private ColorBar GetColorBar (ColorPicker cp, ColorPickerPart toGet) { if (toGet <= ColorPickerPart.Bar3) { - return cp.Subviews.OfType ().ElementAt ((int)toGet); + return cp.SubViews.OfType ().ElementAt ((int)toGet); } throw new NotSupportedException ("ColorPickerPart must be a bar"); @@ -855,7 +855,7 @@ private ColorPicker GetColorPicker (ColorModel colorModel, bool showTextFields, Application.Top = new() { Width = 20, Height = 5 }; Application.Top.Add (cp); - Application.Top.LayoutSubviews (); + Application.Top.LayoutSubViews (); Application.Top.SetFocus (); return cp; @@ -876,20 +876,20 @@ private TextField GetTextField (ColorPicker cp, ColorPickerPart toGet) throw new NotSupportedException ("Corresponding Style option is not enabled"); } - return cp.Subviews.OfType ().ElementAt ((int)toGet); + return cp.SubViews.OfType ().ElementAt ((int)toGet); case ColorPickerPart.ColorName: if (!hasColorNameTextField) { throw new NotSupportedException ("Corresponding Style option is not enabled"); } - return cp.Subviews.OfType ().ElementAt (hasBarValueTextFields ? (int)toGet : (int)toGet - 3); + return cp.SubViews.OfType ().ElementAt (hasBarValueTextFields ? (int)toGet : (int)toGet - 3); case ColorPickerPart.Hex: int offset = hasBarValueTextFields ? 0 : 3; offset += hasColorNameTextField ? 0 : 1; - return cp.Subviews.OfType ().ElementAt ((int)toGet - offset); + return cp.SubViews.OfType ().ElementAt ((int)toGet - offset); default: throw new ArgumentOutOfRangeException (nameof (toGet), toGet, null); } diff --git a/Tests/UnitTests/Views/ComboBoxTests.cs b/Tests/UnitTests/Views/ComboBoxTests.cs index bec3a75781..051a6dd1ab 100644 --- a/Tests/UnitTests/Views/ComboBoxTests.cs +++ b/Tests/UnitTests/Views/ComboBoxTests.cs @@ -16,7 +16,7 @@ public void Constructor_With_Source_Initialize_With_The_Passed_SelectedItem () }; cb.BeginInit (); cb.EndInit (); - cb.LayoutSubviews (); + cb.LayoutSubViews (); Assert.Equal ("Two", cb.Text); Assert.NotNull (cb.Source); Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame); @@ -30,7 +30,7 @@ public void Constructors_Defaults () var cb = new ComboBox (); cb.BeginInit (); cb.EndInit (); - cb.LayoutSubviews (); + cb.LayoutSubViews (); Assert.Equal (string.Empty, cb.Text); Assert.Null (cb.Source); Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame); @@ -39,7 +39,7 @@ public void Constructors_Defaults () cb = new ComboBox { Text = "Test" }; cb.BeginInit (); cb.EndInit (); - cb.LayoutSubviews (); + cb.LayoutSubViews (); Assert.Equal ("Test", cb.Text); Assert.Null (cb.Source); Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame); @@ -55,7 +55,7 @@ public void Constructors_Defaults () }; cb.BeginInit (); cb.EndInit (); - cb.LayoutSubviews (); + cb.LayoutSubViews (); Assert.Equal (string.Empty, cb.Text); Assert.NotNull (cb.Source); Assert.Equal (new Rectangle (1, 2, 10, 20), cb.Frame); @@ -64,7 +64,7 @@ public void Constructors_Defaults () cb = new ComboBox { Source = new ListWrapper (["One", "Two", "Three"]) }; cb.BeginInit (); cb.EndInit (); - cb.LayoutSubviews (); + cb.LayoutSubViews (); Assert.Equal (string.Empty, cb.Text); Assert.NotNull (cb.Source); Assert.Equal (new Rectangle (0, 0, 0, 2), cb.Frame); @@ -145,13 +145,13 @@ public void HideDropdownListOnClick_False_OpenSelectedItem_With_Mouse_And_Key_Cu Assert.Equal (0, cb.SelectedItem); Assert.Equal ("One", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("", selected); Assert.True (cb.IsShow); Assert.Equal (1, cb.SelectedItem); Assert.Equal ("Two", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.Enter)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.Enter)); Assert.Equal ("Two", selected); Assert.False (cb.IsShow); Assert.Equal (1, cb.SelectedItem); @@ -162,7 +162,7 @@ public void HideDropdownListOnClick_False_OpenSelectedItem_With_Mouse_And_Key_Cu Assert.True (cb.IsShow); Assert.Equal (1, cb.SelectedItem); Assert.Equal ("Two", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("Two", selected); Assert.True (cb.IsShow); Assert.Equal (2, cb.SelectedItem); @@ -203,7 +203,7 @@ public void HideDropdownListOnClick_False_OpenSelectedItem_With_Mouse_And_Key_F4 Assert.Equal (0, cb.SelectedItem); Assert.Equal ("One", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.True (Application.RaiseKeyDownEvent (Key.F4)); Assert.Equal ("Two", selected); Assert.False (cb.IsShow); @@ -241,13 +241,13 @@ public void Assert.Equal (0, cb.SelectedItem); Assert.Equal ("One", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("", selected); Assert.True (cb.IsShow); Assert.Equal (1, cb.SelectedItem); Assert.Equal ("Two", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.Enter)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.Enter)); Assert.Equal ("Two", selected); Assert.False (cb.IsShow); Assert.Equal (1, cb.SelectedItem); @@ -258,7 +258,7 @@ public void Assert.True (cb.IsShow); Assert.Equal (1, cb.SelectedItem); Assert.Equal ("Two", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("Two", selected); Assert.True (cb.IsShow); Assert.Equal (2, cb.SelectedItem); @@ -302,7 +302,7 @@ public void HideDropdownListOnClick_Gets_Sets () cb.Layout (); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (0, 1), Flags = MouseFlags.Button1Clicked } ) @@ -313,7 +313,7 @@ cb.Subviews [1] Assert.Equal ("Two", cb.Text); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (0, 1), Flags = MouseFlags.Button1Clicked } ) @@ -326,7 +326,7 @@ cb.Subviews [1] cb.HideDropdownListOnClick = true; Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (0, 2), Flags = MouseFlags.Button1Clicked } ) @@ -343,7 +343,7 @@ cb.Subviews [1] ); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (0, 2), Flags = MouseFlags.Button1Clicked } ) @@ -364,7 +364,7 @@ cb.Subviews [1] Assert.Equal ("Three", cb.Text); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (0, 0), Flags = MouseFlags.Button1Clicked } ) @@ -400,7 +400,7 @@ public void HideDropdownListOnClick_True_Colapse_On_Click_Outside_Frame () ); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (cb.Viewport.Right - 1, 0), Flags = MouseFlags.Button1Clicked } ) @@ -411,7 +411,7 @@ cb.Subviews [1] Assert.Equal ("", cb.Text); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (-1, 0), Flags = MouseFlags.Button1Clicked } ) @@ -424,7 +424,7 @@ cb.Subviews [1] Assert.True (Application.RaiseKeyDownEvent (Key.F4)); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (cb.Viewport.Right - 1, 0), Flags = MouseFlags.Button1Clicked } ) @@ -435,7 +435,7 @@ cb.Subviews [1] Assert.Equal ("", cb.Text); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (0, -1), Flags = MouseFlags.Button1Clicked } ) @@ -448,7 +448,7 @@ cb.Subviews [1] Assert.True (Application.RaiseKeyDownEvent (Key.F4)); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (cb.Viewport.Right - 1, 0), Flags = MouseFlags.Button1Clicked } ) @@ -459,7 +459,7 @@ cb.Subviews [1] Assert.Equal ("", cb.Text); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (cb.Frame.Width, 0), Flags = MouseFlags.Button1Clicked } ) @@ -472,7 +472,7 @@ cb.Subviews [1] Assert.True (Application.RaiseKeyDownEvent (Key.F4)); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (cb.Viewport.Right - 1, 0), Flags = MouseFlags.Button1Clicked } ) @@ -483,7 +483,7 @@ cb.Subviews [1] Assert.Equal ("", cb.Text); Assert.True ( - cb.Subviews [1] + cb.SubViews [1] .NewMouseEvent ( new MouseEventArgs { Position = new (0, cb.Frame.Height), Flags = MouseFlags.Button1Clicked } ) @@ -543,13 +543,13 @@ public void HideDropdownListOnClick_True_Highlight_Current_Item () Attribute [] attributes = { // 0 - cb.Subviews [0].ColorScheme.Focus, + cb.SubViews [0].ColorScheme.Focus, // 1 - cb.Subviews [1].ColorScheme.HotFocus, + cb.SubViews [1].ColorScheme.HotFocus, // 2 - cb.Subviews [1].GetNormalColor () + cb.SubViews [1].GetNormalColor () }; DriverAssert.AssertDriverAttributesAre ( @@ -563,7 +563,7 @@ cb.Subviews [1].GetNormalColor () attributes ); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("", selected); Assert.True (cb.IsShow); Assert.Equal (-1, cb.SelectedItem); @@ -582,7 +582,7 @@ cb.Subviews [1].GetNormalColor () attributes ); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("", selected); Assert.True (cb.IsShow); Assert.Equal (-1, cb.SelectedItem); @@ -601,7 +601,7 @@ cb.Subviews [1].GetNormalColor () attributes ); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.Enter)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.Enter)); Assert.Equal ("Three", selected); Assert.False (cb.IsShow); Assert.Equal (2, cb.SelectedItem); @@ -626,7 +626,7 @@ cb.Subviews [1].GetNormalColor () attributes ); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorUp)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorUp)); Assert.Equal ("Three", selected); Assert.True (cb.IsShow); Assert.Equal (2, cb.SelectedItem); @@ -645,7 +645,7 @@ cb.Subviews [1].GetNormalColor () attributes ); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorUp)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorUp)); Assert.Equal ("Three", selected); Assert.True (cb.IsShow); Assert.Equal (2, cb.SelectedItem); @@ -699,7 +699,7 @@ public void HideDropdownListOnClick_True_OpenSelectedItem_With_Mouse_And_Key_And Assert.Equal (-1, cb.SelectedItem); Assert.Equal ("", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.True ( cb.NewMouseEvent ( @@ -721,7 +721,7 @@ public void HideDropdownListOnClick_True_OpenSelectedItem_With_Mouse_And_Key_And Assert.Equal (-1, cb.SelectedItem); Assert.Equal ("", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorUp)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorUp)); Assert.True ( cb.NewMouseEvent ( @@ -762,13 +762,13 @@ public void HideDropdownListOnClick_True_OpenSelectedItem_With_Mouse_And_Key_Cur Assert.Equal (-1, cb.SelectedItem); Assert.Equal ("", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("", selected); Assert.True (cb.IsShow); Assert.Equal (-1, cb.SelectedItem); Assert.Equal ("", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.Enter)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.Enter)); Assert.Equal ("Two", selected); Assert.False (cb.IsShow); Assert.Equal (1, cb.SelectedItem); @@ -779,7 +779,7 @@ public void HideDropdownListOnClick_True_OpenSelectedItem_With_Mouse_And_Key_Cur Assert.True (cb.IsShow); Assert.Equal (1, cb.SelectedItem); Assert.Equal ("Two", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.Equal ("Two", selected); Assert.True (cb.IsShow); Assert.Equal (1, cb.SelectedItem); @@ -820,7 +820,7 @@ public void HideDropdownListOnClick_True_OpenSelectedItem_With_Mouse_And_Key_F4 Assert.Equal (-1, cb.SelectedItem); Assert.Equal ("", cb.Text); - Assert.True (cb.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (cb.SubViews [1].NewKeyDownEvent (Key.CursorDown)); Assert.True (Application.RaiseKeyDownEvent (Key.F4)); Assert.Equal ("", selected); Assert.False (cb.IsShow); diff --git a/Tests/UnitTests/Views/ContextMenuTests.cs b/Tests/UnitTests/Views/ContextMenuTests.cs index ec555edacb..a6c6006615 100644 --- a/Tests/UnitTests/Views/ContextMenuTests.cs +++ b/Tests/UnitTests/Views/ContextMenuTests.cs @@ -533,9 +533,9 @@ public void Menus_And_SubMenus_Always_Try_To_Be_On_Screen () ); Assert.True ( - top.Subviews [0] + top.SubViews [0] .NewMouseEvent ( - new MouseEventArgs { Position = new (0, 3), Flags = MouseFlags.ReportMousePosition, View = top.Subviews [0] } + new MouseEventArgs { Position = new (0, 3), Flags = MouseFlags.ReportMousePosition, View = top.SubViews [0] } ) ); Application.RunIteration (ref rs); @@ -581,9 +581,9 @@ top.Subviews [0] ); Assert.True ( - top.Subviews [0] + top.SubViews [0] .NewMouseEvent ( - new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.Subviews [0] } + new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.SubViews [0] } ) ); Application.RunIteration (ref rs); @@ -628,9 +628,9 @@ top.Subviews [0] ); Assert.True ( - top.Subviews [0] + top.SubViews [0] .NewMouseEvent ( - new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.Subviews [0] } + new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.SubViews [0] } ) ); Application.RunIteration (ref rs); @@ -672,9 +672,9 @@ top.Subviews [0] ); Assert.True ( - top.Subviews [0] + top.SubViews [0] .NewMouseEvent ( - new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.Subviews [0] } + new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.SubViews [0] } ) ); Application.RunIteration (ref rs); @@ -716,9 +716,9 @@ top.Subviews [0] ); Assert.True ( - top.Subviews [0] + top.SubViews [0] .NewMouseEvent ( - new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.Subviews [0] } + new MouseEventArgs { Position = new (30, 3), Flags = MouseFlags.ReportMousePosition, View = top.SubViews [0] } ) ); Application.RunIteration (ref rs); @@ -1225,7 +1225,7 @@ public void UseSubMenusSingleFrame_True_By_Mouse () Toplevel top = new (); RunState rs = Application.Begin (top); cm.Show (menuItems); - Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top!.Subviews [0].Frame); + Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top!.SubViews [0].Frame); Application.LayoutAndDraw (); DriverAssert.AssertDriverContentsWithFrameAre ( @@ -1243,8 +1243,8 @@ public void UseSubMenusSingleFrame_True_By_Mouse () var firstIteration = false; Application.RunIteration (ref rs, firstIteration); - Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.Subviews [0].Frame); - Assert.Equal (new Rectangle (5, 11, 15, 6), Application.Top.Subviews [1].Frame); + Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.SubViews [0].Frame); + Assert.Equal (new Rectangle (5, 11, 15, 6), Application.Top.SubViews [1].Frame); DriverAssert.AssertDriverContentsWithFrameAre ( @" @@ -1261,7 +1261,7 @@ public void UseSubMenusSingleFrame_True_By_Mouse () firstIteration = false; Application.RunIteration (ref rs, firstIteration); - Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.Subviews [0].Frame); + Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.SubViews [0].Frame); DriverAssert.AssertDriverContentsWithFrameAre ( @" @@ -1318,7 +1318,7 @@ public void UseSubMenusSingleFrame_False_By_Mouse () RunState rs = Application.Begin (top); cm.Show (menuItems); - Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.Subviews [0].Frame); + Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.SubViews [0].Frame); Application.LayoutAndDraw (); DriverAssert.AssertDriverContentsWithFrameAre ( @@ -1335,7 +1335,7 @@ public void UseSubMenusSingleFrame_False_By_Mouse () var firstIteration = false; Application.RunIteration (ref rs, firstIteration); - Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.Subviews [0].Frame); + Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.SubViews [0].Frame); DriverAssert.AssertDriverContentsWithFrameAre ( @" @@ -1352,7 +1352,7 @@ public void UseSubMenusSingleFrame_False_By_Mouse () firstIteration = false; Application.RunIteration (ref rs, firstIteration); - Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.Subviews [0].Frame); + Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.SubViews [0].Frame); DriverAssert.AssertDriverContentsWithFrameAre ( @" @@ -1370,7 +1370,7 @@ public void UseSubMenusSingleFrame_False_By_Mouse () firstIteration = false; Application.RunIteration (ref rs, firstIteration); - Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.Subviews [0].Frame); + Assert.Equal (new Rectangle (5, 11, 10, 5), Application.Top.SubViews [0].Frame); DriverAssert.AssertDriverContentsWithFrameAre ( @" @@ -1399,14 +1399,14 @@ public void Handling_TextField_With_Opened_ContextMenu_By_Mouse_HasFocus () Assert.True (tf1.HasFocus); Assert.False (tf2.HasFocus); - Assert.Equal (4, win.Subviews.Count); // TF & TV add autocomplete popup's to their superviews. + Assert.Equal (4, win.SubViews.Count); // TF & TV add autocomplete popup's to their superviews. Assert.Empty (Application._cachedViewsUnderMouse); // Right click on tf2 to open context menu Application.RaiseMouseEvent (new () { ScreenPosition = new (1, 3), Flags = MouseFlags.Button3Clicked }); Assert.False (tf1.HasFocus); Assert.False (tf2.HasFocus); - Assert.Equal (5, win.Subviews.Count); + Assert.Equal (5, win.SubViews.Count); Assert.True (tf2.ContextMenu.MenuBar.IsMenuOpen); Assert.True (win.Focused is Menu); Assert.True (Application.MouseGrabView is MenuBar); @@ -1416,7 +1416,7 @@ public void Handling_TextField_With_Opened_ContextMenu_By_Mouse_HasFocus () Application.RaiseMouseEvent (new () { ScreenPosition = new (1, 1), Flags = MouseFlags.Button1Clicked }); Assert.True (tf1.HasFocus); Assert.False (tf2.HasFocus); - Assert.Equal (4, win.Subviews.Count); + Assert.Equal (4, win.SubViews.Count); // The last context menu bar opened is always preserved Assert.NotNull (tf2.ContextMenu.MenuBar); @@ -1428,7 +1428,7 @@ public void Handling_TextField_With_Opened_ContextMenu_By_Mouse_HasFocus () Application.RaiseMouseEvent (new () { ScreenPosition = new (1, 3), Flags = MouseFlags.Button1Clicked }); Assert.False (tf1.HasFocus); Assert.True (tf2.HasFocus); - Assert.Equal (4, win.Subviews.Count); + Assert.Equal (4, win.SubViews.Count); // The last context menu bar opened is always preserved Assert.NotNull (tf2.ContextMenu.MenuBar); @@ -1712,8 +1712,8 @@ public void HotKeys_Removed_On_Close_ContextMenu () Assert.False (cm.MenuBar.HotKeyBindings.TryGet (Key.R.NoShift, out _)); Assert.False (cm.MenuBar.HotKeyBindings.TryGet (Key.D.WithAlt, out _)); Assert.False (cm.MenuBar.HotKeyBindings.TryGet (Key.D.NoShift, out _)); - Assert.Single (Application.Top!.Subviews); - View [] menus = Application.Top!.Subviews.Where (v => v is Menu m && m.Host == cm.MenuBar).ToArray (); + Assert.Single (Application.Top!.SubViews); + View [] menus = Application.Top!.SubViews.Where (v => v is Menu m && m.Host == cm.MenuBar).ToArray (); Assert.True (menus [0].HotKeyBindings.TryGet (Key.N.WithAlt, out _)); Assert.True (menus [0].HotKeyBindings.TryGet (Key.N.NoShift, out _)); Assert.True (menus [0].HotKeyBindings.TryGet (Key.R.WithAlt, out _)); @@ -1801,14 +1801,14 @@ public void HotKeys_With_ContextMenu_And_MenuBar () Assert.True (menuBar.HotKeyBindings.TryGet (Key.F.WithAlt, out _)); Assert.False (menuBar.HotKeyBindings.TryGet (Key.N.WithAlt, out _)); Assert.False (menuBar.HotKeyBindings.TryGet (Key.R.WithAlt, out _)); - View [] menus = Application.Top!.Subviews.Where (v => v is Menu m && m.Host == menuBar).ToArray (); + View [] menus = Application.Top!.SubViews.Where (v => v is Menu m && m.Host == menuBar).ToArray (); Assert.Empty (menus); Assert.Null (cm.MenuBar); Assert.True (Application.RaiseKeyDownEvent (Key.F.WithAlt)); Assert.True (menuBar.IsMenuOpen); - Assert.Equal (2, Application.Top!.Subviews.Count); - menus = Application.Top!.Subviews.Where (v => v is Menu m && m.Host == menuBar).ToArray (); + Assert.Equal (2, Application.Top!.SubViews.Count); + menus = Application.Top!.SubViews.Where (v => v is Menu m && m.Host == menuBar).ToArray (); Assert.True (menus [0].HotKeyBindings.TryGet (Key.N.WithAlt, out _)); Assert.True (Application.RaiseKeyDownEvent (Key.N.WithAlt)); Assert.False (menuBar.IsMenuOpen); @@ -1837,8 +1837,8 @@ public void HotKeys_With_ContextMenu_And_MenuBar () Assert.False (cm.MenuBar!.HotKeyBindings.TryGet (Key.E.NoShift, out _)); Assert.False (cm.MenuBar.HotKeyBindings.TryGet (Key.R.WithAlt, out _)); Assert.False (cm.MenuBar.HotKeyBindings.TryGet (Key.R.NoShift, out _)); - Assert.Equal (3, Application.Top!.Subviews.Count); - menus = Application.Top!.Subviews.Where (v => v is Menu m && m.Host == cm.MenuBar).ToArray (); + Assert.Equal (3, Application.Top!.SubViews.Count); + menus = Application.Top!.SubViews.Where (v => v is Menu m && m.Host == cm.MenuBar).ToArray (); Assert.True (menus [0].HotKeyBindings.TryGet (Key.E.WithAlt, out _)); Assert.True (menus [0].HotKeyBindings.TryGet (Key.E.NoShift, out _)); Assert.True (menus [1].HotKeyBindings.TryGet (Key.R.WithAlt, out _)); @@ -1852,8 +1852,8 @@ public void HotKeys_With_ContextMenu_And_MenuBar () cm.Show (menuItems); Assert.True (cm.MenuBar.IsMenuOpen); - Assert.Equal (3, Application.Top!.Subviews.Count); - menus = Application.Top!.Subviews.Where (v => v is Menu m && m.Host == cm.MenuBar).ToArray (); + Assert.Equal (3, Application.Top!.SubViews.Count); + menus = Application.Top!.SubViews.Where (v => v is Menu m && m.Host == cm.MenuBar).ToArray (); Assert.True (menus [0].HotKeyBindings.TryGet (Key.E.WithAlt, out _)); Assert.True (menus [0].HotKeyBindings.TryGet (Key.E.NoShift, out _)); Assert.False (menus [0].HotKeyBindings.TryGet (Key.R.WithAlt, out _)); @@ -1868,7 +1868,7 @@ public void HotKeys_With_ContextMenu_And_MenuBar () Application.MainLoop!.RunIteration (); Assert.True (renameFile); - Assert.Single (Application.Top!.Subviews); + Assert.Single (Application.Top!.SubViews); Assert.True (menuBar.HotKeyBindings.TryGet (Key.F.WithAlt, out _)); Assert.True (menuBar.HotKeyBindings.TryGet (Key.F.NoShift, out _)); Assert.False (menuBar.HotKeyBindings.TryGet (Key.N.WithAlt, out _)); diff --git a/Tests/UnitTests/Views/DatePickerTests.cs b/Tests/UnitTests/Views/DatePickerTests.cs index 85096ec4dc..789d960ce0 100644 --- a/Tests/UnitTests/Views/DatePickerTests.cs +++ b/Tests/UnitTests/Views/DatePickerTests.cs @@ -72,22 +72,22 @@ public void DatePicker_ShouldNot_SetDateOutOfRange_UsingNextMonthButton () top.Add (datePicker); Application.Begin (top); - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_dateField"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_dateField"), datePicker.Focused); // Set focus to next month button datePicker.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabStop); - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_calendar"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_calendar"), datePicker.Focused); datePicker.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabStop); - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_previousMonthButton"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_previousMonthButton"), datePicker.Focused); datePicker.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabStop); - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_nextMonthButton"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_nextMonthButton"), datePicker.Focused); // Change month to December Assert.False (Application.RaiseKeyDownEvent (Key.Enter)); Assert.Equal (12, datePicker.Date.Month); // Next month button is disabled, so focus advanced to edit field - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_previousMonthButton"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_previousMonthButton"), datePicker.Focused); top.Dispose (); } @@ -104,19 +104,19 @@ public void DatePicker_ShouldNot_SetDateOutOfRange_UsingPreviousMonthButton () top.Add (datePicker); Application.Begin (top); - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_dateField"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_dateField"), datePicker.Focused); datePicker.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabStop); - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_calendar"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_calendar"), datePicker.Focused); datePicker.AdvanceFocus (NavigationDirection.Forward, TabBehavior.TabStop); - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_previousMonthButton"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_previousMonthButton"), datePicker.Focused); // Change month to January Assert.False (datePicker.NewKeyDownEvent (Key.Enter)); Assert.Equal (1, datePicker.Date.Month); // Next prev button is disabled, so focus advanced to edit button - Assert.Equal (datePicker.Subviews.First (v => v.Id == "_calendar"), datePicker.Focused); + Assert.Equal (datePicker.SubViews.First (v => v.Id == "_calendar"), datePicker.Focused); top.Dispose (); } diff --git a/Tests/UnitTests/Views/GraphViewTests.cs b/Tests/UnitTests/Views/GraphViewTests.cs index ef5230f664..70a3204b1a 100644 --- a/Tests/UnitTests/Views/GraphViewTests.cs +++ b/Tests/UnitTests/Views/GraphViewTests.cs @@ -466,7 +466,7 @@ public void Series_GetsPassedCorrectViewport_AllAtOnce () ); gv.Series.Add (series); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); Assert.Equal (new RectangleF (0, 0, 50, 30), fullGraphBounds); Assert.Equal (new Rectangle (0, 0, 50, 30), graphScreenBounds); @@ -479,7 +479,7 @@ public void Series_GetsPassedCorrectViewport_AllAtOnce () // Even with a margin the graph should be drawn from // the origin, we just get less visible width/height - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.SetNeedsDraw (); gv.Draw (); Assert.Equal (new RectangleF (0, 0, 45, 28), fullGraphBounds); @@ -523,7 +523,7 @@ public void Series_GetsPassedCorrectViewport_AllAtOnce_LargeCellSize () gv.Series.Add (series); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); // Since each cell of the console is 2x5 of graph space the graph @@ -538,7 +538,7 @@ public void Series_GetsPassedCorrectViewport_AllAtOnce_LargeCellSize () // Even with a margin the graph should be drawn from // the origin, we just get less visible width/height - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.SetNeedsDraw (); gv.Draw (); Assert.Equal (new RectangleF (0, 0, 90, 140), fullGraphBounds); @@ -668,7 +668,7 @@ public void TestRendering_MultibarSeries () gv.AxisX = fakeXAxis = new FakeHAxis { Increment = 0 }; gv.AxisY = new FakeVAxis { Increment = 0 }; - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); // Since bar series has no bars yet no labels should be displayed @@ -676,7 +676,7 @@ public void TestRendering_MultibarSeries () multibarSeries.AddBars ("hey", (Rune)'M', 0.5001f, 0.5001f); fakeXAxis.LabelPoints.Clear (); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.SetNeedsDraw (); gv.Draw (); @@ -685,7 +685,7 @@ public void TestRendering_MultibarSeries () multibarSeries.AddBars ("there", (Rune)'M', 0.24999f, 0.74999f); multibarSeries.AddBars ("bob", (Rune)'M', 1, 2); fakeXAxis.LabelPoints.Clear (); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.SetNeedsDraw (); View.SetClipToScreen (); gv.Draw (); @@ -945,7 +945,7 @@ private GraphView GetGraph (out FakeHAxis axisX, out FakeVAxis axisY) public void TestHAxisLocation_NoMargin () { GraphView gv = GetGraph (out FakeHAxis axis); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); Assert.DoesNotContain (new Point (-1, 29), axis.DrawAxisLinePoints); @@ -969,7 +969,7 @@ public void TestHAxisLocation_MarginBottom () GraphView gv = GetGraph (out FakeHAxis axis); gv.MarginBottom = 10; - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); Assert.DoesNotContain (new Point (-1, 19), axis.DrawAxisLinePoints); @@ -993,7 +993,7 @@ public void TestHAxisLocation_MarginLeft () GraphView gv = GetGraph (out FakeHAxis axis); gv.MarginLeft = 5; - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); Assert.DoesNotContain (new Point (4, 29), axis.DrawAxisLinePoints); @@ -1022,7 +1022,7 @@ public void TestVAxisLocation_NoMargin () { GraphView gv = GetGraph (out FakeVAxis axis); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); Assert.DoesNotContain (new Point (0, -1), axis.DrawAxisLinePoints); @@ -1046,7 +1046,7 @@ public void TestVAxisLocation_MarginBottom () GraphView gv = GetGraph (out FakeVAxis axis); gv.MarginBottom = 10; - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); Assert.DoesNotContain (new Point (0, -1), axis.DrawAxisLinePoints); @@ -1071,7 +1071,7 @@ public void TestVAxisLocation_MarginLeft () GraphView gv = GetGraph (out FakeVAxis axis); gv.MarginLeft = 5; - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); Assert.DoesNotContain (new Point (5, -1), axis.DrawAxisLinePoints); @@ -1114,7 +1114,7 @@ public void TestTextAnnotation_EmptyText (string whitespace) var points = new ScatterSeries (); points.Points.Add (new PointF (7, 2)); gv.Series.Add (points); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); var expected = @@ -1140,7 +1140,7 @@ public void TestTextAnnotation_GraphUnits () new TextAnnotation { Text = "hey!", GraphPosition = new PointF (2, 2) } ); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); var expected = @@ -1189,7 +1189,7 @@ public void TestTextAnnotation_LongText () } ); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.SetNeedsDraw (); gv.Draw (); @@ -1223,7 +1223,7 @@ public void TestTextAnnotation_Offscreen () } ); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); // Text is off the screen (graph x axis runs to 8 not 9) @@ -1249,7 +1249,7 @@ public void TestTextAnnotation_ScreenUnits () gv.Annotations.Add ( new TextAnnotation { Text = "hey!", ScreenPosition = new Point (3, 1) } ); - gv.LayoutSubviews (); + gv.LayoutSubViews (); View.SetClipToScreen (); gv.Draw (); @@ -1403,7 +1403,7 @@ public void MarginBottom_BiggerThanHeight_ExpectBlankGraph () new ScatterSeries { Points = { new PointF (1, 1), new PointF (5, 0) } } ); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); var expected = @@ -1428,7 +1428,7 @@ public void MarginLeft_BiggerThanWidth_ExpectBlankGraph () new ScatterSeries { Points = { new PointF (1, 1), new PointF (5, 0) } } ); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); var expected = @@ -1458,7 +1458,7 @@ public void PathAnnotation_Box () path.Points.Add (new PointF (1, 1)); gv.Annotations.Add (path); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); var expected = @@ -1491,7 +1491,7 @@ public void PathAnnotation_Diamond () gv.Annotations.Add (path); - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.Draw (); var expected = @@ -1586,7 +1586,7 @@ public void XAxisLabels_With_MarginLeft () gv.MarginLeft = 3; gv.MarginBottom = 1; - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.SetNeedsDraw (); gv.Draw (); @@ -1625,7 +1625,7 @@ public void YAxisLabels_With_MarginBottom () gv.MarginBottom = 3; gv.MarginLeft = 1; - gv.LayoutSubviews (); + gv.LayoutSubViews (); gv.SetNeedsDraw (); gv.Draw (); diff --git a/Tests/UnitTests/Views/HexViewTests.cs b/Tests/UnitTests/Views/HexViewTests.cs index 4911570c43..82191e8292 100644 --- a/Tests/UnitTests/Views/HexViewTests.cs +++ b/Tests/UnitTests/Views/HexViewTests.cs @@ -38,7 +38,7 @@ public void AllowEdits_Edits_ApplyEdits () Application.Top.SetFocus (); // Needed because HexView relies on LayoutComplete to calc sizes - hv.LayoutSubviews (); + hv.LayoutSubViews (); Assert.True (Application.RaiseKeyDownEvent (Key.Tab)); // Move to left side @@ -94,7 +94,7 @@ public void ApplyEdits_With_Argument () Application.Top.SetFocus (); // Needed because HexView relies on LayoutComplete to calc sizes - hv.LayoutSubviews (); + hv.LayoutSubViews (); var readBuffer = new byte [hv.Source!.Length]; hv.Source.Position = 0; @@ -151,7 +151,7 @@ public void Position_Encoding_Default () Application.Top = new Toplevel (); Application.Top.Add (hv); - Application.Top.LayoutSubviews (); + Application.Top.LayoutSubViews (); Assert.Equal (63, hv.Source!.Length); Assert.Equal (20, hv.BytesPerLine); @@ -189,7 +189,7 @@ public void Position_Encoding_Unicode () Application.Top = new Toplevel (); Application.Top.Add (hv); - hv.LayoutSubviews (); + hv.LayoutSubViews (); Assert.Equal (126, hv.Source!.Length); Assert.Equal (20, hv.BytesPerLine); @@ -223,7 +223,7 @@ public void DiscardEdits_Method () var hv = new HexView (LoadStream (null, out _, true)) { Width = 20, Height = 20 }; // Needed because HexView relies on LayoutComplete to calc sizes - hv.LayoutSubviews (); + hv.LayoutSubViews (); Assert.True (hv.NewKeyDownEvent (Key.D4)); Assert.True (hv.NewKeyDownEvent (Key.D1)); @@ -242,7 +242,7 @@ public void Edited_Event () var hv = new HexView (LoadStream (null, out _, true)) { Width = 20, Height = 20 }; // Needed because HexView relies on LayoutComplete to calc sizes - hv.LayoutSubviews (); + hv.LayoutSubViews (); KeyValuePair keyValuePair = default; hv.Edited += (s, e) => keyValuePair = new (e.Address, e.NewValue); @@ -270,7 +270,7 @@ public void KeyBindings_Test_Movement_LeftSide () var hv = new HexView (LoadStream (null, out _)) { Width = 20, Height = 10 }; Application.Top.Add (hv); - hv.LayoutSubviews (); + hv.LayoutSubViews (); Assert.Equal (MEM_STRING_LENGTH, hv.Source!.Length); Assert.Equal (0, hv.Address); @@ -325,7 +325,7 @@ public void PositionChanged_Event () Application.Top = new Toplevel (); Application.Top.Add (hv); - Application.Top.LayoutSubviews (); + Application.Top.LayoutSubViews (); HexViewEventArgs hexViewEventArgs = null!; hv.PositionChanged += (s, e) => hexViewEventArgs = e; diff --git a/Tests/UnitTests/Views/LabelTests.cs b/Tests/UnitTests/Views/LabelTests.cs index 03d8369eaf..e7b177ba30 100644 --- a/Tests/UnitTests/Views/LabelTests.cs +++ b/Tests/UnitTests/Views/LabelTests.cs @@ -35,45 +35,45 @@ public void Title_Mirrors_Text () [Theory] [CombinatorialData] - public void HotKey_Command_SetsFocus_OnNextSubview (bool hasHotKey) + public void HotKey_Command_SetsFocus_OnNextSubView (bool hasHotKey) { var superView = new View { CanFocus = true }; var label = new Label (); label.HotKey = hasHotKey ? Key.A.WithAlt : Key.Empty; - var nextSubview = new View { CanFocus = true }; - superView.Add (label, nextSubview); + var nextSubView = new View { CanFocus = true }; + superView.Add (label, nextSubView); superView.BeginInit (); superView.EndInit (); Assert.False (label.HasFocus); - Assert.False (nextSubview.HasFocus); + Assert.False (nextSubView.HasFocus); label.InvokeCommand (Command.HotKey); Assert.False (label.HasFocus); - Assert.Equal (hasHotKey, nextSubview.HasFocus); + Assert.Equal (hasHotKey, nextSubView.HasFocus); } [Theory] [CombinatorialData] - public void MouseClick_SetsFocus_OnNextSubview (bool hasHotKey) + public void MouseClick_SetsFocus_OnNextSubView (bool hasHotKey) { var superView = new View { CanFocus = true, Height = 1, Width = 15 }; var focusedView = new View { CanFocus = true, Width = 1, Height = 1 }; var label = new Label { X = 2 }; label.HotKey = hasHotKey ? Key.X.WithAlt : Key.Empty; - var nextSubview = new View { CanFocus = true, X = 4, Width = 4, Height = 1 }; - superView.Add (focusedView, label, nextSubview); + var nextSubView = new View { CanFocus = true, X = 4, Width = 4, Height = 1 }; + superView.Add (focusedView, label, nextSubView); superView.BeginInit (); superView.EndInit (); Assert.False (focusedView.HasFocus); Assert.False (label.HasFocus); - Assert.False (nextSubview.HasFocus); + Assert.False (nextSubView.HasFocus); label.NewMouseEvent (new () { Position = new (0, 0), Flags = MouseFlags.Button1Clicked }); Assert.False (label.HasFocus); - Assert.Equal (hasHotKey, nextSubview.HasFocus); + Assert.Equal (hasHotKey, nextSubView.HasFocus); } [Fact] @@ -1061,7 +1061,7 @@ public void Label_Height_Zero_Stays_Zero () win.Add (label); win.BeginInit (); win.EndInit (); - win.LayoutSubviews (); + win.LayoutSubViews (); win.Draw (); Assert.Equal (5, text.Length); @@ -1084,7 +1084,7 @@ public void Label_Height_Zero_Stays_Zero () text = "0123456789"; Assert.Equal (10, text.Length); label.Width = Dim.Fill () - text.Length; - win.LayoutSubviews (); + win.LayoutSubViews (); win.ClearViewport (); win.Draw (); @@ -1321,7 +1321,7 @@ public void Label_ResizeView_With_Dim_Absolute () label.Text = "New text"; super.Add (label); - super.LayoutSubviews (); + super.LayoutSubViews (); Rectangle expectedLabelBounds = new (0, 0, 8, 1); Assert.Equal (expectedLabelBounds, label.Viewport); diff --git a/Tests/UnitTests/Views/MenuBarTests.cs b/Tests/UnitTests/Views/MenuBarTests.cs index 6deae87d4c..8e78d07585 100644 --- a/Tests/UnitTests/Views/MenuBarTests.cs +++ b/Tests/UnitTests/Views/MenuBarTests.cs @@ -410,13 +410,13 @@ public void Disabled_MenuItem_Is_Never_Selected () ); Assert.True ( - top.Subviews [1] + top.SubViews [1] .NewMouseEvent ( - new () { Position = new (0, 2), Flags = MouseFlags.Button1Clicked, View = top.Subviews [1] } + new () { Position = new (0, 2), Flags = MouseFlags.Button1Clicked, View = top.SubViews [1] } ) ); - top.Subviews [1].Layout(); - top.Subviews [1].Draw (); + top.SubViews [1].Layout(); + top.SubViews [1].Draw (); DriverAssert.AssertDriverAttributesAre ( @" @@ -433,12 +433,12 @@ top.Subviews [1] ); Assert.True ( - top.Subviews [1] + top.SubViews [1] .NewMouseEvent ( - new () { Position = new (0, 2), Flags = MouseFlags.ReportMousePosition, View = top.Subviews [1] } + new () { Position = new (0, 2), Flags = MouseFlags.ReportMousePosition, View = top.SubViews [1] } ) ); - top.Subviews [1].Draw (); + top.SubViews [1].Draw (); DriverAssert.AssertDriverAttributesAre ( @" @@ -1218,7 +1218,7 @@ .Children [0] Application.Top.Draw (); DriverAssert.AssertDriverContentsAre (expectedMenu.ExpectedSubMenuOpen (0), output); - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.N)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.N)); Application.MainLoop.RunIteration (); Assert.True (newAction); @@ -1227,7 +1227,7 @@ .Children [0] Application.Top.Draw (); DriverAssert.AssertDriverContentsAre (expectedMenu.ExpectedSubMenuOpen (1), output); - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.C)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.C)); Application.MainLoop.RunIteration (); Assert.True (copyAction); top.Dispose (); @@ -1979,7 +1979,7 @@ public void MenuBar_In_Window_Without_Other_Views_Without_Top_Init_With_Run_T () output ); - Assert.True (top.Subviews [0].NewKeyDownEvent (Key.CursorRight)); + Assert.True (top.SubViews [0].NewKeyDownEvent (Key.CursorRight)); Application.LayoutAndDraw (); DriverAssert.AssertDriverContentsWithFrameAre ( @@ -1996,7 +1996,7 @@ public void MenuBar_In_Window_Without_Other_Views_Without_Top_Init_With_Run_T () ); Assert.True ( - ((MenuBar)top.Subviews [0])._openMenu.NewKeyDownEvent (Key.CursorRight) + ((MenuBar)top.SubViews [0])._openMenu.NewKeyDownEvent (Key.CursorRight) ); top.Draw (); @@ -2014,7 +2014,7 @@ public void MenuBar_In_Window_Without_Other_Views_Without_Top_Init_With_Run_T () ); Assert.True ( - ((MenuBar)top.Subviews [0])._openMenu.NewKeyDownEvent (Key.CursorRight) + ((MenuBar)top.SubViews [0])._openMenu.NewKeyDownEvent (Key.CursorRight) ); View.SetClipToScreen (); top.Draw (); @@ -2089,7 +2089,7 @@ public void MenuBar_Position_And_Size_With_HotKeys_Is_The_Same_As_Without_HotKey DriverAssert.AssertDriverContentsAre (expectedMenu.ExpectedSubMenuOpen (0), output); // Open second - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.CursorRight)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.CursorRight)); Assert.True (menu.IsMenuOpen); View.SetClipToScreen (); top.Draw (); @@ -2137,7 +2137,7 @@ public void MenuBar_Position_And_Size_With_HotKeys_Is_The_Same_As_Without_HotKey DriverAssert.AssertDriverContentsAre (expectedMenu.ExpectedSubMenuOpen (0), output); // Open second - Assert.True (top.Subviews [1].NewKeyDownEvent (Key.CursorRight)); + Assert.True (top.SubViews [1].NewKeyDownEvent (Key.CursorRight)); Assert.True (menu.IsMenuOpen); View.SetClipToScreen (); Application.Top.Draw (); @@ -2844,7 +2844,7 @@ public void RemoveAndThenAddMenuBar_ShouldNotChangeWidth () menuBar2.Visible = true; w.Add (menuBar2); - MenuBar [] menuBars = w.Subviews.OfType ().ToArray (); + MenuBar [] menuBars = w.SubViews.OfType ().ToArray (); Assert.Equal (2, menuBars.Length); Assert.Equal (Dim.Fill (), menuBars [0].Width); @@ -3081,7 +3081,7 @@ public void UseSubMenusSingleFrame_False_By_Keyboard () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.CursorDown)); top.Draw (); expected = @" @@ -3096,7 +3096,7 @@ public void UseSubMenusSingleFrame_False_By_Keyboard () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); - Assert.True (Application.Top.Subviews [2].NewKeyDownEvent (Key.CursorLeft)); + Assert.True (Application.Top.SubViews [2].NewKeyDownEvent (Key.CursorLeft)); top.Draw (); expected = @" @@ -3110,7 +3110,7 @@ public void UseSubMenusSingleFrame_False_By_Keyboard () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.Esc)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.Esc)); top.Draw (); expected = @" @@ -3192,7 +3192,7 @@ public void UseSubMenusSingleFrame_False_By_Mouse () menu.NewMouseEvent ( new () { - Position = new (1, 2), Flags = MouseFlags.ReportMousePosition, View = Application.Top.Subviews [1] + Position = new (1, 2), Flags = MouseFlags.ReportMousePosition, View = Application.Top.SubViews [1] } ); top.Draw (); @@ -3214,7 +3214,7 @@ public void UseSubMenusSingleFrame_False_By_Mouse () menu.NewMouseEvent ( new () { - Position = new (1, 1), Flags = MouseFlags.ReportMousePosition, View = Application.Top.Subviews [1] + Position = new (1, 1), Flags = MouseFlags.ReportMousePosition, View = Application.Top.SubViews [1] } ) ); @@ -3383,8 +3383,8 @@ public void UseSubMenusSingleFrame_True_By_Keyboard () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); Assert.Equal (new (1, 0, 10, 6), pos); - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.CursorDown)); - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.Enter)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.CursorDown)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.Enter)); top.Draw (); expected = @" @@ -3400,7 +3400,7 @@ public void UseSubMenusSingleFrame_True_By_Keyboard () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); Assert.Equal (new (1, 0, 15, 7), pos); - Assert.True (Application.Top.Subviews [2].NewKeyDownEvent (Key.Enter)); + Assert.True (Application.Top.SubViews [2].NewKeyDownEvent (Key.Enter)); top.Draw (); expected = @" @@ -3415,7 +3415,7 @@ public void UseSubMenusSingleFrame_True_By_Keyboard () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); Assert.Equal (new (1, 0, 10, 6), pos); - Assert.True (Application.Top.Subviews [1].NewKeyDownEvent (Key.Esc)); + Assert.True (Application.Top.SubViews [1].NewKeyDownEvent (Key.Esc)); top.Draw (); expected = @" @@ -3495,7 +3495,7 @@ public void UseSubMenusSingleFrame_True_By_Mouse () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); Assert.Equal (new (1, 0, 10, 6), pos); - Assert.False (menu.NewMouseEvent (new () { Position = new (1, 2), Flags = MouseFlags.Button1Clicked, View = Application.Top.Subviews [1] })); + Assert.False (menu.NewMouseEvent (new () { Position = new (1, 2), Flags = MouseFlags.Button1Clicked, View = Application.Top.SubViews [1] })); top.Draw (); expected = @" @@ -3511,7 +3511,7 @@ public void UseSubMenusSingleFrame_True_By_Mouse () pos = DriverAssert.AssertDriverContentsWithFrameAre (expected, output); Assert.Equal (new (1, 0, 15, 7), pos); - menu.NewMouseEvent (new () { Position = new (1, 1), Flags = MouseFlags.Button1Clicked, View = Application.Top.Subviews [2] }); + menu.NewMouseEvent (new () { Position = new (1, 1), Flags = MouseFlags.Button1Clicked, View = Application.Top.SubViews [2] }); top.Draw (); expected = @" @@ -3681,7 +3681,7 @@ public void UseSubMenusSingleFrame_True_Without_Border () Assert.Equal (new (1, 0, 8, 4), pos); menu.NewMouseEvent ( - new () { Position = new (1, 2), Flags = MouseFlags.Button1Clicked, View = Application.Top.Subviews [1] } + new () { Position = new (1, 2), Flags = MouseFlags.Button1Clicked, View = Application.Top.SubViews [1] } ); top.Draw (); @@ -3697,7 +3697,7 @@ public void UseSubMenusSingleFrame_True_Without_Border () Assert.Equal (new (1, 0, 13, 5), pos); menu.NewMouseEvent ( - new () { Position = new (1, 1), Flags = MouseFlags.Button1Clicked, View = Application.Top.Subviews [2] } + new () { Position = new (1, 1), Flags = MouseFlags.Button1Clicked, View = Application.Top.SubViews [2] } ); top.Draw (); diff --git a/Tests/UnitTests/Views/ProgressBarTests.cs b/Tests/UnitTests/Views/ProgressBarTests.cs index 2b56360a19..744ce198f9 100644 --- a/Tests/UnitTests/Views/ProgressBarTests.cs +++ b/Tests/UnitTests/Views/ProgressBarTests.cs @@ -32,7 +32,7 @@ public void Fraction_Redraw () pb.BeginInit (); pb.EndInit (); - pb.LayoutSubviews (); + pb.LayoutSubViews (); for (var i = 0; i <= pb.Frame.Width; i++) { @@ -174,7 +174,7 @@ public void Pulse_Redraw_BidirectionalMarquee_False () pb.BeginInit (); pb.EndInit (); - pb.LayoutSubviews (); + pb.LayoutSubViews (); for (var i = 0; i < 38; i++) { @@ -879,7 +879,7 @@ public void Pulse_Redraw_BidirectionalMarquee_True_Default () pb.BeginInit (); pb.EndInit (); - pb.LayoutSubviews (); + pb.LayoutSubViews (); for (var i = 0; i < 38; i++) { diff --git a/Tests/UnitTests/Views/RadioGroupTests.cs b/Tests/UnitTests/Views/RadioGroupTests.cs index c5a9ea92e8..c2067dccfb 100644 --- a/Tests/UnitTests/Views/RadioGroupTests.cs +++ b/Tests/UnitTests/Views/RadioGroupTests.cs @@ -42,7 +42,7 @@ public void Constructors_Defaults () view.Add (rg); view.BeginInit (); view.EndInit (); - view.LayoutSubviews (); + view.LayoutSubViews (); Assert.True (rg.CanFocus); Assert.Single (rg.RadioLabels); diff --git a/Tests/UnitTests/Views/ShortcutTests.cs b/Tests/UnitTests/Views/ShortcutTests.cs index e9c0edfebe..4396105138 100644 --- a/Tests/UnitTests/Views/ShortcutTests.cs +++ b/Tests/UnitTests/Views/ShortcutTests.cs @@ -367,42 +367,42 @@ public void Action_SetsAndGetsCorrectly () } [Fact] - public void Subview_Visibility_Controlled_By_Removal () + public void SubView_Visibility_Controlled_By_Removal () { var shortcut = new Shortcut (); Assert.True (shortcut.CommandView.Visible); - Assert.Contains (shortcut.CommandView, shortcut.Subviews); + Assert.Contains (shortcut.CommandView, shortcut.SubViews); Assert.True (shortcut.HelpView.Visible); - Assert.DoesNotContain (shortcut.HelpView, shortcut.Subviews); + Assert.DoesNotContain (shortcut.HelpView, shortcut.SubViews); Assert.True (shortcut.KeyView.Visible); - Assert.DoesNotContain (shortcut.KeyView, shortcut.Subviews); + Assert.DoesNotContain (shortcut.KeyView, shortcut.SubViews); shortcut.HelpText = "help"; Assert.True (shortcut.HelpView.Visible); - Assert.Contains (shortcut.HelpView, shortcut.Subviews); + Assert.Contains (shortcut.HelpView, shortcut.SubViews); Assert.True (shortcut.KeyView.Visible); - Assert.DoesNotContain (shortcut.KeyView, shortcut.Subviews); + Assert.DoesNotContain (shortcut.KeyView, shortcut.SubViews); shortcut.Key = Key.A; Assert.True (shortcut.HelpView.Visible); - Assert.Contains (shortcut.HelpView, shortcut.Subviews); + Assert.Contains (shortcut.HelpView, shortcut.SubViews); Assert.True (shortcut.KeyView.Visible); - Assert.Contains (shortcut.KeyView, shortcut.Subviews); + Assert.Contains (shortcut.KeyView, shortcut.SubViews); shortcut.HelpView.Visible = false; shortcut.ShowHide (); Assert.False (shortcut.HelpView.Visible); - Assert.DoesNotContain (shortcut.HelpView, shortcut.Subviews); + Assert.DoesNotContain (shortcut.HelpView, shortcut.SubViews); Assert.True (shortcut.KeyView.Visible); - Assert.Contains (shortcut.KeyView, shortcut.Subviews); + Assert.Contains (shortcut.KeyView, shortcut.SubViews); shortcut.KeyView.Visible = false; shortcut.ShowHide (); Assert.False (shortcut.HelpView.Visible); - Assert.DoesNotContain (shortcut.HelpView, shortcut.Subviews); + Assert.DoesNotContain (shortcut.HelpView, shortcut.SubViews); Assert.False (shortcut.KeyView.Visible); - Assert.DoesNotContain (shortcut.KeyView, shortcut.Subviews); + Assert.DoesNotContain (shortcut.KeyView, shortcut.SubViews); } [Fact] @@ -531,7 +531,7 @@ int expectedShortcutSelected Application.Top.Add (shortcut); Application.Top.SetRelativeLayout (new (100, 100)); - Application.Top.LayoutSubviews (); + Application.Top.LayoutSubViews (); Application.RaiseMouseEvent ( new () @@ -585,7 +585,7 @@ public void MouseClick_Button_CommandView_Raises_Shortcut_Accepted (int mouseX, shortcut.CommandView.Accepting += (s, e) => { buttonAccepted++; }; Application.Top.Add (shortcut); Application.Top.SetRelativeLayout (new (100, 100)); - Application.Top.LayoutSubviews (); + Application.Top.LayoutSubViews (); var accepted = 0; shortcut.Accepting += (s, e) => { accepted++; }; @@ -650,7 +650,7 @@ public void MouseClick_CheckBox_CommandView_Raises_Shortcut_Accepted_Selected_Co Application.Top.Add (shortcut); Application.Top.SetRelativeLayout (new (100, 100)); - Application.Top.LayoutSubviews (); + Application.Top.LayoutSubViews (); var selected = 0; shortcut.Selecting += (s, e) => diff --git a/Tests/UnitTests/Views/SliderTests.cs b/Tests/UnitTests/Views/SliderTests.cs index eaab6ba699..69c56e593e 100644 --- a/Tests/UnitTests/Views/SliderTests.cs +++ b/Tests/UnitTests/Views/SliderTests.cs @@ -521,7 +521,7 @@ private void DimAuto_Both_Respects_SuperView_ContentSize () view.SetContentSize (new (1, 1)); - view.LayoutSubviews (); + view.LayoutSubViews (); slider.SetRelativeLayout (view.Viewport.Size); Assert.Equal (expectedSize, slider.Frame.Size); @@ -554,7 +554,7 @@ private void DimAuto_Width_Respects_SuperView_ContentSize () view.SetContentSize (new (1, 1)); - view.LayoutSubviews (); + view.LayoutSubViews (); slider.SetRelativeLayout (view.Viewport.Size); Assert.Equal (expectedSize, slider.Frame.Size); @@ -587,7 +587,7 @@ private void DimAuto_Height_Respects_SuperView_ContentSize () view.SetContentSize (new (1, 1)); - view.LayoutSubviews (); + view.LayoutSubViews (); slider.SetRelativeLayout (view.Viewport.Size); Assert.Equal (expectedSize, slider.Frame.Size); diff --git a/Tests/UnitTests/Views/StatusBarTests.cs b/Tests/UnitTests/Views/StatusBarTests.cs index 15ad8309bb..b9955b7677 100644 --- a/Tests/UnitTests/Views/StatusBarTests.cs +++ b/Tests/UnitTests/Views/StatusBarTests.cs @@ -16,22 +16,22 @@ public void AddItemAt_RemoveItem_Replacing () sb.AddShortcutAt (2, new (Key.C.WithCtrl, "Close", null)); - Assert.Equal ("Open", sb.Subviews [0].Title); - Assert.Equal ("Save", sb.Subviews [1].Title); - Assert.Equal ("Close", sb.Subviews [2].Title); - Assert.Equal ("Quit", sb.Subviews [^1].Title); + Assert.Equal ("Open", sb.SubViews [0].Title); + Assert.Equal ("Save", sb.SubViews [1].Title); + Assert.Equal ("Close", sb.SubViews [2].Title); + Assert.Equal ("Quit", sb.SubViews [^1].Title); Assert.Equal ("Save", sb.RemoveShortcut (1).Title); - Assert.Equal ("Open", sb.Subviews [0].Title); - Assert.Equal ("Close", sb.Subviews [1].Title); - Assert.Equal ("Quit", sb.Subviews [^1].Title); + Assert.Equal ("Open", sb.SubViews [0].Title); + Assert.Equal ("Close", sb.SubViews [1].Title); + Assert.Equal ("Quit", sb.SubViews [^1].Title); sb.AddShortcutAt (1, new Shortcut (Key.A.WithCtrl, "Save As", null)); - Assert.Equal ("Open", sb.Subviews [0].Title); - Assert.Equal ("Save As", sb.Subviews [1].Title); - Assert.Equal ("Quit", sb.Subviews [^1].Title); + Assert.Equal ("Open", sb.SubViews [0].Title); + Assert.Equal ("Save As", sb.SubViews [1].Title); + Assert.Equal ("Quit", sb.SubViews [^1].Title); } //[Fact] @@ -131,7 +131,7 @@ public void StatusBar_Constructor_Default () { var sb = new StatusBar (); - Assert.Empty (sb.Subviews); + Assert.Empty (sb.SubViews); Assert.True (sb.CanFocus); Assert.Equal (Colors.ColorSchemes ["Menu"], sb.ColorScheme); Assert.Equal (0, sb.X); @@ -174,7 +174,7 @@ public void StatusBar_Constructor_Default () // w.Add (statusBar2); // Assert.Equal (w.StatusBar, statusBar2); - // var menuBars = w.Subviews.OfType ().ToArray (); + // var menuBars = w.SubViews.OfType ().ToArray (); // Assert.Equal (2, menuBars.Length); // Assert.Equal (Dim.Fill (0), menuBars [0].Width); diff --git a/Tests/UnitTests/Views/TabViewTests.cs b/Tests/UnitTests/Views/TabViewTests.cs index 0ec61e4ff1..15f4373afa 100644 --- a/Tests/UnitTests/Views/TabViewTests.cs +++ b/Tests/UnitTests/Views/TabViewTests.cs @@ -102,7 +102,7 @@ public void MouseClick_ChangesTab () tv.Draw (); - View tabRow = tv.Subviews [0]; + View tabRow = tv.SubViews [0]; Assert.Equal ("TabRow", tabRow.GetType ().Name); DriverAssert.AssertDriverContentsAre ( @@ -185,7 +185,7 @@ public void MouseClick_Right_Left_Arrows_ChangesTab () tv.Draw (); - View tabRow = tv.Subviews [0]; + View tabRow = tv.SubViews [0]; Assert.Equal ("TabRow", tabRow.GetType ().Name); DriverAssert.AssertDriverContentsAre ( @@ -273,7 +273,7 @@ public void MouseClick_Right_Left_Arrows_ChangesTab_With_Border () tv.Draw (); - View tabRow = tv.Subviews [0]; + View tabRow = tv.SubViews [0]; Assert.Equal ("TabRow", tabRow.GetType ().Name); DriverAssert.AssertDriverContentsAre ( @@ -416,7 +416,7 @@ public void ProcessKey_Down_Up_Right_Left_Home_End_PageDown_PageUp_F6 () var btnSubView = new View () { Id = "btnSubView", - Title = "_Subview", + Title = "_SubView", CanFocus = true }; tv.SelectedTab.View.Add (btnSubView); @@ -662,7 +662,7 @@ public void ShowTopLine_False_TabsOnBottom_False_TestThinTabView_WithLongNames ( ); tv.SelectedTab = tab2; - Assert.Equal (tab2, tv.Subviews.First (v => v.Id.Contains ("tabRow")).MostFocused); + Assert.Equal (tab2, tv.SubViews.First (v => v.Id.Contains ("tabRow")).MostFocused); tv.Layout (); View.SetClipToScreen (); @@ -808,7 +808,7 @@ public void ShowTopLine_False_TabsOnBottom_True_TestThinTabView_WithLongNames () ); tv.SelectedTab = tab2; - Assert.Equal (tab2, tv.Subviews.First (v => v.Id.Contains ("tabRow")).MostFocused); + Assert.Equal (tab2, tv.SubViews.First (v => v.Id.Contains ("tabRow")).MostFocused); tv.Layout (); View.SetClipToScreen (); diff --git a/Tests/UnitTests/Views/TableViewTests.cs b/Tests/UnitTests/Views/TableViewTests.cs index 63dc829dbe..7d7f17907f 100644 --- a/Tests/UnitTests/Views/TableViewTests.cs +++ b/Tests/UnitTests/Views/TableViewTests.cs @@ -441,7 +441,7 @@ public void LongColumnTest () dt.Rows.Add (1, 2, "aaa"); tableView.Table = new DataTableSource (dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Draw (); // default behaviour of TableView is not to render @@ -764,7 +764,7 @@ public void ScrollRight_SmoothScrolling () tableView.EndInit (); tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"]; - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); // 3 columns are visibile tableView.Viewport = new (0, 0, 7, 5); @@ -1042,7 +1042,7 @@ public void TableView_ColorsTest_ColorGetter (bool focused) { TableView tv = SetUpMiniTable (out DataTable dt); - tv.LayoutSubviews (); + tv.LayoutSubViews (); // width exactly matches the max col widths tv.Viewport = new (0, 0, 5, 4); @@ -1142,7 +1142,7 @@ public void TableView_ColorsTest_ColorGetter (bool focused) public void TableView_ColorsTest_RowColorGetter (bool focused) { TableView tv = SetUpMiniTable (out DataTable dt); - tv.LayoutSubviews (); + tv.LayoutSubViews (); // width exactly matches the max col widths tv.Viewport = new (0, 0, 5, 4); @@ -1236,7 +1236,7 @@ public void TableView_ColorsTest_RowColorGetter (bool focused) public void TableView_ColorTests_FocusedOrNot (bool focused) { TableView tv = SetUpMiniTable (); - tv.LayoutSubviews (); + tv.LayoutSubViews (); // width exactly matches the max col widths tv.Viewport = new (0, 0, 5, 4); @@ -1283,7 +1283,7 @@ public void TableView_ColorTests_InvertSelectedCellFirstCharacter (bool focused) { TableView tv = SetUpMiniTable (); tv.Style.InvertSelectedCellFirstCharacter = true; - tv.LayoutSubviews (); + tv.LayoutSubViews (); // width exactly matches the max col widths tv.Viewport = new (0, 0, 5, 4); @@ -1547,7 +1547,7 @@ public void TableViewMultiSelect_CannotFallOffTop () { TableView tv = SetUpMiniTable (out DataTable dt); dt.Rows.Add (1, 2); // add another row (brings us to 2 rows) - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.MultiSelect = true; tv.SelectedColumn = 1; @@ -1580,7 +1580,7 @@ public void Test_CollectionNavigator () new () { { "Name", t => t }, { "EndsWith", t => t.Last () } } ); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.Draw (); @@ -1661,7 +1661,7 @@ public void Test_ScreenToCell () TableView tableView = GetTwoRowSixColumnTable (); tableView.BeginInit (); tableView.EndInit (); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Draw (); @@ -1739,7 +1739,7 @@ public void Test_ScreenToCell () public void Test_ScreenToCell_DataColumnOverload () { TableView tableView = GetTwoRowSixColumnTable (); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Draw (); @@ -1856,7 +1856,7 @@ public void TestColumnStyle_AllColumnsVisibleFalse_BehavesAsTableNull () tableView.Style.GetOrCreateColumnStyle (i).Visible = false; } - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); // expect nothing to be rendered when all columns are invisible var expected = @@ -1880,7 +1880,7 @@ public void TestColumnStyle_AllColumnsVisibleFalse_BehavesAsTableNull () public void TestColumnStyle_FirstColumnVisibleFalse_CursorStaysAt1 (bool useHome) { TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Style.GetOrCreateColumnStyle (0).Visible = false; tableView.SelectedColumn = 0; @@ -1909,7 +1909,7 @@ public void TestColumnStyle_FirstColumnVisibleFalse_IsNotRendered () tableView.Style.ShowHorizontalHeaderUnderline = true; tableView.Style.GetOrCreateColumnStyle (0).Visible = false; - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Draw (); var expected = @@ -1928,7 +1928,7 @@ public void TestColumnStyle_FirstColumnVisibleFalse_IsNotRendered () public void TestColumnStyle_LastColumnVisibleFalse_CursorStaysAt2 (bool useEnd) { TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); // select D tableView.SelectedColumn = 3; @@ -1960,7 +1960,7 @@ public void TestColumnStyle_PreceedingColumnsInvisible_NoScrollIndicator () tableView.Style.ShowHorizontalHeaderUnderline = true; tableView.ColumnOffset = 1; - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Draw (); // normally we should have scroll indicators because A,E and F are of screen @@ -2010,7 +2010,7 @@ public void TestColumnStyle_RemainingColumnsInvisible_NoScrollIndicator () tableView.Style.ShowHorizontalScrollIndicators = true; tableView.Style.ShowHorizontalHeaderUnderline = true; - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.SetNeedsDraw (); View.SetClipToScreen (); tableView.Draw (); @@ -2045,7 +2045,7 @@ public void TestColumnStyle_RemainingColumnsInvisible_NoScrollIndicator () public void TestColumnStyle_VisibleFalse_CursorStepsOverInvisibleColumns () { TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Style.GetOrCreateColumnStyle (1).Visible = false; tableView.SelectedColumn = 0; @@ -2073,7 +2073,7 @@ bool invisibleCol ) { TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Style.SmoothHorizontalScrolling = smooth; if (invisibleCol) @@ -2109,7 +2109,7 @@ public void TestColumnStyle_VisibleFalse_IsNotRendered () TableView tableView = GetABCDEFTableView (out _); tableView.Style.GetOrCreateColumnStyle (1).Visible = false; - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.Draw (); var expected = @@ -2125,7 +2125,7 @@ public void TestColumnStyle_VisibleFalse_IsNotRendered () public void TestColumnStyle_VisibleFalse_MultiSelected () { TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); // user has rectangular selection tableView.MultiSelectedRegions.Push ( @@ -2159,7 +2159,7 @@ public void TestColumnStyle_VisibleFalse_MultiSelected () public void TestColumnStyle_VisibleFalse_MultiSelectingStepsOverInvisibleColumns () { TableView tableView = GetABCDEFTableView (out _); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); // if middle column is invisible tableView.Style.GetOrCreateColumnStyle (1).Visible = false; @@ -2182,7 +2182,7 @@ public void TestControlClick_MultiSelect_ThreeRowTable_FullRowSelect () { TableView tv = GetTwoRowSixColumnTable (out DataTable dt); dt.Rows.Add (1, 2, 3, 4, 5, 6); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.MultiSelect = true; @@ -2228,7 +2228,7 @@ public void TestEnumerableDataSource_BasicTypes () } ); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.Draw (); @@ -2253,7 +2253,7 @@ public void TestFullRowSelect_AlwaysUseNormalColorForVerticalCellLines () tv.Viewport = new (0, 0, 7, 6); tv.Frame = new (0, 0, 7, 6); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.FullRowSelect = true; tv.Style.ShowHorizontalBottomline = true; @@ -2306,7 +2306,7 @@ public void TestFullRowSelect_SelectionColorDoesNotStop_WhenShowVerticalCellLine { TableView tv = GetTwoRowSixColumnTable (out DataTable dt); dt.Rows.Add (1, 2, 3, 4, 5, 6); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.Viewport = new (0, 0, 7, 6); @@ -2362,7 +2362,7 @@ public void TestFullRowSelect_SelectionColorStopsAtTableEdge_WithCellLines () tv.Viewport = new (0, 0, 7, 6); tv.Frame = new (0, 0, 7, 6); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.FullRowSelect = true; tv.Style.ShowHorizontalBottomline = true; @@ -2433,7 +2433,7 @@ public void TestListTableSource (Orientation orient, bool parallel) tv.Table = new ListTableSource (list, tv, listStyle); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.Draw (); @@ -2500,7 +2500,7 @@ public void TestListTableSource (Orientation orient, bool parallel) public void TestMoveStartEnd_WithFullRowSelect (bool withFullRowSelect) { TableView tableView = GetTwoRowSixColumnTable (); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); tableView.FullRowSelect = withFullRowSelect; tableView.SelectedRow = 1; @@ -2544,7 +2544,7 @@ public void TestMoveStartEnd_WithFullRowSelect (bool withFullRowSelect) public void TestShiftClick_MultiSelect_TwoRowTable_FullRowSelect () { TableView tv = GetTwoRowSixColumnTable (); - tv.LayoutSubviews (); + tv.LayoutSubViews (); tv.MultiSelect = true; @@ -2578,7 +2578,7 @@ public void TestTableViewCheckboxes_ByObject () ConfigurationManager.Reset(); TableView tv = GetPetTable (out EnumerableTableSource source); - tv.LayoutSubviews (); + tv.LayoutSubViews (); IReadOnlyCollection pets = source.Data; CheckBoxTableSourceWrapperByObject wrapper = new ( @@ -2672,7 +2672,7 @@ public void TestTableViewCheckboxes_MultiSelectIsUnion_WhenToggling () { TableView tv = GetTwoRowSixColumnTable (out DataTable dt); dt.Rows.Add (1, 2, 3, 4, 5, 6); - tv.LayoutSubviews (); + tv.LayoutSubViews (); var wrapper = new CheckBoxTableSourceWrapperByIndex (tv, tv.Table); tv.Table = wrapper; @@ -2739,7 +2739,7 @@ public void TestTableViewCheckboxes_SelectAllToggle () { TableView tv = GetTwoRowSixColumnTable (out DataTable dt); dt.Rows.Add (1, 2, 3, 4, 5, 6); - tv.LayoutSubviews (); + tv.LayoutSubViews (); var wrapper = new CheckBoxTableSourceWrapperByIndex (tv, tv.Table); tv.Table = wrapper; @@ -2789,7 +2789,7 @@ public void TestTableViewCheckboxes_SelectAllToggle () public void TestTableViewCheckboxes_SelectAllToggle_ByObject () { TableView tv = GetPetTable (out EnumerableTableSource source); - tv.LayoutSubviews (); + tv.LayoutSubViews (); IReadOnlyCollection pets = source.Data; CheckBoxTableSourceWrapperByObject wrapper = new ( @@ -2851,7 +2851,7 @@ public void TestTableViewCheckboxes_Simple () { TableView tv = GetTwoRowSixColumnTable (out DataTable dt); dt.Rows.Add (1, 2, 3, 4, 5, 6); - tv.LayoutSubviews (); + tv.LayoutSubViews (); var wrapper = new CheckBoxTableSourceWrapperByIndex (tv, tv.Table); tv.Table = wrapper; @@ -2934,7 +2934,7 @@ public void TestTableViewCheckboxes_Simple () public void TestTableViewRadioBoxes_Simple_ByObject () { TableView tv = GetPetTable (out EnumerableTableSource source); - tv.LayoutSubviews (); + tv.LayoutSubViews (); IReadOnlyCollection pets = source.Data; CheckBoxTableSourceWrapperByObject wrapper = new ( @@ -3032,7 +3032,7 @@ public void TestToggleCells_MultiSelectOn () { // 2 row table TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); dt.Rows.Add (1, 2, 3, 4, 5, 6); tableView.MultiSelect = true; @@ -3104,7 +3104,7 @@ public void TestToggleCells_MultiSelectOn_FullRowSelect () { // 2 row table TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); dt.Rows.Add (1, 2, 3, 4, 5, 6); tableView.FullRowSelect = true; tableView.MultiSelect = true; @@ -3142,7 +3142,7 @@ public void TestToggleCells_MultiSelectOn_SquareSelectToggled () { // 3 row table TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); dt.Rows.Add (1, 2, 3, 4, 5, 6); dt.Rows.Add (1, 2, 3, 4, 5, 6); tableView.MultiSelect = true; @@ -3180,7 +3180,7 @@ public void TestToggleCells_MultiSelectOn_Two_SquareSelects_BothToggled () { // 6 row table TableView tableView = GetABCDEFTableView (out DataTable dt); - tableView.LayoutSubviews (); + tableView.LayoutSubViews (); dt.Rows.Add (1, 2, 3, 4, 5, 6); dt.Rows.Add (1, 2, 3, 4, 5, 6); dt.Rows.Add (1, 2, 3, 4, 5, 6); @@ -3471,7 +3471,7 @@ private TableView GetPetTable (out EnumerableTableSource source) } ); - tv.LayoutSubviews (); + tv.LayoutSubViews (); return tv; } diff --git a/Tests/UnitTests/Views/TextFieldTests.cs b/Tests/UnitTests/Views/TextFieldTests.cs index a80e679618..b65b2d5214 100644 --- a/Tests/UnitTests/Views/TextFieldTests.cs +++ b/Tests/UnitTests/Views/TextFieldTests.cs @@ -2068,12 +2068,12 @@ public void Autocomplete_Popup_Added_To_SuperView_On_Init () TextField t = new (); superView.Add (t); - Assert.Single (superView.Subviews); + Assert.Single (superView.SubViews); superView.BeginInit (); superView.EndInit (); - Assert.Equal (2, superView.Subviews.Count); + Assert.Equal (2, superView.SubViews.Count); } [Fact] @@ -2087,7 +2087,7 @@ public void Autocomplete__Added_To_SuperView_On_Add () superView.BeginInit (); superView.EndInit (); - Assert.Empty (superView.Subviews); + Assert.Empty (superView.SubViews); TextField t = new () { @@ -2096,7 +2096,7 @@ public void Autocomplete__Added_To_SuperView_On_Add () superView.Add (t); - Assert.Equal (2, superView.Subviews.Count); + Assert.Equal (2, superView.SubViews.Count); } [Fact] @@ -2160,7 +2160,7 @@ public void Autocomplete_Visible_False_By_Default () superView.BeginInit (); superView.EndInit (); - Assert.Equal (2, superView.Subviews.Count); + Assert.Equal (2, superView.SubViews.Count); Assert.True (t.Visible); Assert.False (t.Autocomplete.Visible); diff --git a/Tests/UnitTests/Views/TextViewTests.cs b/Tests/UnitTests/Views/TextViewTests.cs index aed7bd09eb..a01b838c30 100644 --- a/Tests/UnitTests/Views/TextViewTests.cs +++ b/Tests/UnitTests/Views/TextViewTests.cs @@ -8353,7 +8353,7 @@ This is tv.ReadOnly = true; tv.CursorPosition = new Point (6, 2); Assert.Equal (new Point (5, 2), tv.CursorPosition); - top.LayoutSubviews (); + top.LayoutSubViews (); View.SetClipToScreen (); tv.Draw (); @@ -8748,12 +8748,12 @@ public void Autocomplete_Popup_Added_To_SuperView_On_Init () TextView t = new (); superView.Add (t); - Assert.Single (superView.Subviews); + Assert.Single (superView.SubViews); superView.BeginInit (); superView.EndInit (); - Assert.Equal (2, superView.Subviews.Count); + Assert.Equal (2, superView.SubViews.Count); } @@ -8768,7 +8768,7 @@ public void Autocomplete__Added_To_SuperView_On_Add () superView.BeginInit (); superView.EndInit (); - Assert.Empty (superView.Subviews); + Assert.Empty (superView.SubViews); TextView t = new () { @@ -8777,7 +8777,7 @@ public void Autocomplete__Added_To_SuperView_On_Add () superView.Add (t); - Assert.Equal (2, superView.Subviews.Count); + Assert.Equal (2, superView.SubViews.Count); } @@ -8795,7 +8795,7 @@ public void Autocomplete_Visible_False_By_Default () superView.BeginInit (); superView.EndInit (); - Assert.Equal (2, superView.Subviews.Count); + Assert.Equal (2, superView.SubViews.Count); Assert.True (t.Visible); Assert.False (t.Autocomplete.Visible); diff --git a/Tests/UnitTests/Views/TileViewTests.cs b/Tests/UnitTests/Views/TileViewTests.cs index a8301280ea..087cc7e336 100644 --- a/Tests/UnitTests/Views/TileViewTests.cs +++ b/Tests/UnitTests/Views/TileViewTests.cs @@ -891,11 +891,11 @@ public void TestNestedContainer2LeftAnd1Right_RendersNicely () var left = (TileView)tileView.Tiles.ElementAt (0).ContentView; Assert.Same (left.SuperView, tileView); - Assert.Equal (2, left.Tiles.ElementAt (0).ContentView.Subviews.Count); - Assert.IsType