mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Added GoTo method and renamed 'model' parameter where appropriate
This commit is contained in:
@@ -498,6 +498,33 @@ namespace UnitTests {
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void GoTo_OnlyAppliesToExposedObjects ()
|
||||
{
|
||||
var tree = CreateTree (out Factory f, out Car car1, out _);
|
||||
|
||||
// Make tree bounds 1 in height so that EnsureVisible always requires updating scroll offset
|
||||
tree.Bounds = new Rect (0, 0, 50, 1);
|
||||
|
||||
Assert.Null (tree.SelectedObject);
|
||||
Assert.Equal (0, tree.ScrollOffsetVertical);
|
||||
|
||||
// car 1 is not yet exposed
|
||||
tree.GoTo (car1);
|
||||
|
||||
Assert.Null (tree.SelectedObject);
|
||||
Assert.Equal (0, tree.ScrollOffsetVertical);
|
||||
|
||||
tree.Expand (f);
|
||||
|
||||
// Car1 is now exposed by expanding the factory
|
||||
tree.GoTo (car1);
|
||||
|
||||
Assert.Equal (car1, tree.SelectedObject);
|
||||
Assert.Equal (1, tree.ScrollOffsetVertical);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void ObjectActivated_CustomKey ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user