Browse Source

Moved PosXXX to not be nested classes

Tig 1 year ago
parent
commit
3e287c4bdd

+ 1 - 1
Terminal.Gui/View/Layout/Dim.cs

@@ -417,7 +417,7 @@ public class Dim
                         for (int i = 0; i < us.Subviews.Count; i++)
                         for (int i = 0; i < us.Subviews.Count; i++)
                         {
                         {
                             var v = us.Subviews [i];
                             var v = us.Subviews [i];
-                            bool isNotPosAnchorEnd = dimension == Dim.Dimension.Width ? v.X is not Pos.PosAnchorEnd : v.Y is not Pos.PosAnchorEnd;
+                            bool isNotPosAnchorEnd = dimension == Dim.Dimension.Width ? v.X is not PosAnchorEnd : v.Y is not PosAnchorEnd;
 
 
                             //if (!isNotPosAnchorEnd)
                             //if (!isNotPosAnchorEnd)
                             //{
                             //{

+ 164 - 170
Terminal.Gui/View/Layout/Pos.cs

@@ -346,225 +346,219 @@ public class Pos
     ///     that
     ///     that
     ///     is used.
     ///     is used.
     /// </returns>
     /// </returns>
-    internal virtual int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
-    {
-        return Anchor (superviewDimension);
-    }
+    internal virtual int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension) { return Anchor (superviewDimension); }
 
 
 
 
     /// <summary>
     /// <summary>
     /// Diagnostics API to determine if this Pos object references other views.
     /// Diagnostics API to determine if this Pos object references other views.
     /// </summary>
     /// </summary>
     /// <returns></returns>
     /// <returns></returns>
-    internal virtual bool ReferencesOtherViews ()
-    {
-        return false;
-    }
+    internal virtual bool ReferencesOtherViews () { return false; }
+}
 
 
-    internal class PosAbsolute (int n) : Pos
-    {
-        private readonly int _n = n;
-        public override bool Equals (object other) { return other is PosAbsolute abs && abs._n == _n; }
-        public override int GetHashCode () { return _n.GetHashCode (); }
-        public override string ToString () { return $"Absolute({_n})"; }
-        internal override int Anchor (int width) { return _n; }
-    }
+internal class PosAbsolute (int n) : Pos
+{
+    private readonly int _n = n;
+    public override bool Equals (object other) { return other is PosAbsolute abs && abs._n == _n; }
+    public override int GetHashCode () { return _n.GetHashCode (); }
+    public override string ToString () { return $"Absolute({_n})"; }
+    internal override int Anchor (int width) { return _n; }
+}
 
 
-    internal class PosAnchorEnd : Pos
-    {
-        private readonly int _offset;
-        public PosAnchorEnd () { UseDimForOffset = true; }
-        public PosAnchorEnd (int offset) { _offset = offset; }
-        public override bool Equals (object other) { return other is PosAnchorEnd anchorEnd && anchorEnd._offset == _offset; }
-        public override int GetHashCode () { return _offset.GetHashCode (); }
+internal class PosAnchorEnd : Pos
+{
+    private readonly int _offset;
+    public PosAnchorEnd () { UseDimForOffset = true; }
+    public PosAnchorEnd (int offset) { _offset = offset; }
+    public override bool Equals (object other) { return other is PosAnchorEnd anchorEnd && anchorEnd._offset == _offset; }
+    public override int GetHashCode () { return _offset.GetHashCode (); }
 
 
-        /// <summary>
-        ///     If true, the offset is the width of the view, if false, the offset is the offset value.
-        /// </summary>
-        internal bool UseDimForOffset { get; set; }
+    /// <summary>
+    ///     If true, the offset is the width of the view, if false, the offset is the offset value.
+    /// </summary>
+    internal bool UseDimForOffset { get; set; }
 
 
-        public override string ToString () { return UseDimForOffset ? "AnchorEnd()" : $"AnchorEnd({_offset})"; }
+    public override string ToString () { return UseDimForOffset ? "AnchorEnd()" : $"AnchorEnd({_offset})"; }
 
 
-        internal override int Anchor (int width)
+    internal override int Anchor (int width)
+    {
+        if (UseDimForOffset)
         {
         {
-            if (UseDimForOffset)
-            {
-                return width;
-            }
-
-            return width - _offset;
+            return width;
         }
         }
 
 
-        internal override int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
-        {
-            int newLocation = Anchor (superviewDimension);
-
-            if (UseDimForOffset)
-            {
-                newLocation -= dim.Anchor (superviewDimension);
-            }
-
-            return newLocation;
-        }
+        return width - _offset;
     }
     }
 
 
-    internal class PosCenter : Pos
+    internal override int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
     {
     {
-        public override string ToString () { return "Center"; }
-        internal override int Anchor (int width) { return width / 2; }
+        int newLocation = Anchor (superviewDimension);
 
 
-        internal override int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
+        if (UseDimForOffset)
         {
         {
-            int newDimension = Math.Max (dim.Calculate (0, superviewDimension, us, dimension), 0);
-
-            return Anchor (superviewDimension - newDimension);
+            newLocation -= dim.Anchor (superviewDimension);
         }
         }
+
+        return newLocation;
     }
     }
+}
 
 
-    internal class PosCombine (bool add, Pos left, Pos right) : Pos
+internal class PosCenter : Pos
+{
+    public override string ToString () { return "Center"; }
+    internal override int Anchor (int width) { return width / 2; }
+
+    internal override int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
     {
     {
-        internal bool _add = add;
-        internal Pos _left = left, _right = right;
+        int newDimension = Math.Max (dim.Calculate (0, superviewDimension, us, dimension), 0);
 
 
-        public override string ToString () { return $"Combine({_left}{(_add ? '+' : '-')}{_right})"; }
+        return Anchor (superviewDimension - newDimension);
+    }
+}
 
 
-        internal override int Anchor (int width)
-        {
-            int la = _left.Anchor (width);
-            int ra = _right.Anchor (width);
+internal class PosCombine (bool add, Pos left, Pos right) : Pos
+{
+    internal bool _add = add;
+    internal Pos _left = left, _right = right;
 
 
-            if (_add)
-            {
-                return la + ra;
-            }
+    public override string ToString () { return $"Combine({_left}{(_add ? '+' : '-')}{_right})"; }
 
 
-            return la - ra;
-        }
+    internal override int Anchor (int width)
+    {
+        int la = _left.Anchor (width);
+        int ra = _right.Anchor (width);
 
 
-        internal override int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
+        if (_add)
         {
         {
-            int newDimension = dim.Calculate (0, superviewDimension, us, dimension);
-            int left = _left.Calculate (superviewDimension, dim, us, dimension);
-            int right = _right.Calculate (superviewDimension, dim, us, dimension);
-
-            if (_add)
-            {
-                return left + right;
-            }
-
-            return left - right;
+            return la + ra;
         }
         }
 
 
-        /// <summary>
-        /// Diagnostics API to determine if this Pos object references other views.
-        /// </summary>
-        /// <returns></returns>
-        internal override bool ReferencesOtherViews ()
-        {
-            if (_left.ReferencesOtherViews ())
-            {
-                return true;
-            }
+        return la - ra;
+    }
 
 
-            if (_right.ReferencesOtherViews ())
-            {
-                return true;
-            }
+    internal override int Calculate (int superviewDimension, Dim dim, View us, Dim.Dimension dimension)
+    {
+        int newDimension = dim.Calculate (0, superviewDimension, us, dimension);
+        int left = _left.Calculate (superviewDimension, dim, us, dimension);
+        int right = _right.Calculate (superviewDimension, dim, us, dimension);
 
 
-            return false;
+        if (_add)
+        {
+            return left + right;
         }
         }
-    }
 
 
-    internal class PosFactor (float factor) : Pos
-    {
-        private readonly float _factor = factor;
-        public override bool Equals (object other) { return other is PosFactor f && f._factor == _factor; }
-        public override int GetHashCode () { return _factor.GetHashCode (); }
-        public override string ToString () { return $"Factor({_factor})"; }
-        internal override int Anchor (int width) { return (int)(width * _factor); }
+        return left - right;
     }
     }
 
 
-    // Helper class to provide dynamic value by the execution of a function that returns an integer.
-    internal class PosFunc (Func<int> n) : Pos
+    /// <summary>
+    /// Diagnostics API to determine if this Pos object references other views.
+    /// </summary>
+    /// <returns></returns>
+    internal override bool ReferencesOtherViews ()
     {
     {
-        private readonly Func<int> _function = n;
-        public override bool Equals (object other) { return other is PosFunc f && f._function () == _function (); }
-        public override int GetHashCode () { return _function.GetHashCode (); }
-        public override string ToString () { return $"PosFunc({_function ()})"; }
-        internal override int Anchor (int width) { return _function (); }
+        if (_left.ReferencesOtherViews ())
+        {
+            return true;
+        }
+
+        if (_right.ReferencesOtherViews ())
+        {
+            return true;
+        }
+
+        return false;
     }
     }
+}
+
+internal class PosFactor (float factor) : Pos
+{
+    private readonly float _factor = factor;
+    public override bool Equals (object other) { return other is PosFactor f && f._factor == _factor; }
+    public override int GetHashCode () { return _factor.GetHashCode (); }
+    public override string ToString () { return $"Factor({_factor})"; }
+    internal override int Anchor (int width) { return (int)(width * _factor); }
+}
 
 
+// Helper class to provide dynamic value by the execution of a function that returns an integer.
+internal class PosFunc (Func<int> n) : Pos
+{
+    private readonly Func<int> _function = n;
+    public override bool Equals (object other) { return other is PosFunc f && f._function () == _function (); }
+    public override int GetHashCode () { return _function.GetHashCode (); }
+    public override string ToString () { return $"PosFunc({_function ()})"; }
+    internal override int Anchor (int width) { return _function (); }
+}
+
+/// <summary>
+/// Describes which side of the view to use for the position.
+/// </summary>
+public enum Side
+{
     /// <summary>
     /// <summary>
-    /// Describes which side of the view to use for the position.
+    /// The left (X) side of the view.
     /// </summary>
     /// </summary>
-    public enum Side
-    {
-        /// <summary>
-        /// The left (X) side of the view.
-        /// </summary>
-        Left = 0,
-
-        /// <summary>
-        /// The top (Y) side of the view.
-        /// </summary>
-        Top = 1,
-
-        /// <summary>
-        /// The right (X + Width) side of the view.
-        /// </summary>
-        Right = 2,
-
-        /// <summary>
-        /// The bottom (Y + Height) side of the view.
-        /// </summary>
-        Bottom = 3
-    }
+    Left = 0,
 
 
-    internal class PosView (View view, Side side) : Pos
-    {
-        public readonly View Target = view;
+    /// <summary>
+    /// The top (Y) side of the view.
+    /// </summary>
+    Top = 1,
 
 
-        public override bool Equals (object other) { return other is PosView abs && abs.Target == Target; }
-        public override int GetHashCode () { return Target.GetHashCode (); }
+    /// <summary>
+    /// The right (X + Width) side of the view.
+    /// </summary>
+    Right = 2,
 
 
-        public override string ToString ()
-        {
-            string sideString = side switch
-            {
-                Side.Left => "left",
-                Side.Top => "top",
-                Side.Right => "right",
-                Side.Bottom => "bottom",
-                _ => "unknown"
-            };
-
-            if (Target == null)
-            {
-                throw new NullReferenceException (nameof (Target));
-            }
-
-            return $"View(side={sideString},target={Target})";
-        }
+    /// <summary>
+    /// The bottom (Y + Height) side of the view.
+    /// </summary>
+    Bottom = 3
+}
 
 
-        internal override int Anchor (int width)
+internal class PosView (View view, Side side) : Pos
+{
+    public readonly View Target = view;
+
+    public override bool Equals (object other) { return other is PosView abs && abs.Target == Target; }
+    public override int GetHashCode () { return Target.GetHashCode (); }
+
+    public override string ToString ()
+    {
+        string sideString = side switch
         {
         {
-            return side switch
-            {
-                Side.Left => Target.Frame.X,
-                Side.Top => Target.Frame.Y,
-                Side.Right => Target.Frame.Right,
-                Side.Bottom => Target.Frame.Bottom,
-                _ => 0
-            };
+            Side.Left => "left",
+            Side.Top => "top",
+            Side.Right => "right",
+            Side.Bottom => "bottom",
+            _ => "unknown"
+        };
+
+        if (Target == null)
+        {
+            throw new NullReferenceException (nameof (Target));
         }
         }
 
 
-        /// <summary>
-        /// Diagnostics API to determine if this Pos object references other views.
-        /// </summary>
-        /// <returns></returns>
-        internal override bool ReferencesOtherViews ()
+        return $"View(side={sideString},target={Target})";
+    }
+
+    internal override int Anchor (int width)
+    {
+        return side switch
         {
         {
-            return true;
-        }
+            Side.Left => Target.Frame.X,
+            Side.Top => Target.Frame.Y,
+            Side.Right => Target.Frame.Right,
+            Side.Bottom => Target.Frame.Bottom,
+            _ => 0
+        };
+    }
+
+    /// <summary>
+    /// Diagnostics API to determine if this Pos object references other views.
+    /// </summary>
+    /// <returns></returns>
+    internal override bool ReferencesOtherViews ()
+    {
+        return true;
     }
     }
 }
 }

