Browse Source

Change to behavior matching System.Drawing.Rectangle

Brandon Thetford 1 year ago
parent
commit
53df3eac2a
2 changed files with 2 additions and 2 deletions
  1. 1 1
      Terminal.Gui/Types/Rectangle.cs
  2. 1 1
      UnitTests/Types/RectangleTests.cs

+ 1 - 1
Terminal.Gui/Types/Rectangle.cs

@@ -287,5 +287,5 @@ public struct Rectangle
 
 
     /// <summary>ToString Method</summary>
     /// <summary>ToString Method</summary>
     /// <remarks>Formats the Rectangle as a string in (x,y,w,h) notation.</remarks>
     /// <remarks>Formats the Rectangle as a string in (x,y,w,h) notation.</remarks>
-    public override string ToString () { return $"({X},{Y},{Width},{Height})"; }
+    public override string ToString () { return $"{{X={X},Y={Y},Width={Width},Height={Height}}}"; }
 }
 }

+ 1 - 1
UnitTests/Types/RectangleTests.cs

@@ -513,7 +513,7 @@ public class RectangleTests
     public void ToString_ReturnsExpectedString ([CombinatorialValues(-1,0,1)]int x, [CombinatorialValues(-1,0,1)]int y, [CombinatorialValues(1,10)]int width, [CombinatorialValues(1,10)]int height)
     public void ToString_ReturnsExpectedString ([CombinatorialValues(-1,0,1)]int x, [CombinatorialValues(-1,0,1)]int y, [CombinatorialValues(1,10)]int width, [CombinatorialValues(1,10)]int height)
     {
     {
         Rectangle r = new (x, y, width, height);
         Rectangle r = new (x, y, width, height);
-        string expectedString = $"({r.X},{r.Y},{r.Width},{r.Height})";
+        string expectedString = $"{{X={r.X},Y={r.Y},Width={r.Width},Height={r.Height}}}";
         Assert.Equal (expectedString, r.ToString ());
         Assert.Equal (expectedString, r.ToString ());
     }
     }
 }
 }