|
@@ -58,6 +58,7 @@ public class TileViewTests
|
|
|
|
|
|
tv.Tiles.ElementAt (0).MinSize = int.MaxValue;
|
|
|
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -90,8 +91,8 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (0, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
- tv.Draw ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
+ Application.Top!.Draw ();
|
|
|
|
|
|
looksLike =
|
|
|
@"
|
|
@@ -111,6 +112,7 @@ public class TileViewTests
|
|
|
|
|
|
tv.Tiles.ElementAt (0).MinSize = int.MaxValue;
|
|
|
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -143,7 +145,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (0, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -187,7 +189,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -209,7 +211,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -252,7 +254,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -276,7 +278,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -320,7 +322,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -343,7 +345,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -386,7 +388,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -408,7 +410,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -445,7 +447,7 @@ public class TileViewTests
|
|
|
|
|
|
Assert.False (tv.SetSplitterPos (0, 0));
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -469,7 +471,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (0, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -504,7 +506,7 @@ public class TileViewTests
|
|
|
Assert.True (tv.SetSplitterPos (0, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -528,7 +530,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (0, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -569,7 +571,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -591,7 +593,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -631,7 +633,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -654,7 +656,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (1, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -694,7 +696,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -716,7 +718,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -756,7 +758,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -779,7 +781,7 @@ public class TileViewTests
|
|
|
Assert.False (tv.SetSplitterPos (3, x), $"Assert failed for x={x}");
|
|
|
}
|
|
|
|
|
|
- tv.SetNeedsDisplay ();
|
|
|
+ Application.Top!.Layout ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1412,6 +1414,7 @@ public class TileViewTests
|
|
|
Assert.Same (toRemove, removed);
|
|
|
Assert.DoesNotContain (removed, tileView.Tiles);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1432,6 +1435,7 @@ public class TileViewTests
|
|
|
Assert.Null (tileView.RemoveTile (2));
|
|
|
tileView.RemoveTile (0);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1450,6 +1454,7 @@ public class TileViewTests
|
|
|
|
|
|
Assert.NotNull (tileView.RemoveTile (0));
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1678,6 +1683,7 @@ public class TileViewTests
|
|
|
{
|
|
|
TileView tileView = Get11By3TileView (out LineView line);
|
|
|
tileView.Orientation = Orientation.Horizontal;
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -1706,6 +1712,7 @@ public class TileViewTests
|
|
|
|
|
|
Assert.True (line.HasFocus);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -1718,6 +1725,7 @@ public class TileViewTests
|
|
|
// Now move splitter line down
|
|
|
tileView.NewKeyDownEvent (Key.CursorDown);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1729,8 +1737,10 @@ public class TileViewTests
|
|
|
|
|
|
// And 2 up
|
|
|
line.NewKeyDownEvent (Key.CursorUp);
|
|
|
+ tileView.Layout ();
|
|
|
+
|
|
|
line.NewKeyDownEvent (Key.CursorUp);
|
|
|
- tileView.SetNeedsDisplay ();
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1757,6 +1767,7 @@ public class TileViewTests
|
|
|
// position should remain where it was, at 50%
|
|
|
Assert.Equal (Pos.Percent (50), tileView.SplitterDistances.ElementAt (0));
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -1768,6 +1779,7 @@ public class TileViewTests
|
|
|
|
|
|
// Now move splitter line down (allowed
|
|
|
line.NewKeyDownEvent (Key.CursorDown);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1782,6 +1794,7 @@ public class TileViewTests
|
|
|
line.NewKeyDownEvent (Key.CursorUp);
|
|
|
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1841,6 +1854,7 @@ public class TileViewTests
|
|
|
TileView tileView = Get11By3TileView (out LineView line, true);
|
|
|
tileView.InsertTile (2);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
// so should ignore the 2 distance and stick to 6
|
|
@@ -1859,6 +1873,7 @@ public class TileViewTests
|
|
|
TileView tileView = Get11By3TileView (out LineView line, true);
|
|
|
tileView.InsertTile (0);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
// so should ignore the 2 distance and stick to 6
|
|
@@ -1877,6 +1892,7 @@ public class TileViewTests
|
|
|
TileView tileView = Get11By3TileView (out LineView line, true);
|
|
|
tileView.InsertTile (1);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
// so should ignore the 2 distance and stick to 6
|
|
@@ -1894,6 +1910,7 @@ public class TileViewTests
|
|
|
{
|
|
|
TileView tileView = Get11By3TileView (out LineView line);
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -1917,6 +1934,7 @@ public class TileViewTests
|
|
|
TileView tileView = Get11By3TileView (out LineView line);
|
|
|
tileView.NewKeyDownEvent (new Key (tileView.ToggleResizable));
|
|
|
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -1928,6 +1946,7 @@ public class TileViewTests
|
|
|
|
|
|
// Now while focused move the splitter 1 unit right
|
|
|
line.NewKeyDownEvent (Key.CursorRight);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1939,7 +1958,9 @@ public class TileViewTests
|
|
|
|
|
|
// and 2 to the left
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1958,7 +1979,7 @@ public class TileViewTests
|
|
|
tileView.SetSplitterPos (0, Pos.Percent (50));
|
|
|
Assert.IsType<PosPercent> (tileView.SplitterDistances.ElementAt (0));
|
|
|
tileView.NewKeyDownEvent (new Key (tileView.ToggleResizable));
|
|
|
-
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -1970,6 +1991,7 @@ public class TileViewTests
|
|
|
|
|
|
// Now while focused move the splitter 1 unit right
|
|
|
line.NewKeyDownEvent (Key.CursorRight);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -1984,7 +2006,9 @@ public class TileViewTests
|
|
|
|
|
|
// and 2 to the left
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -2004,7 +2028,7 @@ public class TileViewTests
|
|
|
{
|
|
|
TileView tileView = Get11By3TileView (out LineView line, true);
|
|
|
tileView.NewKeyDownEvent (new Key (tileView.ToggleResizable));
|
|
|
-
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
var looksLike =
|
|
@@ -2016,6 +2040,7 @@ public class TileViewTests
|
|
|
|
|
|
// Now while focused move the splitter 1 unit right
|
|
|
line.NewKeyDownEvent (Key.CursorRight);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -2027,7 +2052,9 @@ public class TileViewTests
|
|
|
|
|
|
// and 2 to the left
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
looksLike =
|
|
@@ -2066,11 +2093,13 @@ public class TileViewTests
|
|
|
// would take us below the minimum splitter size
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
TestHelpers.AssertDriverContentsAre (looksLike, _output);
|
|
|
|
|
|
// but we can continue to move the splitter right if we want
|
|
|
line.NewKeyDownEvent (Key.CursorRight);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
tileView.Draw ();
|
|
|
|
|
@@ -2096,7 +2125,7 @@ public class TileViewTests
|
|
|
|
|
|
// Should stay where it was originally at (50%)
|
|
|
Assert.Equal (Pos.Percent (50), tileView.SplitterDistances.ElementAt (0));
|
|
|
-
|
|
|
+ tileView.Layout ();
|
|
|
tileView.Draw ();
|
|
|
|
|
|
// so should ignore the 2 distance and stick to 5
|
|
@@ -2110,12 +2139,14 @@ public class TileViewTests
|
|
|
// Keyboard movement on splitter should have no effect because it
|
|
|
// would take us below the minimum splitter size
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
tileView.Draw ();
|
|
|
TestHelpers.AssertDriverContentsAre (looksLike, _output);
|
|
|
|
|
|
// but we can continue to move the splitter right if we want
|
|
|
line.NewKeyDownEvent (Key.CursorRight);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
tileView.Draw ();
|
|
|
|
|
@@ -2135,7 +2166,7 @@ public class TileViewTests
|
|
|
TileView tileView = Get11By3TileView (out LineView line);
|
|
|
tileView.NewKeyDownEvent (new Key (tileView.ToggleResizable));
|
|
|
tileView.Tiles.ElementAt (1).MinSize = 6;
|
|
|
-
|
|
|
+ tileView.Layout ();
|
|
|
// distance leaves too little space for view2 (less than 6 would remain)
|
|
|
Assert.False (tileView.SetSplitterPos (0, 8));
|
|
|
|
|
@@ -2155,12 +2186,14 @@ public class TileViewTests
|
|
|
// Keyboard movement on splitter should have no effect because it
|
|
|
// would take us below the minimum splitter size
|
|
|
line.NewKeyDownEvent (Key.CursorRight);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
tileView.Draw ();
|
|
|
TestHelpers.AssertDriverContentsAre (looksLike, _output);
|
|
|
|
|
|
// but we can continue to move the splitter left if we want
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
tileView.Draw ();
|
|
|
|
|
@@ -2183,6 +2216,7 @@ public class TileViewTests
|
|
|
|
|
|
// distance leaves too little space for view2 (less than 5 would remain)
|
|
|
Assert.False (tileView.SetSplitterPos (0, 8));
|
|
|
+ tileView.Layout ();
|
|
|
|
|
|
// Should stay where it was originally at (50%)
|
|
|
Assert.Equal (Pos.Percent (50), tileView.SplitterDistances.ElementAt (0));
|
|
@@ -2200,12 +2234,14 @@ public class TileViewTests
|
|
|
// Keyboard movement on splitter should have no effect because it
|
|
|
// would take us below the minimum splitter size
|
|
|
line.NewKeyDownEvent (Key.CursorRight);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
tileView.Draw ();
|
|
|
TestHelpers.AssertDriverContentsAre (looksLike, _output);
|
|
|
|
|
|
// but we can continue to move the splitter left if we want
|
|
|
line.NewKeyDownEvent (Key.CursorLeft);
|
|
|
+ tileView.Layout ();
|
|
|
tileView.SetNeedsDisplay ();
|
|
|
tileView.Draw ();
|
|
|
|
|
@@ -2302,11 +2338,11 @@ public class TileViewTests
|
|
|
new Label { Width = Dim.Fill (), Height = 1, Text = new string ('5', 100) }
|
|
|
);
|
|
|
|
|
|
- var top = new Toplevel ();
|
|
|
- top.Add (tv);
|
|
|
+ Application.Top = new Toplevel ();
|
|
|
+ Application.Top.Add (tv);
|
|
|
tv.BeginInit ();
|
|
|
tv.EndInit ();
|
|
|
- tv.LayoutSubviews ();
|
|
|
+ tv.Layout ();
|
|
|
|
|
|
return tv;
|
|
|
}
|