+ 13 - 13
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -182,7 +182,7 @@ public partial class View
     ///     </para>
     ///     </para>
     ///     <para>
     ///     <para>
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
-    ///         <see cref="Pos.PosAbsolute"/> the <see cref="LayoutStyle"/> will change to <see cref="LayoutStyle.Computed"/>.
+    ///         <see cref="PosAbsolute"/> the <see cref="LayoutStyle"/> will change to <see cref="LayoutStyle.Computed"/>.
     ///     </para>
     ///     </para>
     ///     <para>The default value is <c>Pos.At (0)</c>.</para>
     ///     <para>The default value is <c>Pos.At (0)</c>.</para>
     /// </remarks>
     /// </remarks>
@@ -221,7 +221,7 @@ public partial class View
     ///     </para>
     ///     </para>
     ///     <para>
     ///     <para>
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
     ///         Changing this property will cause <see cref="Frame"/> to be updated. If the new value is not of type
-    ///         <see cref="Pos.PosAbsolute"/> the <see cref="LayoutStyle"/> will change to <see cref="LayoutStyle.Computed"/>.
+    ///         <see cref="PosAbsolute"/> the <see cref="LayoutStyle"/> will change to <see cref="LayoutStyle.Computed"/>.
     ///     </para>
     ///     </para>
     ///     <para>The default value is <c>Pos.At (0)</c>.</para>
     ///     <para>The default value is <c>Pos.At (0)</c>.</para>
     /// </remarks>
     /// </remarks>
