mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-28 08:47:59 +01:00
Add unit test that proof setting TabIndex before all views are added, will have unexpected result.
This commit is contained in:
@@ -1312,6 +1312,32 @@ public class NavigationTests
|
||||
Assert.True (r.Subviews.IndexOf (v3) == 2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TabIndex_Invert_Order_Added_One_By_One_Does_Not_Do_What_Is_Expected ()
|
||||
{
|
||||
var r = new View ();
|
||||
var v1 = new View () { Id = "1", CanFocus = true };
|
||||
r.Add (v1);
|
||||
v1.TabIndex = 2;
|
||||
var v2 = new View () { Id = "2", CanFocus = true };
|
||||
r.Add (v2);
|
||||
v2.TabIndex = 1;
|
||||
var v3 = new View () { Id = "3", CanFocus = true };
|
||||
r.Add (v3);
|
||||
v3.TabIndex = 0;
|
||||
|
||||
Assert.False (r.TabIndexes.IndexOf (v1) == 2);
|
||||
Assert.True (r.TabIndexes.IndexOf (v1) == 1);
|
||||
Assert.False (r.TabIndexes.IndexOf (v2) == 1);
|
||||
Assert.True (r.TabIndexes.IndexOf (v2) == 2);
|
||||
// Only the last is in the expected index
|
||||
Assert.True (r.TabIndexes.IndexOf (v3) == 0);
|
||||
|
||||
Assert.True (r.Subviews.IndexOf (v1) == 0);
|
||||
Assert.True (r.Subviews.IndexOf (v2) == 1);
|
||||
Assert.True (r.Subviews.IndexOf (v3) == 2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TabIndex_Invert_Order_Mixed ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user