Skip to content

Commit

Permalink
Restoring unit test from v1.
Browse files Browse the repository at this point in the history
  • Loading branch information
BDisp committed Apr 11, 2024
1 parent a121b62 commit 24aef98
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions UnitTests/Views/ListViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -759,4 +759,39 @@ public void Clicking_On_Border_Is_Ignored ()
Assert.Equal ("Three", selected);
Assert.Equal (2, lv.SelectedItem);
}

[Fact]
[AutoInitShutdown]
public void LeftItem_TopItem_Tests ()
{
var source = new List<string> ();
for (int i = 0; i < 5; i++) {
source.Add ($"Item {i}");
}
var lv = new ListView () {
X = 1,
Width = 10,
Height = 5,
Source = new ListWrapper (source)
};
var top = new Toplevel ();
top.Add (lv);
Application.Begin (top);

TestHelpers.AssertDriverContentsWithFrameAre (@"
Item 0
Item 1
Item 2
Item 3
Item 4", _output);

lv.LeftItem = 1;
lv.TopItem = 1;
Application.Refresh ();
TestHelpers.AssertDriverContentsWithFrameAre (@"
tem 1
tem 2
tem 3
tem 4", _output);
}
}

0 comments on commit 24aef98

Please sign in to comment.