@@ -363,7 +363,7 @@ public partial class View
     ///     <para>
     ///     <para>
     ///         Setting this property to <see cref="LayoutStyle.Computed"/> will cause the view to use the
     ///         Setting this property to <see cref="LayoutStyle.Computed"/> will cause the view to use the
     ///         <see cref="LayoutSubviews"/> method to size and position of the view. If either of the <see cref="X"/> and
     ///         <see cref="LayoutSubviews"/> method to size and position of the view. If either of the <see cref="X"/> and
-    ///         <see cref="Y"/> properties are `null` they will be set to <see cref="Pos.PosAbsolute"/> using the current value
+    ///         <see cref="Y"/> properties are `null` they will be set to <see cref="PosAbsolute"/> using the current value
     ///         of <see cref="Frame"/>. If either of the <see cref="Width"/> and <see cref="Height"/> properties are `null`
     ///         of <see cref="Frame"/>. If either of the <see cref="Width"/> and <see cref="Height"/> properties are `null`
     ///         they will be set to <see cref="Dim.DimAbsolute"/> using <see cref="Frame"/>.
     ///         they will be set to <see cref="Dim.DimAbsolute"/> using <see cref="Frame"/>.
     ///     </para>
     ///     </para>
@@ -373,8 +373,8 @@ public partial class View
     {
     {
         get
         get
         {
         {
-            if (_x is Pos.PosAbsolute
-                && _y is Pos.PosAbsolute
+            if (_x is PosAbsolute
+                && _y is PosAbsolute
                 && _width is Dim.DimAbsolute
                 && _width is Dim.DimAbsolute
                 && _height is Dim.DimAbsolute)
                 && _height is Dim.DimAbsolute)
             {
             {
@@ -836,12 +836,12 @@ public partial class View
             // the view LayoutStyle.Absolute.
             // the view LayoutStyle.Absolute.
             SetFrame (newFrame);
             SetFrame (newFrame);
 
 
-            if (_x is Pos.PosAbsolute)
+            if (_x is PosAbsolute)
             {
             {
                 _x = Frame.X;
                 _x = Frame.X;
             }
             }
 
 
-            if (_y is Pos.PosAbsolute)
+            if (_y is PosAbsolute)
             {
             {
                 _y = Frame.Y;
                 _y = Frame.Y;
             }
             }
@@ -912,7 +912,7 @@ public partial class View
     {
     {
         switch (pos)
         switch (pos)
         {
         {
-            case Pos.PosView pv:
+            case PosView pv:
                 // See #2461
                 // See #2461
                 //if (!from.InternalSubviews.Contains (pv.Target)) {
                 //if (!from.InternalSubviews.Contains (pv.Target)) {
                 //	throw new InvalidOperationException ($"View {pv.Target} is not a subview of {from}");
                 //	throw new InvalidOperationException ($"View {pv.Target} is not a subview of {from}");
@@ -923,7 +923,7 @@ public partial class View
                 }
                 }
 
 
                 return;
                 return;
-            case Pos.PosCombine pc:
+            case PosCombine pc:
                 CollectPos (pc._left, from, ref nNodes, ref nEdges);
                 CollectPos (pc._left, from, ref nNodes, ref nEdges);
                 CollectPos (pc._right, from, ref nNodes, ref nEdges);
                 CollectPos (pc._right, from, ref nNodes, ref nEdges);
 
 
@@ -1104,15 +1104,15 @@ public partial class View
 
 
             switch (checkPosDim)
             switch (checkPosDim)
             {
             {
-                case Pos pos and not Pos.PosAbsolute and not Pos.PosView and not Pos.PosCombine:
+                case Pos pos and not PosAbsolute and not PosView and not PosCombine:
                     bad = pos;
                     bad = pos;
 
 
                     break;
                     break;
 
 
-                case Pos pos and Pos.PosCombine:
+                case Pos pos and PosCombine:
                     // Recursively check for not Absolute or not View
                     // Recursively check for not Absolute or not View
-                    ThrowInvalid (view, (pos as Pos.PosCombine)._left, name);
-                    ThrowInvalid (view, (pos as Pos.PosCombine)._right, name);
+                    ThrowInvalid (view, (pos as PosCombine)._left, name);
+                    ThrowInvalid (view, (pos as PosCombine)._right, name);
 
 
                     break;
                     break;
 
 

+ 5 - 5
Terminal.Gui/Views/TileView.cs

@@ -417,7 +417,7 @@ public class TileView : View
     /// </summary>
     /// </summary>
     public bool SetSplitterPos (int idx, Pos value)
     public bool SetSplitterPos (int idx, Pos value)
     {
     {
-        if (!(value is Pos.PosAbsolute) && !(value is Pos.PosFactor))
+        if (!(value is PosAbsolute) && !(value is PosFactor))
         {
         {
             throw new ArgumentException (
             throw new ArgumentException (
                                          $"Only Percent and Absolute values are supported. Passed value was {value.GetType ().Name}"
                                          $"Only Percent and Absolute values are supported. Passed value was {value.GetType ().Name}"
@@ -991,11 +991,11 @@ public class TileView : View
 
 
         /// <summary>
         /// <summary>
         ///     <para>
         ///     <para>
-        ///         Determines the absolute position of <paramref name="p"/> and returns a <see cref="Pos.PosFactor"/> that
+        ///         Determines the absolute position of <paramref name="p"/> and returns a <see cref="PosFactor"/> that
         ///         describes the percentage of that.
         ///         describes the percentage of that.
         ///     </para>
         ///     </para>
         ///     <para>
         ///     <para>
-        ///         Effectively turning any <see cref="Pos"/> into a <see cref="Pos.PosFactor"/> (as if created with
+        ///         Effectively turning any <see cref="Pos"/> into a <see cref="PosFactor"/> (as if created with
         ///         <see cref="Pos.Percent(float)"/>)
         ///         <see cref="Pos.Percent(float)"/>)
         ///     </para>
         ///     </para>
         /// </summary>
         /// </summary>
@@ -1007,7 +1007,7 @@ public class TileView : View
             // calculate position in the 'middle' of the cell at p distance along parentLength
             // calculate position in the 'middle' of the cell at p distance along parentLength
             float position = p.Anchor (parentLength) + 0.5f;
             float position = p.Anchor (parentLength) + 0.5f;
 
 
-            return new Pos.PosFactor (position / parentLength);
+            return new PosFactor (position / parentLength);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -1025,7 +1025,7 @@ public class TileView : View
         /// <param name="newValue"></param>
         /// <param name="newValue"></param>
         private bool FinalisePosition (Pos oldValue, Pos newValue)
         private bool FinalisePosition (Pos oldValue, Pos newValue)
         {
         {
-            if (oldValue is Pos.PosFactor)
+            if (oldValue is PosFactor)
             {
             {
                 if (Orientation == Orientation.Horizontal)
                 if (Orientation == Orientation.Horizontal)
                 {
                 {

+ 2 - 2
Terminal.Gui/Views/Toplevel.cs

@@ -401,13 +401,13 @@ public partial class Toplevel : View
             // BUGBUG: Prevously PositionToplevel required LayotuStyle.Computed
             // BUGBUG: Prevously PositionToplevel required LayotuStyle.Computed
             && (top.Frame.X + top.Frame.Width > maxWidth || ny > top.Frame.Y) /*&& top.LayoutStyle == LayoutStyle.Computed*/)
             && (top.Frame.X + top.Frame.Width > maxWidth || ny > top.Frame.Y) /*&& top.LayoutStyle == LayoutStyle.Computed*/)
         {
         {
-            if ((top.X is null || top.X is Pos.PosAbsolute) && top.Frame.X != nx)
+            if ((top.X is null || top.X is PosAbsolute) && top.Frame.X != nx)
             {
             {
                 top.X = nx;
                 top.X = nx;
                 layoutSubviews = true;
                 layoutSubviews = true;
             }
             }
 
 
-            if ((top.Y is null || top.Y is Pos.PosAbsolute) && top.Frame.Y != ny)
+            if ((top.Y is null || top.Y is PosAbsolute) && top.Frame.Y != ny)
             {
             {
                 top.Y = ny;
                 top.Y = ny;
                 layoutSubviews = true;
                 layoutSubviews = true;

+ 2 - 2
UnitTests/View/Layout/Dim.AutoTests.cs

@@ -497,7 +497,7 @@ public class DimAutoTests (ITestOutputHelper output)
         superView.SetRelativeLayout (new (0, 0)); // no throw
         superView.SetRelativeLayout (new (0, 0)); // no throw
         superView.LayoutSubviews (); // no throw
         superView.LayoutSubviews (); // no throw
 
 
-        subView.X = new Pos.PosCombine (true, Pos.Right (subView2), new Pos.PosCombine (true, 7, 9));
+        subView.X = new PosCombine (true, Pos.Right (subView2), new PosCombine (true, 7, 9));
         superView.SetRelativeLayout (new (0, 0)); // no throw
         superView.SetRelativeLayout (new (0, 0)); // no throw
 
 
         subView.X = Pos.Center () + 3;
         subView.X = Pos.Center () + 3;
@@ -521,7 +521,7 @@ public class DimAutoTests (ITestOutputHelper output)
         subView.X = 0;
         subView.X = 0;
 
 
         // Tests nested Combine
         // Tests nested Combine
-        subView.X = 5 + new Pos.PosCombine (true, Pos.Right (subView2), new Pos.PosCombine (true, Pos.Center (), 9));
+        subView.X = 5 + new PosCombine (true, Pos.Right (subView2), new PosCombine (true, Pos.Center (), 9));
         Assert.Throws<InvalidOperationException> (() => superView.SetRelativeLayout (new (0, 0)));
         Assert.Throws<InvalidOperationException> (() => superView.SetRelativeLayout (new (0, 0)));
         subView.X = 0;
         subView.X = 0;
     }
     }

+ 9 - 9
UnitTests/View/Layout/Pos.Tests.cs

@@ -212,19 +212,19 @@ public class PosTests (ITestOutputHelper output)
     [TestRespondersDisposed]
     [TestRespondersDisposed]
     public void Internal_Tests ()
     public void Internal_Tests ()
     {
     {
-        var posFactor = new Pos.PosFactor (0.10F);
+        var posFactor = new PosFactor (0.10F);
         Assert.Equal (10, posFactor.Anchor (100));
         Assert.Equal (10, posFactor.Anchor (100));
 
 
-        var posAnchorEnd = new Pos.PosAnchorEnd (1);
+        var posAnchorEnd = new PosAnchorEnd (1);
         Assert.Equal (99, posAnchorEnd.Anchor (100));
         Assert.Equal (99, posAnchorEnd.Anchor (100));
 
 
-        var posCenter = new Pos.PosCenter ();
+        var posCenter = new PosCenter ();
         Assert.Equal (50, posCenter.Anchor (100));
         Assert.Equal (50, posCenter.Anchor (100));
 
 
-        var posAbsolute = new Pos.PosAbsolute (10);
+        var posAbsolute = new PosAbsolute (10);
         Assert.Equal (10, posAbsolute.Anchor (0));
         Assert.Equal (10, posAbsolute.Anchor (0));
 
 
-        var posCombine = new Pos.PosCombine (true, posFactor, posAbsolute);
+        var posCombine = new PosCombine (true, posFactor, posAbsolute);
         Assert.Equal (posCombine._left, posFactor);
         Assert.Equal (posCombine._left, posFactor);
         Assert.Equal (posCombine._right, posAbsolute);
         Assert.Equal (posCombine._right, posAbsolute);
         Assert.Equal (20, posCombine.Anchor (100));
         Assert.Equal (20, posCombine.Anchor (100));
@@ -235,13 +235,13 @@ public class PosTests (ITestOutputHelper output)
         Assert.Equal (20, posCombine.Anchor (100));
         Assert.Equal (20, posCombine.Anchor (100));
 
 
         var view = new View { Frame = new (20, 10, 20, 1) };
         var view = new View { Frame = new (20, 10, 20, 1) };
-        var posViewX = new Pos.PosView (view, Pos.Side.Left);
+        var posViewX = new PosView (view, Side.Left);
         Assert.Equal (20, posViewX.Anchor (0));
         Assert.Equal (20, posViewX.Anchor (0));
-        var posViewY = new Pos.PosView (view, Pos.Side.Top);
+        var posViewY = new PosView (view, Side.Top);
         Assert.Equal (10, posViewY.Anchor (0));
         Assert.Equal (10, posViewY.Anchor (0));
-        var posRight = new Pos.PosView (view, Pos.Side.Right);
+        var posRight = new PosView (view, Side.Right);
         Assert.Equal (40, posRight.Anchor (0));
         Assert.Equal (40, posRight.Anchor (0));
-        var posViewBottom = new Pos.PosView (view, Pos.Side.Bottom);
+        var posViewBottom = new PosView (view, Side.Bottom);
         Assert.Equal (11, posViewBottom.Anchor (0));
         Assert.Equal (11, posViewBottom.Anchor (0));
 
 
         view.Dispose ();
         view.Dispose ();

+ 3 - 3
UnitTests/Views/TileViewTests.cs

@@ -1959,7 +1959,7 @@ public class TileViewTests
     {
     {
         TileView tileView = Get11By3TileView (out LineView line);
         TileView tileView = Get11By3TileView (out LineView line);
         tileView.SetSplitterPos (0, Pos.Percent (50));
         tileView.SetSplitterPos (0, Pos.Percent (50));
-        Assert.IsType<Pos.PosFactor> (tileView.SplitterDistances.ElementAt (0));
+        Assert.IsType<PosFactor> (tileView.SplitterDistances.ElementAt (0));
         tileView.NewKeyDownEvent (new Key (tileView.ToggleResizable));
         tileView.NewKeyDownEvent (new Key (tileView.ToggleResizable));
 
 
         tileView.Draw ();
         tileView.Draw ();
@@ -1983,7 +1983,7 @@ public class TileViewTests
         TestHelpers.AssertDriverContentsAre (looksLike, _output);
         TestHelpers.AssertDriverContentsAre (looksLike, _output);
 
 
         // Even when moving the splitter location it should stay a Percentage based one
         // Even when moving the splitter location it should stay a Percentage based one
-        Assert.IsType<Pos.PosFactor> (tileView.SplitterDistances.ElementAt (0));
+        Assert.IsType<PosFactor> (tileView.SplitterDistances.ElementAt (0));
 
 
         // and 2 to the left
         // and 2 to the left
         line.NewKeyDownEvent (Key.CursorLeft);
         line.NewKeyDownEvent (Key.CursorLeft);
@@ -1998,7 +1998,7 @@ public class TileViewTests
         TestHelpers.AssertDriverContentsAre (looksLike, _output);
         TestHelpers.AssertDriverContentsAre (looksLike, _output);
 
 
         // Even when moving the splitter location it should stay a Percentage based one
         // Even when moving the splitter location it should stay a Percentage based one
-        Assert.IsType<Pos.PosFactor> (tileView.SplitterDistances.ElementAt (0));
+        Assert.IsType<PosFactor> (tileView.SplitterDistances.ElementAt (0));
     }
     }
 
 
     [Fact]
     [Fact]