Browse Source

WIP: unit test fixes

tznind 2 years ago
parent
commit
9bdd2a659e
2 changed files with 10 additions and 7 deletions
  1. 6 4
      Terminal.Gui/Views/SplitView.cs
  2. 4 3
      UnitTests/SplitViewTests.cs

+ 6 - 4
Terminal.Gui/Views/SplitView.cs

@@ -365,9 +365,11 @@ namespace Terminal.Gui {
 
 				if (orientation == Orientation.Vertical) {
 					line.X = splitterDistances [i];
+					line.Y = 0;
 				}
 				else {
 					line.Y = splitterDistances [i];
+					line.X = 0;
 				}
 
 			}
@@ -380,7 +382,7 @@ namespace Terminal.Gui {
 				// TODO: Deal with lines being Visibility false
 
 				if (Orientation == Orientation.Vertical) {
-					tile.View.X = i == 0 ? 0 : Pos.Right (splitterLines [i - 1]);
+					tile.View.X = i == 0 ? bounds.X : Pos.Right (splitterLines [i - 1]);
 					tile.View.Y = bounds.Y;
 					tile.View.Height = bounds.Height;
 
@@ -658,12 +660,12 @@ namespace Terminal.Gui {
 			{
 				if (oldValue is Pos.PosFactor) {
 					if (Orientation == Orientation.Horizontal) {
-						Parent.splitterDistances [Idx] = ConvertToPosFactor (newValue, Parent.Bounds.Height);
+						Parent.SetSplitterPos(Idx, ConvertToPosFactor (newValue, Parent.Bounds.Height));
 					} else {
-						Parent.splitterDistances [Idx] = ConvertToPosFactor (newValue, Parent.Bounds.Width);
+						Parent.SetSplitterPos (Idx, ConvertToPosFactor (newValue, Parent.Bounds.Width));
 					}
 				} else {
-					Parent.splitterDistances [Idx] = newValue;
+					Parent.SetSplitterPos (Idx, newValue);
 				}
 			}
 

+ 4 - 3
UnitTests/SplitViewTests.cs

@@ -400,6 +400,7 @@ namespace UnitTests {
 
 			// Now move splitter line down
 			line.ProcessKey (new KeyEvent (Key.CursorDown, new KeyModifiers ()));
+
 			splitContainer.Redraw (splitContainer.Bounds);
 			looksLike =
 @"    
@@ -471,15 +472,15 @@ namespace UnitTests {
 			var splitContainer = Get11By3SplitView ();
 
 			var ex = Assert.Throws<ArgumentException> (() => splitContainer.SetSplitterPos(0,Pos.Right (splitContainer)));
-			Assert.Equal ("Only Percent and Absolute values are supported for SplitterDistance property.  Passed value was PosCombine", ex.Message);
+			Assert.Equal ("Only Percent and Absolute values are supported.  Passed value was PosCombine", ex.Message);
 
 
 			ex = Assert.Throws<ArgumentException> (() => splitContainer.SetSplitterPos(0,Pos.Function (() => 1)));
-			Assert.Equal ("Only Percent and Absolute values are supported for SplitterDistance property.  Passed value was PosFunc", ex.Message);
+			Assert.Equal ("Only Percent and Absolute values are supported.  Passed value was PosFunc", ex.Message);
 
 			// Also not allowed because this results in a PosCombine
 			ex = Assert.Throws<ArgumentException> (() => splitContainer.SetSplitterPos(0, Pos.Percent (50) - 1));
-			Assert.Equal ("Only Percent and Absolute values are supported for SplitterDistance property.  Passed value was PosCombine", ex.Message);
+			Assert.Equal ("Only Percent and Absolute values are supported.  Passed value was PosCombine", ex.Message);
 		}
 
 		[Fact,AutoInitShutdown]