Browse Source

Merged v2_develop

Tig Kindel 1 year ago
parent
commit
f35e783f83

+ 49 - 66
Terminal.Gui/View/Layout/PosDim.cs

@@ -1,11 +1,4 @@
-//
-// PosDim.cs: Pos and Dim objects for view dimensions.
-//
-// Authors:
-//   Miguel de Icaza ([email protected])
-//
-
-using System;
+using System;
 using static Terminal.Gui.Dim;
 
 namespace Terminal.Gui;
@@ -348,76 +341,66 @@ public class Pos {
 			}
 		}
 
-		public override string ToString ()
-		{
-			string tside;
-			switch (side) {
-			case 0:
-				tside = "x";
-				break;
-			case 1:
-				tside = "y";
-				break;
-			case 2:
-				tside = "right";
-				break;
-			case 3:
-				tside = "bottom";
-				break;
-			default:
-				tside = "unknown";
-				break;
+			public override string ToString ()
+			{
+				string tside;
+				switch (side) {
+				case 0: tside = "x"; break;
+				case 1: tside = "y"; break;
+				case 2: tside = "right"; break;
+				case 3: tside = "bottom"; break;
+				default: tside = "unknown"; break;
+				}
+				// Note: We do not checkt `Target` for null here to intentionally throw if so
+				return $"View(side={tside},target={Target.ToString ()})";
 			}
-			// Note: We do not checkt `Target` for null here to intentionally throw if so
-			return $"View({tside},{Target.ToString ()})";
-		}
 
 		public override int GetHashCode () => Target.GetHashCode ();
 
 		public override bool Equals (object other) => other is PosView abs && abs.Target == Target;
 	}
 
-	/// <summary>
-	/// Creates a <see cref="Pos"/> object that tracks the Left (X) position of the specified <see cref="View"/>.
-	/// </summary>
-	/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
-	/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
-	public static Pos Left (View view) => new PosCombine (true, new PosView (view, 0), new PosAbsolute (0));
+		/// <summary>
+		/// Creates a <see cref="Pos"/> object that tracks the Left (X) position of the specified <see cref="View"/>.
+	    /// </summary>
+		/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
+		/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
+		public static Pos Left (View view) => new PosView (view, 0);
 
-	/// <summary>
-	/// Creates a <see cref="Pos"/> object that tracks the Left (X) position of the specified <see cref="View"/>.
-	/// </summary>
-	/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
-	/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
-	public static Pos X (View view) => new PosCombine (true, new PosView (view, 0), new PosAbsolute (0));
+		/// <summary>
+		/// Creates a <see cref="Pos"/> object that tracks the Left (X) position of the specified <see cref="View"/>.
+		/// </summary>
+		/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
+		/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
+		public static Pos X (View view) => new PosView (view, 0);
 
-	/// <summary>
-	/// Creates a <see cref="Pos"/> object that tracks the Top (Y) position of the specified <see cref="View"/>.
-	/// </summary>
-	/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
-	/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
-	public static Pos Top (View view) => new PosCombine (true, new PosView (view, 1), new PosAbsolute (0));
+		/// <summary>
+		/// Creates a <see cref="Pos"/> object that tracks the Top (Y) position of the specified <see cref="View"/>.
+		/// </summary>
+		/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
+		/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
+		public static Pos Top (View view) => new PosView (view, 1);
 
-	/// <summary>
-	/// Creates a <see cref="Pos"/> object that tracks the Top (Y) position of the specified <see cref="View"/>.
-	/// </summary>
-	/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
-	/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
-	public static Pos Y (View view) => new PosCombine (true, new PosView (view, 1), new PosAbsolute (0));
+		/// <summary>
+		/// Creates a <see cref="Pos"/> object that tracks the Top (Y) position of the specified <see cref="View"/>.
+		/// </summary>
+		/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
+		/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
+		public static Pos Y (View view) => new PosView(view, 1);
 
