Browse Source

Merge pull request #3268 from dodexahedron/v2_3256_remove_point

Stage 4 of #3256 - Remove Point
Tig 1 year ago
parent
commit
aa9e4cf06d

+ 4 - 1
Terminal.Gui/Terminal.Gui.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
   <!-- =================================================================== -->
   <!-- Version numbers -->
   <!-- Automatically updated by gitversion (run `dotnet-gitversion /updateprojectfiles`)  -->
@@ -91,6 +91,9 @@
     <Using Include="JetBrains.Annotations" />
     <Using Include="System.Diagnostics.Contracts.PureAttribute" Alias="PureAttribute" />
     <Using Include="System.Drawing.Rectangle" Alias="Rectangle" />
+    <Using Include="System.Drawing.RectangleF" Alias="RectangleF" />
+    <Using Include="System.Drawing.Point" Alias="Point" />
+    <Using Include="System.Drawing.PointF" Alias="PointF" />
     <Using Include="System.Text" />
     <Using Include="JetBrains.Annotations" />
   </ItemGroup>

+ 0 - 11
Terminal.Gui/Types/Point.TemporaryOperators.cs

@@ -1,11 +0,0 @@
-namespace Terminal.Gui;
-
-public partial struct Point
-{
-    public static implicit operator System.Drawing.Point (Terminal.Gui.Point tgp) => new (tgp.X, tgp.Y);
-    public static implicit operator Point (System.Drawing.Point sdp) => new (sdp.X, sdp.Y);
-    public static bool operator != (Point left, System.Drawing.Point right) => new System.Drawing.Point (left.X,left.Y) != right;
-    public static bool operator == (Point left, System.Drawing.Point right) => new System.Drawing.Point (left.X,left.Y) == right;
-    public static bool operator != (System.Drawing.Point left, Point right) => left != new System.Drawing.Point(right.X,right.Y);
-    public static bool operator == (System.Drawing.Point left, Point right) => left == new System.Drawing.Point(right.X,right.Y);
-}

+ 0 - 148
Terminal.Gui/Types/Point.cs

