Răsfoiți Sursa

Changed name to GetObjectRow

Thomas 3 ani în urmă
părinte
comite
6800113ff1

+ 1 - 1
Terminal.Gui/Views/TreeView.cs

@@ -622,7 +622,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		/// <param name="toFind"></param>
 		/// <returns></returns>
-		public int? GetObjectYPosition(T toFind)
+		public int? GetObjectRow(T toFind)
 		{
 			var idx = BuildLineMap ().IndexOf (o => o.Model.Equals (toFind));
 

+ 1 - 1
UICatalog/Scenarios/TreeViewFileSystem.cs

@@ -100,7 +100,7 @@ namespace UICatalog.Scenarios {
 				if (selected == null)
 					return;
 				
-				var location = treeViewFiles.GetObjectYPosition (selected);
+				var location = treeViewFiles.GetObjectRow (selected);
 
 				//selected object is offscreen or somehow not found
 				if (location == null || location < 0 || location > treeViewFiles.Frame.Height)

+ 13 - 13
UnitTests/TreeViewTests.cs

@@ -770,7 +770,7 @@ namespace Terminal.Gui.Views {
 		}
 
 		[Fact, AutoInitShutdown]
-		public void TestGetObjectYPosition ()
+		public void TestGetObjectRow ()
 		{
 			var tv = new TreeView { Width = 20, Height = 10 };
 
@@ -795,10 +795,10 @@ namespace Terminal.Gui.Views {
 └─pink
 ", output);
 
-			Assert.Equal (0, tv.GetObjectYPosition (n1));
-			Assert.Equal (1, tv.GetObjectYPosition (n1_1));
-			Assert.Equal (2, tv.GetObjectYPosition (n1_2));
-			Assert.Equal (3, tv.GetObjectYPosition (n2));
+			Assert.Equal (0, tv.GetObjectRow (n1));
+			Assert.Equal (1, tv.GetObjectRow (n1_1));
+			Assert.Equal (2, tv.GetObjectRow (n1_2));
+			Assert.Equal (3, tv.GetObjectRow (n2));
 
 			tv.Collapse (n1);
 
@@ -809,10 +809,10 @@ namespace Terminal.Gui.Views {
 @"├+normal
 └─pink
 ", output);
-			Assert.Equal (0, tv.GetObjectYPosition (n1));
-			Assert.Null (tv.GetObjectYPosition (n1_1));
-			Assert.Null (tv.GetObjectYPosition (n1_2));
-			Assert.Equal (1, tv.GetObjectYPosition (n2));
+			Assert.Equal (0, tv.GetObjectRow (n1));
+			Assert.Null (tv.GetObjectRow (n1_1));
+			Assert.Null (tv.GetObjectRow (n1_2));
+			Assert.Equal (1, tv.GetObjectRow (n2));
 
 
 			// scroll down 1
@@ -824,10 +824,10 @@ namespace Terminal.Gui.Views {
 			GraphViewTests.AssertDriverContentsAre (
 @"└─pink
 ", output);
-			Assert.Equal (-1, tv.GetObjectYPosition (n1));
-			Assert.Null (tv.GetObjectYPosition (n1_1));
-			Assert.Null (tv.GetObjectYPosition (n1_2));
-			Assert.Equal (0, tv.GetObjectYPosition (n2));
+			Assert.Equal (-1, tv.GetObjectRow (n1));
+			Assert.Null (tv.GetObjectRow (n1_1));
+			Assert.Null (tv.GetObjectRow (n1_2));
+			Assert.Equal (0, tv.GetObjectRow (n2));
 		}
 		[Fact, AutoInitShutdown]
 		public void TestTreeViewColor()