-	/// <summary>
-	/// Creates a <see cref="Pos"/> object that tracks the Right (X+Width) coordinate of the specified <see cref="View"/>.
-	/// </summary>
-	/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
-	/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
-	public static Pos Right (View view) => new PosCombine (true, new PosView (view, 2), new PosAbsolute (0));
+		/// <summary>
+		/// Creates a <see cref="Pos"/> object that tracks the Right (X+Width) coordinate of the specified <see cref="View"/>.
+		/// </summary>
+		/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
+		/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
+		public static Pos Right (View view) => new PosView (view, 2);
 
-	/// <summary>
-	/// Creates a <see cref="Pos"/> object that tracks the Bottom (Y+Height) coordinate of the specified <see cref="View"/> 
-	/// </summary>
-	/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
-	/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
-	public static Pos Bottom (View view) => new PosCombine (true, new PosView (view, 3), new PosAbsolute (0));
+		/// <summary>
+		/// Creates a <see cref="Pos"/> object that tracks the Bottom (Y+Height) coordinate of the specified <see cref="View"/> 
+		/// </summary>
+		/// <returns>The <see cref="Pos"/> that depends on the other view.</returns>
+		/// <param name="view">The <see cref="View"/>  that will be tracked.</param>
+		public static Pos Bottom (View view) => new PosView (view, 3);
 
 	/// <summary>Serves as the default hash function. </summary>
 	/// <returns>A hash code for the current object.</returns>

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