@@ -1,148 +0,0 @@
-//
-// System.Drawing.Point.cs
-//
-// Author:
-//   Mike Kestner ([email protected])
-//
-// Copyright (C) 2001 Mike Kestner
-// Copyright (C) 2004 Novell, Inc.  http://www.novell.com 
-//
-
-using System.Globalization;
-using System.Text.Json.Serialization;
-
-namespace Terminal.Gui;
-
-/// <summary>Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.</summary>
-public partial struct Point
-{
-    /// <summary>Gets or sets the x-coordinate of this Point.</summary>
-    [JsonInclude]
-    public int X;
-
-    /// <summary>Gets or sets the y-coordinate of this Point.</summary>
-    [JsonInclude]
-    public int Y;
-
-    // -----------------------
-    // Public Shared Members
-    // -----------------------
-
-    /// <summary>Empty Shared Field</summary>
-    /// <remarks>An uninitialized Point Structure.</remarks>
-    public static readonly Point Empty;
-
-    /// <summary>Addition Operator</summary>
-    /// <remarks>Translates a Point using the Width and Height properties of the given <typeref>Size</typeref>.</remarks>
-    public static Point operator + (Point pt, Size sz) { return new Point (pt.X + sz.Width, pt.Y + sz.Height); }
-
-    /// <summary>Equality Operator</summary>
-    /// <remarks>
-    ///     Compares two Point objects. The return value is based on the equivalence of the X and Y properties of the two
-    ///     points.
-    /// </remarks>
-    public static bool operator == (Point left, Point right) { return left.X == right.X && left.Y == right.Y; }
-
-    /// <summary>Inequality Operator</summary>
-    /// <remarks>
-    ///     Compares two Point objects. The return value is based on the equivalence of the X and Y properties of the two
-    ///     points.
-    /// </remarks>
-    public static bool operator != (Point left, Point right) { return left.X != right.X || left.Y != right.Y; }
-
-    /// <summary>Subtraction Operator</summary>
-    /// <remarks>Translates a Point using the negation of the Width and Height properties of the given Size.</remarks>
-    public static Point operator - (Point pt, Size sz) { return new Point (pt.X - sz.Width, pt.Y - sz.Height); }
-
-    /// <summary>Point to Size Conversion</summary>
-    /// <remarks>Returns a Size based on the Coordinates of a given Point. Requires explicit cast.</remarks>
-    public static explicit operator Size (Point p)
-    {
-        if (p.X < 0 || p.Y < 0)
-        {
-            throw new ArgumentException ("Either Width and Height must be greater or equal to 0.");
-        }
-
-        return new Size (p.X, p.Y);
-    }
-
-    // -----------------------
-    // Public Constructors
-    // -----------------------
-    /// <summary>Point Constructor</summary>
-    /// <remarks>Creates a Point from a Size value.</remarks>
-    public Point (Size sz)
-    {
-        X = sz.Width;
-        Y = sz.Height;
-    }
-
-    /// <summary>Point Constructor</summary>
-    /// <remarks>Creates a Point from a specified x,y coordinate pair.</remarks>
-    public Point (int x, int y)
-    {
-        X = x;
-        Y = y;
-    }
-
-    // -----------------------
-    // Public Instance Members
-    // -----------------------
-
-    /// <summary>IsEmpty Property</summary>
-    /// <remarks>Indicates if both X and Y are zero.</remarks>
-    [JsonIgnore]
-    public bool IsEmpty => X == 0 && Y == 0;
-
-    /// <summary>Equals Method</summary>
-    /// <remarks>Checks equivalence of this Point and another object.</remarks>
-    public override bool Equals (object obj)
-    {
-        if (!(obj is Point))
-        {
-            return false;
-        }
-
-        return this == (Point)obj;
-    }
-
-    /// <summary>GetHashCode Method</summary>
-    /// <remarks>Calculates a hashing value.</remarks>
-    public override int GetHashCode () { return X ^ Y; }
-
-    /// <summary>Offset Method</summary>
-    /// <remarks>Moves the Point a specified distance.</remarks>
-    public void Offset (int dx, int dy)
-    {
-        X += dx;
-        Y += dy;
-    }
-
-    /// <summary>ToString Method</summary>
-    /// <remarks>Formats the Point as a string in coordinate notation.</remarks>
-    public override string ToString ()
-    {
-        return string.Format (
-                              "{{X={0},Y={1}}}",
-                              X.ToString (CultureInfo.InvariantCulture),
-                              Y.ToString (CultureInfo.InvariantCulture)
-                             );
-    }
-
-    /// <summary>Adds the specified Size to the specified Point.</summary>
-    /// <returns>The Point that is the result of the addition operation.</returns>
-    /// <param name="pt">The Point to add.</param>
-    /// <param name="sz">The Size to add.</param>
-    public static Point Add (Point pt, Size sz) { return new Point (pt.X + sz.Width, pt.Y + sz.Height); }
-
-    /// <summary>Translates this Point by the specified Point.</summary>
-    /// <returns>The offset.</returns>
-    /// <param name="p">The Point used offset this Point.</param>
-    public void Offset (Point p) { Offset (p.X, p.Y); }
-
-    /// <summary>Returns the result of subtracting specified Size from the specified Point.</summary>
-    /// <returns>The Point that is the result of the subtraction operation.</returns>
-    /// <param name="pt">The Point to be subtracted from.</param>
-    /// <param name="sz">The Size to subtract from the Point.</param>
-    public static Point Subtract (Point pt, Size sz) { return new Point (pt.X - sz.Width, pt.Y - sz.Height); }
-}

+ 0 - 93
Terminal.Gui/Types/PointF.cs

