Changed name to GetObjectRow

This commit is contained in:
Thomas
2022-05-13 22:17:42 +01:00
parent 7f0671e10a
commit 6800113ff1
3 changed files with 15 additions and 15 deletions

View File

@@ -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));

View File

@@ -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)

View File

@@ -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()