@@ -494,7 +494,7 @@ namespace Terminal.Gui {
 		/// <returns></returns>
 		public override string ToString ()
 		{
-			return $"{GetType ().Name}({Id})({Frame})";
+			return $"{GetType ().Name}({Id}){Frame}";
 		}
 
 		/// <inheritdoc/>

+ 57 - 58
UnitTests/View/Layout/DimTests.cs

@@ -78,22 +78,21 @@ public class DimTests {
 		Assert.Throws<NullReferenceException> (() => dim.ToString ());
 	}
 
-	[Fact] [TestRespondersDisposed]
-	public void SetsValue ()
-	{
-		var testVal = Rect.Empty;
-		var testValView = new View (testVal);
-		var dim = Dim.Width (testValView);
-		Assert.Equal ($"View(Width,View()({testVal}))", dim.ToString ());
-		testValView.Dispose ();
-
-		testVal = new Rect (1, 2, 3, 4);
-		testValView = new View (testVal);
-		dim = Dim.Width (testValView);
-		Assert.Equal ($"View(Width,View()({testVal}))", dim.ToString ());
-		testValView.Dispose ();
-
-	}
+		[Fact, TestRespondersDisposed]
+		public void SetsValue ()
+		{
+			var testVal = Rect.Empty;
+			var testValView = new View (testVal);
+			var dim = Dim.Width (testValView);
+			Assert.Equal ($"View(Width,View(){testVal})", dim.ToString ());
+			testValView.Dispose ();
+			
+			testVal = new Rect (1, 2, 3, 4);
+			testValView = new View (testVal);
+			dim = Dim.Width (testValView);
+			Assert.Equal ($"View(Width,View(){testVal})", dim.ToString ());
+			testValView.Dispose ();
+		}
 
 	[Fact] [TestRespondersDisposed]
 	public void Width_Equals ()
@@ -148,21 +147,21 @@ public class DimTests {
 		Assert.Throws<NullReferenceException> (() => dim.ToString ());
 	}
 
-	[Fact] [TestRespondersDisposed]
-	public void Height_SetsValue ()
-	{
-		var testVal = Rect.Empty;
-		var testValview = new View (testVal);
-		var dim = Dim.Height (testValview);
-		Assert.Equal ($"View(Height,View()({testVal}))", dim.ToString ());
-		testValview.Dispose ();
-
-		testVal = new Rect (1, 2, 3, 4);
-		testValview = new View (testVal);
-		dim = Dim.Height (testValview);
-		Assert.Equal ($"View(Height,View()({testVal}))", dim.ToString ());
-		testValview.Dispose ();
-	}
+		[Fact, TestRespondersDisposed]
+		public void Height_SetsValue ()
+		{
+			var testVal = Rect.Empty;
+			var testValview = new View (testVal);
+			var dim = Dim.Height (testValview);
+			Assert.Equal ($"View(Height,View(){testVal})", dim.ToString ());
+			testValview.Dispose ();
+			
+			testVal = new Rect (1, 2, 3, 4);
+			testValview = new View (testVal);
+			dim = Dim.Height (testValview);
+			Assert.Equal ($"View(Height,View(){testVal})", dim.ToString ());
+			testValview.Dispose ();
+		}
 
 	// TODO: Other Dim.Height tests (e.g. Equal?)
 
@@ -435,15 +434,15 @@ public class DimTests {
 			Assert.Equal (49, f2.Frame.Width); // 50-1=49
 			Assert.Equal (5, f2.Frame.Height);
 
-			Assert.Equal ("Combine(View(Width,FrameView(f1)((0,0,49,5)))-Absolute(2))", v1.Width.ToString ());
-			Assert.Equal ("Combine(Fill(0)-Absolute(2))", v1.Height.ToString ());
-			Assert.Equal (47, v1.Frame.Width); // 49-2=47
-			Assert.Equal (89, v1.Frame.Height); // 98-5-2-2=89
+				Assert.Equal ("Combine(View(Width,FrameView(f1)(0,0,49,5))-Absolute(2))", v1.Width.ToString ());
+				Assert.Equal ("Combine(Fill(0)-Absolute(2))", v1.Height.ToString ());
+				Assert.Equal (47, v1.Frame.Width); // 49-2=47
+				Assert.Equal (89, v1.Frame.Height); // 98-5-2-2=89
 
-			Assert.Equal ("Combine(View(Width,FrameView(f2)((49,0,49,5)))-Absolute(2))", v2.Width.ToString ());
-			Assert.Equal ("Combine(Fill(0)-Absolute(2))", v2.Height.ToString ());
-			Assert.Equal (47, v2.Frame.Width); // 49-2=47
-			Assert.Equal (89, v2.Frame.Height); // 98-5-2-2=89
+				Assert.Equal ("Combine(View(Width,FrameView(f2)(49,0,49,5))-Absolute(2))", v2.Width.ToString ());
+				Assert.Equal ("Combine(Fill(0)-Absolute(2))", v2.Height.ToString ());
+				Assert.Equal (47, v2.Frame.Width); // 49-2=47
+				Assert.Equal (89, v2.Frame.Height); // 98-5-2-2=89
 
 			Assert.Equal ("Factor(0.1,False)", v3.Width.ToString ());
 			Assert.Equal ("Factor(0.1,False)", v3.Height.ToString ());
@@ -455,10 +454,10 @@ public class DimTests {
 			Assert.Equal (50, v4.Frame.Width);
 			Assert.Equal (50, v4.Frame.Height);
 
-			Assert.Equal ("Combine(View(Width,Button(v1)((2,7,47,89)))-View(Width,Button(v3)((0,0,9,9))))", v5.Width.ToString ());
-			Assert.Equal ("Combine(View(Height,Button(v1)((2,7,47,89)))-View(Height,Button(v3)((0,0,9,9))))", v5.Height.ToString ());
-			Assert.Equal (38, v5.Frame.Width); // 47-9=38
-			Assert.Equal (80, v5.Frame.Height); // 89-9=80
+				Assert.Equal ("Combine(View(Width,Button(v1)(2,7,47,89))-View(Width,Button(v3)(0,0,9,9)))", v5.Width.ToString ());
+				Assert.Equal ("Combine(View(Height,Button(v1)(2,7,47,89))-View(Height,Button(v3)(0,0,9,9)))", v5.Height.ToString ());
+				Assert.Equal (38, v5.Frame.Width); // 47-9=38
+				Assert.Equal (80, v5.Frame.Height); // 89-9=80
 
 			Assert.Equal ("Factor(0.2,True)", v6.Width.ToString ());
 			Assert.Equal ("Factor(0.2,True)", v6.Height.ToString ());
@@ -487,17 +486,17 @@ public class DimTests {
 			Assert.Equal (99, f2.Frame.Width); // 100-1=99
 			Assert.Equal (5, f2.Frame.Height);
 
-			v1.Text = "Button1";
-			Assert.Equal ("Combine(View(Width,FrameView(f1)((0,0,99,5)))-Absolute(2))", v1.Width.ToString ());
-			Assert.Equal ("Combine(Fill(0)-Absolute(2))", v1.Height.ToString ());
-			Assert.Equal (97, v1.Frame.Width); // 99-2=97
-			Assert.Equal (189, v1.Frame.Height); // 198-2-7=189
+				v1.Text = "Button1";
+				Assert.Equal ("Combine(View(Width,FrameView(f1)(0,0,99,5))-Absolute(2))", v1.Width.ToString ());
+				Assert.Equal ("Combine(Fill(0)-Absolute(2))", v1.Height.ToString ());
+				Assert.Equal (97, v1.Frame.Width); // 99-2=97
+				Assert.Equal (189, v1.Frame.Height); // 198-2-7=189
 
-			v2.Text = "Button2";
-			Assert.Equal ("Combine(View(Width,FrameView(f2)((99,0,99,5)))-Absolute(2))", v2.Width.ToString ());
-			Assert.Equal ("Combine(Fill(0)-Absolute(2))", v2.Height.ToString ());
-			Assert.Equal (97, v2.Frame.Width); // 99-2=97
-			Assert.Equal (189, v2.Frame.Height); // 198-2-7=189
+				v2.Text = "Button2";
+				Assert.Equal ("Combine(View(Width,FrameView(f2)(99,0,99,5))-Absolute(2))", v2.Width.ToString ());
+				Assert.Equal ("Combine(Fill(0)-Absolute(2))", v2.Height.ToString ());
+				Assert.Equal (97, v2.Frame.Width); // 99-2=97
+				Assert.Equal (189, v2.Frame.Height); // 198-2-7=189
 
 			v3.Text = "Button3";
 			Assert.Equal ("Factor(0.1,False)", v3.Width.ToString ());
@@ -517,11 +516,11 @@ public class DimTests {
 			Assert.Equal (11, v4.Frame.Width); // 11 is the text length and because is Dim.DimAbsolute
 			Assert.Equal (1, v4.Frame.Height); // 1 because is Dim.DimAbsolute
 
-			v5.Text = "Button5";
-			Assert.Equal ("Combine(View(Width,Button(v1)((2,7,97,189)))-View(Width,Button(v3)((0,0,19,19))))", v5.Width.ToString ());
-			Assert.Equal ("Combine(View(Height,Button(v1)((2,7,97,189)))-View(Height,Button(v3)((0,0,19,19))))", v5.Height.ToString ());
-			Assert.Equal (78, v5.Frame.Width); // 97-9=78
-			Assert.Equal (170, v5.Frame.Height); // 189-19=170
+				v5.Text = "Button5";
+				Assert.Equal ("Combine(View(Width,Button(v1)(2,7,97,189))-View(Width,Button(v3)(0,0,19,19)))", v5.Width.ToString ());
+				Assert.Equal ("Combine(View(Height,Button(v1)(2,7,97,189))-View(Height,Button(v3)(0,0,19,19)))", v5.Height.ToString ());
+				Assert.Equal (78, v5.Frame.Width); // 97-9=78
+				Assert.Equal (170, v5.Frame.Height); // 189-19=170
 
 			v6.Text = "Button6";
 			Assert.Equal ("Factor(0.2,True)", v6.Width.ToString ());

+ 83 - 44
UnitTests/View/Layout/PosTests.cs

@@ -1,16 +1,11 @@
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.IO;
-using System.Linq;
 using Xunit;
 using Xunit.Abstractions;
 
 // Alias Console to MockConsole so we don't accidentally use Console
-using Console = Terminal.Gui.FakeConsole;
 
-namespace Terminal.Gui.ViewTests; 
+namespace Terminal.Gui.ViewTests;
 
 public class PosTests {
 	readonly ITestOutputHelper _output;
@@ -375,7 +370,8 @@ public class PosTests {
 	/// <summary>
 	/// Tests Pos.Left, Pos.X, Pos.Top, Pos.Y, Pos.Right, and Pos.Bottom set operations
 	/// </summary>
-	[Fact] [TestRespondersDisposed]
+	[Fact]
+	[TestRespondersDisposed]
 	public void PosSide_SetsValue ()
 	{
 		string side; // used in format string
@@ -388,140 +384,140 @@ public class PosTests {
 		testInt = 0;
 		testRect = Rect.Empty;
 		pos = Pos.Left (new View ());
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		pos = Pos.Left (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		testRect = new Rect (1, 2, 3, 4);
 		pos = Pos.Left (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		// Pos.Left(win) + 0
 		pos = Pos.Left (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = 1;
 		// Pos.Left(win) +1
 		pos = Pos.Left (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = -1;
 		// Pos.Left(win) -1
 		pos = Pos.Left (new View (testRect)) - testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		// Pos.X
 		side = "x";
 		testInt = 0;
 		testRect = Rect.Empty;
 		pos = Pos.X (new View ());
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		pos = Pos.X (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		testRect = new Rect (1, 2, 3, 4);
 		pos = Pos.X (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		// Pos.X(win) + 0
 		pos = Pos.X (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = 1;
 		// Pos.X(win) +1
 		pos = Pos.X (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = -1;
 		// Pos.X(win) -1
 		pos = Pos.X (new View (testRect)) - testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		// Pos.Top
 		side = "y";
 		testInt = 0;
 		testRect = Rect.Empty;
 		pos = Pos.Top (new View ());
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		pos = Pos.Top (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		testRect = new Rect (1, 2, 3, 4);
 		pos = Pos.Top (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		// Pos.Top(win) + 0
 		pos = Pos.Top (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = 1;
 		// Pos.Top(win) +1
 		pos = Pos.Top (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = -1;
 		// Pos.Top(win) -1
 		pos = Pos.Top (new View (testRect)) - testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		// Pos.Y
 		side = "y";
 		testInt = 0;
 		testRect = Rect.Empty;
 		pos = Pos.Y (new View ());
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		pos = Pos.Y (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		testRect = new Rect (1, 2, 3, 4);
 		pos = Pos.Y (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		// Pos.Y(win) + 0
 		pos = Pos.Y (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = 1;
 		// Pos.Y(win) +1
 		pos = Pos.Y (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = -1;
 		// Pos.Y(win) -1
 		pos = Pos.Y (new View (testRect)) - testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		// Pos.Bottom
 		side = "bottom";
 		testRect = Rect.Empty;
 		testInt = 0;
 		pos = Pos.Bottom (new View ());
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		pos = Pos.Bottom (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		testRect = new Rect (1, 2, 3, 4);
 		pos = Pos.Bottom (new View (testRect));
-		Assert.Equal ($"Combine(View({side},View()({testRect})){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
 
 		// Pos.Bottom(win) + 0
 		pos = Pos.Bottom (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = 1;
 		// Pos.Bottom(win) +1
 		pos = Pos.Bottom (new View (testRect)) + testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 		testInt = -1;
 		// Pos.Bottom(win) -1
 		pos = Pos.Bottom (new View (testRect)) - testInt;
-		Assert.Equal ($"Combine(Combine(View({side},View()({testRect}))+Absolute(0)){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
+		Assert.Equal ($"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))", pos.ToString ());
 
 #if DEBUG_IDISPOSABLE
 		// HACK: Force clean up of Responders to avoid having to Dispose all the Views created above.
@@ -530,7 +526,8 @@ public class PosTests {
 	}
 
 	// See: https://github.com/gui-cs/Terminal.Gui/issues/504
-	[Fact] [TestRespondersDisposed]
+	[Fact]
+	[TestRespondersDisposed]
 	public void LeftTopBottomRight_Win_ShouldNotThrow ()
 	{
 		// Setup Fake driver
@@ -812,7 +809,8 @@ public class PosTests {
 	//	Application.Shutdown ();
 	//}
 
-	[Fact] [TestRespondersDisposed]
+	[Fact]
+	[TestRespondersDisposed]
 	public void PosCombine_Will_Throws ()
 	{
 		Application.Init (new FakeDriver ());
@@ -846,7 +844,8 @@ public class PosTests {
 		v2.Dispose ();
 	}
 
-	[Fact] [TestRespondersDisposed]
+	[Fact]
+	[TestRespondersDisposed]
 	public void Pos_Add_Operator ()
 	{
 		Application.Init (new FakeDriver ());
@@ -894,7 +893,8 @@ public class PosTests {
 		Application.Shutdown ();
 	}
 
-	[Fact] [TestRespondersDisposed]
+	[Fact]
+	[TestRespondersDisposed]
 	public void Pos_Subtract_Operator ()
 	{
 		Application.Init (new FakeDriver ());
@@ -955,7 +955,8 @@ public class PosTests {
 
 	}
 
-	[Fact] [TestRespondersDisposed]
+	[Fact]
+	[TestRespondersDisposed]
 	public void Internal_Tests ()
 	{
 		var posFactor = new Pos.PosFactor (0.10F);
@@ -1022,7 +1023,8 @@ public class PosTests {
 		Assert.NotEqual (pos1, pos2);
 	}
 
-	[Theory] [AutoInitShutdown]
+	[Theory]
+	[AutoInitShutdown]
 	[InlineData (true)]
 	[InlineData (false)]
 	public void PosPercentPlusOne (bool testHorizontal)
@@ -1084,4 +1086,41 @@ public class PosTests {
 
 		super.Dispose ();
 	}
-}
+
+	[Fact]
+	public void DoNotReturnPosCombine ()
+	{
+		var v = new View () { Id = "V" };
+
+		var pos = Pos.Left (v);
+		Assert.Equal (
+			"View(side=x,target=View(V)(0,0,0,0))",
+			pos.ToString ());
+
+		pos = Pos.X (v);
+		Assert.Equal (
+			"View(side=x,target=View(V)(0,0,0,0))",
+			pos.ToString ());
+
+		pos = Pos.Top (v);
+		Assert.Equal (
+			"View(side=y,target=View(V)(0,0,0,0))",
+			pos.ToString ());
+
+		pos = Pos.Y (v);
+		Assert.Equal (
+			"View(side=y,target=View(V)(0,0,0,0))",
+			pos.ToString ());
+
+		pos = Pos.Right (v);
+		Assert.Equal (
+			"View(side=right,target=View(V)(0,0,0,0))",
+			pos.ToString ());
+
+		pos = Pos.Bottom (v);
+		Assert.Equal (
+			"View(side=bottom,target=View(V)(0,0,0,0))",
+			pos.ToString ());
+	}
+}	
+

+ 4 - 5
UnitTests/View/ViewTests.cs

@@ -22,7 +22,7 @@ namespace Terminal.Gui.ViewTests {
 			var r = new View ();
 			Assert.NotNull (r);
 			Assert.Equal (LayoutStyle.Computed, r.LayoutStyle);
-			Assert.Equal ("View()((0,0,0,0))", r.ToString ());
+			Assert.Equal ("View()(0,0,0,0)", r.ToString ());
 			Assert.False (r.CanFocus);
 			Assert.False (r.HasFocus);
 			Assert.Equal (new Rect (0, 0, 0, 0), r.Bounds);
@@ -47,7 +47,7 @@ namespace Terminal.Gui.ViewTests {
 			r = new View (Rect.Empty);
 			Assert.NotNull (r);
 			Assert.Equal (LayoutStyle.Absolute, r.LayoutStyle);
-			Assert.Equal ("View()((0,0,0,0))", r.ToString ());
+			Assert.Equal ("View()(0,0,0,0)", r.ToString ());
 			Assert.False (r.CanFocus);
 			Assert.False (r.HasFocus);
 			Assert.Equal (new Rect (0, 0, 0, 0), r.Bounds);
@@ -72,7 +72,7 @@ namespace Terminal.Gui.ViewTests {
 			r = new View (new Rect (1, 2, 3, 4));
 			Assert.NotNull (r);
 			Assert.Equal (LayoutStyle.Absolute, r.LayoutStyle);
-			Assert.Equal ("View()((1,2,3,4))", r.ToString ());
+			Assert.Equal ("View()(1,2,3,4)", r.ToString ());
 			Assert.False (r.CanFocus);
 			Assert.False (r.HasFocus);
 			Assert.Equal (new Rect (0, 0, 3, 4), r.Bounds);
@@ -97,7 +97,7 @@ namespace Terminal.Gui.ViewTests {
 			r = new View ("Vertical View", TextDirection.TopBottom_LeftRight);
 			Assert.NotNull (r);
 			Assert.Equal (LayoutStyle.Computed, r.LayoutStyle);
-			Assert.Equal ("View(Vertical View)((0,0,1,13))", r.ToString ());
+			Assert.Equal ("View(Vertical View)(0,0,1,13)", r.ToString ());
 			Assert.False (r.CanFocus);
 			Assert.False (r.HasFocus);
 			Assert.Equal (new Rect (0, 0, 1, 13), r.Bounds);
@@ -117,7 +117,6 @@ namespace Terminal.Gui.ViewTests {
 			Assert.Null (r.MostFocused);
 			Assert.Equal (TextDirection.TopBottom_LeftRight, r.TextDirection);
 			r.Dispose ();
-		
 		}
 
 		[Fact, TestRespondersDisposed]

+ 10 - 10
UnitTests/Views/ScrollBarViewTests.cs

@@ -539,12 +539,12 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.True (_scrollBar.Visible);
 			Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
 			Assert.Equal (1, _scrollBar.Bounds.Width);
-			Assert.Equal ("Combine(View(Height,HostView()((0,0,80,25)))-Absolute(1))",
+			Assert.Equal ("Combine(View(Height,HostView()(0,0,80,25))-Absolute(1))",
 				_scrollBar.Height.ToString ());
 			Assert.Equal (24, _scrollBar.Bounds.Height);
 			Assert.True (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
 			Assert.True (_scrollBar.OtherScrollBarView.Visible);
-			Assert.Equal ("Combine(View(Width,HostView()((0,0,80,25)))-Absolute(1))",
+			Assert.Equal ("Combine(View(Width,HostView()(0,0,80,25))-Absolute(1))",
 				_scrollBar.OtherScrollBarView.Width.ToString ());
 			Assert.Equal (79, _scrollBar.OtherScrollBarView.Bounds.Width);
 			Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
@@ -556,12 +556,12 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.False (_scrollBar.Visible);
 			Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
 			Assert.Equal (1, _scrollBar.Bounds.Width);
-			Assert.Equal ("Combine(View(Height,HostView()((0,0,80,25)))-Absolute(1))",
+			Assert.Equal ("Combine(View(Height,HostView()(0,0,80,25))-Absolute(1))",
 				_scrollBar.Height.ToString ());
 			Assert.Equal (24, _scrollBar.Bounds.Height);
 			Assert.True (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
 			Assert.True (_scrollBar.OtherScrollBarView.Visible);
-			Assert.Equal ("View(Width,HostView()((0,0,80,25)))",
+			Assert.Equal ("View(Width,HostView()(0,0,80,25))",
 				_scrollBar.OtherScrollBarView.Width.ToString ());
 			Assert.Equal (80, _scrollBar.OtherScrollBarView.Bounds.Width);
 			Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
@@ -573,12 +573,12 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.False (_scrollBar.Visible);
 			Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
 			Assert.Equal (1, _scrollBar.Bounds.Width);
-			Assert.Equal ("Combine(View(Height,HostView()((0,0,80,25)))-Absolute(1))",
+			Assert.Equal ("Combine(View(Height,HostView()(0,0,80,25))-Absolute(1))",
 				_scrollBar.Height.ToString ());
 			Assert.Equal (24, _scrollBar.Bounds.Height);
 			Assert.False (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
 			Assert.False (_scrollBar.OtherScrollBarView.Visible);
-			Assert.Equal ("View(Width,HostView()((0,0,80,25)))",
+			Assert.Equal ("View(Width,HostView()(0,0,80,25))",
 				_scrollBar.OtherScrollBarView.Width.ToString ());
 			Assert.Equal (80, _scrollBar.OtherScrollBarView.Bounds.Width);
 			Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
@@ -590,12 +590,12 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.True (_scrollBar.Visible);
 			Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
 			Assert.Equal (1, _scrollBar.Bounds.Width);
-			Assert.Equal ("View(Height,HostView()((0,0,80,25)))",
+			Assert.Equal ("View(Height,HostView()(0,0,80,25))",
 				_scrollBar.Height.ToString ());
 			Assert.Equal (25, _scrollBar.Bounds.Height);
 			Assert.False (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
 			Assert.False (_scrollBar.OtherScrollBarView.Visible);
-			Assert.Equal ("View(Width,HostView()((0,0,80,25)))",
+			Assert.Equal ("View(Width,HostView()(0,0,80,25))",
 				_scrollBar.OtherScrollBarView.Width.ToString ());
 			Assert.Equal (80, _scrollBar.OtherScrollBarView.Bounds.Width);
 			Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());
@@ -607,12 +607,12 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.True (_scrollBar.Visible);
 			Assert.Equal ("Absolute(1)", _scrollBar.Width.ToString ());
 			Assert.Equal (1, _scrollBar.Bounds.Width);
-			Assert.Equal ("Combine(View(Height,HostView()((0,0,80,25)))-Absolute(1))",
+			Assert.Equal ("Combine(View(Height,HostView()(0,0,80,25))-Absolute(1))",
 				_scrollBar.Height.ToString ());
 			Assert.Equal (24, _scrollBar.Bounds.Height);
 			Assert.True (_scrollBar.OtherScrollBarView.ShowScrollIndicator);
 			Assert.True (_scrollBar.OtherScrollBarView.Visible);
-			Assert.Equal ("Combine(View(Width,HostView()((0,0,80,25)))-Absolute(1))",
+			Assert.Equal ("Combine(View(Width,HostView()(0,0,80,25))-Absolute(1))",
 				_scrollBar.OtherScrollBarView.Width.ToString ());
 			Assert.Equal (79, _scrollBar.OtherScrollBarView.Bounds.Width);
 			Assert.Equal ("Absolute(1)", _scrollBar.OtherScrollBarView.Height.ToString ());

+ 1 - 1
UnitTests/Views/TileViewTests.cs

@@ -526,7 +526,7 @@ namespace Terminal.Gui.ViewsTests
             var tileView = Get11By3TileView();
 
             var ex = Assert.Throws<ArgumentException>(() => tileView.SetSplitterPos(0, Pos.Right(tileView)));
-            Assert.Equal("Only Percent and Absolute values are supported. Passed value was PosCombine", ex.Message);
+            Assert.Equal("Only Percent and Absolute values are supported. Passed value was PosView", ex.Message);
 
             ex = Assert.Throws<ArgumentException>(() => tileView.SetSplitterPos(0, Pos.Function(() => 1)));
             Assert.Equal("Only Percent and Absolute values are supported. Passed value was PosFunc", ex.Message);

+ 3 - 3
UnitTests/Views/WindowTests.cs

@@ -24,7 +24,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.NotNull (r);
 			Assert.Equal (string.Empty, r.Title);
 			Assert.Equal (LayoutStyle.Computed, r.LayoutStyle);
-			Assert.Equal ("Window()((0,0,0,0))", r.ToString ());
+			Assert.Equal ("Window()(0,0,0,0)", r.ToString ());
 			Assert.True (r.CanFocus);
 			Assert.False (r.HasFocus);
 			Assert.Equal (new Rect (0, 0, 0, 0), r.Bounds);
@@ -48,7 +48,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.NotNull (r);
 			Assert.Equal ("title", r.Title);
 			Assert.Equal (LayoutStyle.Absolute, r.LayoutStyle);
-			Assert.Equal ("Window(title)((0,0,0,0))", r.ToString ());
+			Assert.Equal ("Window(title)(0,0,0,0)", r.ToString ());
 			Assert.True (r.CanFocus);
 			Assert.False (r.HasFocus);
 			Assert.Equal (new Rect (0, 0, 0, 0), r.Bounds);
@@ -72,7 +72,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.Equal ("title", r.Title);
 			Assert.NotNull (r);
 			Assert.Equal (LayoutStyle.Absolute, r.LayoutStyle);
-			Assert.Equal ("Window(title)((1,2,3,4))", r.ToString ());
+			Assert.Equal ("Window(title)(1,2,3,4)", r.ToString ());
 			Assert.True (r.CanFocus);
 			Assert.False (r.HasFocus);
 			Assert.Equal (new Rect (0, 0, 1, 2), r.Bounds);