@@ -1,93 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// Copied from: https://github.com/dotnet/corefx/tree/master/src/System.Drawing.Primitives/src/System/Drawing
-
-using System.ComponentModel;
-
-namespace Terminal.Gui;
-
-/// <summary>Represents an ordered pair of x and y coordinates that define a point in a two-dimensional plane.</summary>
-public struct PointF : IEquatable<PointF>
-{
-    /// <summary>Creates a new instance of the <see cref='Terminal.Gui.PointF'/> class with member data left uninitialized.</summary>
-    public static readonly PointF Empty;
-
-    /// <summary>Initializes a new instance of the <see cref='Terminal.Gui.PointF'/> class with the specified coordinates.</summary>
-    public PointF (float x, float y)
-    {
-        X = x;
-        Y = y;
-    }
-
-    /// <summary>Gets a value indicating whether this <see cref='Terminal.Gui.PointF'/> is empty.</summary>
-    [Browsable (false)]
-    public bool IsEmpty => X == 0f && Y == 0f;
-
-    /// <summary>Gets the x-coordinate of this <see cref='Terminal.Gui.PointF'/>.</summary>
-    public float X { get; set; }
-
-    /// <summary>Gets the y-coordinate of this <see cref='Terminal.Gui.PointF'/>.</summary>
-    public float Y { get; set; }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by a given <see cref='Terminal.Gui.Size'/> .</summary>
-    public static PointF operator + (PointF pt, Size sz) { return Add (pt, sz); }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by the negative of a given <see cref='Terminal.Gui.Size'/> .</summary>
-    public static PointF operator - (PointF pt, Size sz) { return Subtract (pt, sz); }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by a given <see cref='Terminal.Gui.SizeF'/> .</summary>
-    public static PointF operator + (PointF pt, SizeF sz) { return Add (pt, sz); }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by the negative of a given <see cref='Terminal.Gui.SizeF'/> .</summary>
-    public static PointF operator - (PointF pt, SizeF sz) { return Subtract (pt, sz); }
-
-    /// <summary>
-    ///     Compares two <see cref='Terminal.Gui.PointF'/> objects. The result specifies whether the values of the
-    ///     <see cref='Terminal.Gui.PointF.X'/> and <see cref='Terminal.Gui.PointF.Y'/> properties of the two
-    ///     <see cref='Terminal.Gui.PointF'/> objects are equal.
-    /// </summary>
-    public static bool operator == (PointF left, PointF right) { return left.X == right.X && left.Y == right.Y; }
-
-    /// <summary>
-    ///     Compares two <see cref='Terminal.Gui.PointF'/> objects. The result specifies whether the values of the
-    ///     <see cref='Terminal.Gui.PointF.X'/> or <see cref='Terminal.Gui.PointF.Y'/> properties of the two
-    ///     <see cref='Terminal.Gui.PointF'/> objects are unequal.
-    /// </summary>
-    public static bool operator != (PointF left, PointF right) { return !(left == right); }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by a given <see cref='Terminal.Gui.Size'/> .</summary>
-    public static PointF Add (PointF pt, Size sz) { return new PointF (pt.X + sz.Width, pt.Y + sz.Height); }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by the negative of a given <see cref='Terminal.Gui.Size'/> .</summary>
-    public static PointF Subtract (PointF pt, Size sz) { return new PointF (pt.X - sz.Width, pt.Y - sz.Height); }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by a given <see cref='Terminal.Gui.SizeF'/> .</summary>
-    public static PointF Add (PointF pt, SizeF sz) { return new PointF (pt.X + sz.Width, pt.Y + sz.Height); }
-
-    /// <summary>Translates a <see cref='Terminal.Gui.PointF'/> by the negative of a given <see cref='Terminal.Gui.SizeF'/> .</summary>
-    public static PointF Subtract (PointF pt, SizeF sz) { return new PointF (pt.X - sz.Width, pt.Y - sz.Height); }
-
-    /// <summary>
-    ///     Compares two <see cref='Terminal.Gui.PointF'/> objects. The result specifies whether the values of the
-    ///     <see cref='Terminal.Gui.PointF.X'/> and <see cref='Terminal.Gui.PointF.Y'/> properties of the two
-    ///     <see cref='Terminal.Gui.PointF'/> objects are equal.
-    /// </summary>
-    public override bool Equals (object obj) { return obj is PointF && Equals ((PointF)obj); }
-
-    /// <summary>
-    ///     Compares two <see cref='Terminal.Gui.PointF'/> objects. The result specifies whether the values of the
-    ///     <see cref='Terminal.Gui.PointF.X'/> and <see cref='Terminal.Gui.PointF.Y'/> properties of the two
-    ///     <see cref='Terminal.Gui.PointF'/> objects are equal.
-    /// </summary>
-    public bool Equals (PointF other) { return this == other; }
-
-    /// <summary>Generates a hashcode from the X and Y components</summary>
-    /// <returns></returns>
-    public override int GetHashCode () { return X.GetHashCode () ^ Y.GetHashCode (); }
-
-    /// <summary>Returns a string including the X and Y values</summary>
-    /// <returns></returns>
-    public override string ToString () { return "{X=" + X + ", Y=" + Y + "}"; }
-}

+ 0 - 260
Terminal.Gui/Types/RectangleF.cs

@@ -1,260 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// Copied from https://github.com/dotnet/corefx/tree/master/src/System.Drawing.Primitives/src/System/Drawing
-
-using System.ComponentModel;
-
-namespace Terminal.Gui;
-
-/// <summary>Stores the location and size of a rectangular region.</summary>
-public struct RectangleF : IEquatable<RectangleF>
-{
-    /// <summary>Initializes a new instance of the <see cref='Terminal.Gui.RectangleF'/> class.</summary>
-    public static readonly RectangleF Empty;
-
-    /// <summary>
-    ///     Initializes a new instance of the <see cref='Terminal.Gui.RectangleF'/> class with the specified location and
-    ///     size.
-    /// </summary>
-    public RectangleF (float x, float y, float width, float height)
-    {
-        X = x;
-        Y = y;
-        Width = width;
-        Height = height;
-    }
-
-    /// <summary>
-    ///     Initializes a new instance of the <see cref='Terminal.Gui.RectangleF'/> class with the specified location and
-    ///     size.
-    /// </summary>
-    public RectangleF (PointF location, SizeF size)
-    {
-        X = location.X;
-        Y = location.Y;
-        Width = size.Width;
-        Height = size.Height;
-    }
-
-    /// <summary>Creates a new <see cref='Terminal.Gui.RectangleF'/> with the specified location and size.</summary>
-    public static RectangleF FromLTRB (float left, float top, float right, float bottom) { return new RectangleF (left, top, right - left, bottom - top); }
-
-    /// <summary>
-    ///     Gets or sets the coordinates of the upper-left corner of the rectangular region represented by this
-    ///     <see cref='Terminal.Gui.RectangleF'/>.
-    /// </summary>
-    [Browsable (false)]
-    public PointF Location
-    {
-        get => new (X, Y);
-        set
-        {
-            X = value.X;
-            Y = value.Y;
-        }
-    }
-
-    /// <summary>Gets or sets the size of this <see cref='Terminal.Gui.RectangleF'/>.</summary>
-    [Browsable (false)]
-    public SizeF Size
-    {
-        get => new (Width, Height);
-        set
-        {
-            Width = value.Width;
-            Height = value.Height;
-        }
-    }
-
-    /// <summary>
-    ///     Gets or sets the x-coordinate of the upper-left corner of the rectangular region defined by this
-    ///     <see cref='Terminal.Gui.RectangleF'/>.
-    /// </summary>
-    public float X { get; set; }
-
-    /// <summary>
-    ///     Gets or sets the y-coordinate of the upper-left corner of the rectangular region defined by this
-    ///     <see cref='Terminal.Gui.RectangleF'/>.
-    /// </summary>
-    public float Y { get; set; }
-
-    /// <summary>Gets or sets the width of the rectangular region defined by this <see cref='Terminal.Gui.RectangleF'/>.</summary>
-    public float Width { get; set; }
-
-    /// <summary>Gets or sets the height of the rectangular region defined by this <see cref='Terminal.Gui.RectangleF'/>.</summary>
-    public float Height { get; set; }
-
-    /// <summary>
-    ///     Gets the x-coordinate of the upper-left corner of the rectangular region defined by this
-    ///     <see cref='Terminal.Gui.RectangleF'/> .
-    /// </summary>
-    [Browsable (false)]
-    public float Left => X;
-
-    /// <summary>
-    ///     Gets the y-coordinate of the upper-left corner of the rectangular region defined by this
-    ///     <see cref='Terminal.Gui.RectangleF'/>.
-    /// </summary>
-    [Browsable (false)]
-    public float Top => Y;
-
-    /// <summary>
-    ///     Gets the x-coordinate of the lower-right corner of the rectangular region defined by this
-    ///     <see cref='Terminal.Gui.RectangleF'/>.
-    /// </summary>
-    [Browsable (false)]
-    public float Right => X + Width;
-
-    /// <summary>
-    ///     Gets the y-coordinate of the lower-right corner of the rectangular region defined by this
-    ///     <see cref='Terminal.Gui.RectangleF'/>.
-    /// </summary>
-    [Browsable (false)]
-    public float Bottom => Y + Height;
-
-    /// <summary>
-    ///     Tests whether this <see cref='Terminal.Gui.RectangleF'/> has a <see cref='Terminal.Gui.RectangleF.Width'/> or
-    ///     a <see cref='Terminal.Gui.RectangleF.Height'/> of 0.
-    /// </summary>
-    [Browsable (false)]
-    public bool IsEmpty => Width <= 0 || Height <= 0;
-
-    /// <summary>
-    ///     Tests whether <paramref name="obj"/> is a <see cref='Terminal.Gui.RectangleF'/> with the same location and
-    ///     size of this <see cref='Terminal.Gui.RectangleF'/>.
-    /// </summary>
-    public override bool Equals (object obj) { return obj is RectangleF && Equals ((RectangleF)obj); }
-
-    /// <summary>Returns true if two <see cref='Terminal.Gui.RectangleF'/> objects have equal location and size.</summary>
-    /// <param name="other"></param>
-    /// <returns></returns>
-    public bool Equals (RectangleF other) { return this == other; }
-
-    /// <summary>Tests whether two <see cref='Terminal.Gui.RectangleF'/> objects have equal location and size.</summary>
-    public static bool operator == (RectangleF left, RectangleF right)
-    {
-        return left.X == right.X && left.Y == right.Y && left.Width == right.Width && left.Height == right.Height;
-    }
-
-    /// <summary>Tests whether two <see cref='Terminal.Gui.RectangleF'/> objects differ in location or size.</summary>
-    public static bool operator != (RectangleF left, RectangleF right) { return !(left == right); }
-
-    /// <summary>
-    ///     Determines if the specified point is contained within the rectangular region defined by this
-    ///     <see cref='Rectangle'/> .
-    /// </summary>
-    public bool Contains (float x, float y) { return X <= x && x < X + Width && Y <= y && y < Y + Height; }
-
-    /// <summary>
-    ///     Determines if the specified point is contained within the rectangular region defined by this
-    ///     <see cref='Rectangle'/> .
-    /// </summary>
-    public bool Contains (PointF pt) { return Contains (pt.X, pt.Y); }
-
-    /// <summary>
-    ///     Determines if the rectangular region represented by <paramref name="rect"/> is entirely contained within the
-    ///     rectangular region represented by this <see cref='Rectangle'/> .
-    /// </summary>
-    public bool Contains (RectangleF rect)
-    {
-        return X <= rect.X
-               && rect.X + rect.Width <= X + Width
-               && Y <= rect.Y
-               && rect.Y + rect.Height <= Y + Height;
-    }
-
-    /// <summary>Gets the hash code for this <see cref='Terminal.Gui.RectangleF'/>.</summary>
-    public override int GetHashCode () { return (Height.GetHashCode () + Width.GetHashCode ()) ^ (X.GetHashCode () + Y.GetHashCode ()); }
-
-    /// <summary>Inflates this <see cref='Rectangle'/> by the specified amount.</summary>
-    public void Inflate (float x, float y)
-    {
-        X -= x;
-        Y -= y;
-        Width += 2 * x;
-        Height += 2 * y;
-    }
-
-    /// <summary>Inflates this <see cref='Rectangle'/> by the specified amount.</summary>
-    public void Inflate (SizeF size) { Inflate (size.Width, size.Height); }
-
-    /// <summary>Creates a <see cref='Rectangle'/> that is inflated by the specified amount.</summary>
-    public static RectangleF Inflate (RectangleF rect, float x, float y)
-    {
-        RectangleF r = rect;
-        r.Inflate (x, y);
-
-        return r;
-    }
-
-    /// <summary>Creates a Rectangle that represents the intersection between this Rectangle and rect.</summary>
-    public void Intersect (RectangleF rect)
-    {
-        RectangleF result = Intersect (rect, this);
-
-        X = result.X;
-        Y = result.Y;
-        Width = result.Width;
-        Height = result.Height;
-    }
-
-    /// <summary>
-    ///     Creates a rectangle that represents the intersection between a and b. If there is no intersection, an empty
-    ///     rectangle is returned.
-    /// </summary>
-    public static RectangleF Intersect (RectangleF a, RectangleF b)
-    {
-        float x1 = Math.Max (a.X, b.X);
-        float x2 = Math.Min (a.X + a.Width, b.X + b.Width);
-        float y1 = Math.Max (a.Y, b.Y);
-        float y2 = Math.Min (a.Y + a.Height, b.Y + b.Height);
-
-        if (x2 >= x1 && y2 >= y1)
-        {
-            return new RectangleF (x1, y1, x2 - x1, y2 - y1);
-        }
-
-        return Empty;
-    }
-
-    /// <summary>Determines if this rectangle intersects with rect.</summary>
-    public bool IntersectsWith (RectangleF rect)
-    {
-        return rect.X < X + Width
-               && X < rect.X + rect.Width
-               && rect.Y < Y + Height
-               && Y < rect.Y + rect.Height;
-    }
-
-    /// <summary>Creates a rectangle that represents the union between a and b.</summary>
-    public static RectangleF Union (RectangleF a, RectangleF b)
-    {
-        float x1 = Math.Min (a.X, b.X);
-        float x2 = Math.Max (a.X + a.Width, b.X + b.Width);
-        float y1 = Math.Min (a.Y, b.Y);
-        float y2 = Math.Max (a.Y + a.Height, b.Y + b.Height);
-
-        return new RectangleF (x1, y1, x2 - x1, y2 - y1);
-    }
-
-    /// <summary>Adjusts the location of this rectangle by the specified amount.</summary>
-    public void Offset (PointF pos) { Offset (pos.X, pos.Y); }
-
-    /// <summary>Adjusts the location of this rectangle by the specified amount.</summary>
-    public void Offset (float x, float y)
-    {
-        X += x;
-        Y += y;
-    }
-
-    /// <summary>Converts the specified <see cref='Rectangle'/> to a <see cref='Terminal.Gui.RectangleF'/>.</summary>
-    public static implicit operator RectangleF (Rectangle r) { return new RectangleF (r.X, r.Y, r.Width, r.Height); }
-
-    /// <summary>
-    ///     Converts the <see cref='Terminal.Gui.RectangleF.Location'/> and <see cref='Terminal.Gui.RectangleF.Size'/> of
-    ///     this <see cref='Terminal.Gui.RectangleF'/> to a human-readable string.
-    /// </summary>
-    public override string ToString () { return "{X=" + X + ",Y=" + Y + ",Width=" + Width + ",Height=" + Height + "}"; }
-}

+ 3 - 0
UICatalog/UICatalog.csproj

@@ -39,5 +39,8 @@
   </ItemGroup>
   <ItemGroup>
     <Using Include="System.Drawing.Rectangle" Alias="Rectangle" />
+    <Using Include="System.Drawing.RectangleF" Alias="RectangleF" />
+    <Using Include="System.Drawing.Point" Alias="Point" />
+    <Using Include="System.Drawing.PointF" Alias="PointF" />
   </ItemGroup>
 </Project>

+ 0 - 66
UnitTests/Types/PointTests.cs

@@ -1,66 +0,0 @@
-namespace Terminal.Gui.TypeTests;
-
-public class PointTests
-{
-    [Fact]
-    public void Point_Equals ()
-    {
-        var point1 = new Point ();
-        var point2 = new Point ();
-        Assert.Equal (point1, point2);
-
-        point1 = new Point (1, 2);
-        point2 = new Point (1, 2);
-        Assert.Equal (point1, point2);
-
-        point1 = new Point (1, 2);
-        point2 = new Point (0, 2);
-        Assert.NotEqual (point1, point2);
-
-        point1 = new Point (1, 2);
-        point2 = new Point (0, 3);
-        Assert.NotEqual (point1, point2);
-    }
-
-    [Fact]
-    public void Point_New ()
-    {
-        var point = new Point ();
-        Assert.True (point.IsEmpty);
-
-        point = new Point (new Size ());
-        Assert.True (point.IsEmpty);
-
-        point = new Point (1, 2);
-        Assert.False (point.IsEmpty);
-
-        point = new Point (-1, -2);
-        Assert.False (point.IsEmpty);
-    }
-
-    [Fact]
-    public void Point_SetsValue ()
-    {
-        var point = new Point { X = 0, Y = 0 };
-        Assert.True (point.IsEmpty);
-
-        point = new Point { X = 1, Y = 2 };
-        Assert.False (point.IsEmpty);
-
-        point = new Point { X = -1, Y = -2 };
-        Assert.False (point.IsEmpty);
-    }
-
-    [Fact]
-    public void Point_Size ()
-    {
-        var point = new Point (1, 2);
-        var size = (Size)point;
-        Assert.False (size.IsEmpty);
-
-        point = new Point (-1, 2);
-        Action action = () => size = (Size)point;
-        var ex = Assert.Throws<ArgumentException> (action);
-        Assert.Equal ("Either Width and Height must be greater or equal to 0.", ex.Message);
-    }
-}

+ 3 - 0
UnitTests/UnitTests.csproj

@@ -47,6 +47,9 @@
   </ItemGroup>
   <ItemGroup>
     <Using Include="System.Drawing.Rectangle" Alias="Rectangle" />
+    <Using Include="System.Drawing.RectangleF" Alias="RectangleF" />
+    <Using Include="System.Drawing.Point" Alias="Point" />
+    <Using Include="System.Drawing.PointF" Alias="PointF" />
     <Using Include="Terminal.Gui" />
     <Using Include="Xunit" />
   </ItemGroup>