|
@@ -419,7 +419,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
|
|
|
var top = new Toplevel ();
|
|
|
top.Add (tableView);
|
|
|
- Application.Begin (top);
|
|
|
+ RunState rs = Application.Begin (top);
|
|
|
|
|
|
tableView.ColorScheme = Colors.ColorSchemes ["TopLevel"];
|
|
|
|
|
@@ -461,9 +461,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
// is to specify a MinAcceptableWidth for the column
|
|
|
style.MaxWidth = 10;
|
|
|
|
|
|
- tableView.LayoutSubviews ();
|
|
|
- tableView.SetNeedsDraw ();
|
|
|
- tableView.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected =
|
|
|
@"
|
|
@@ -481,10 +479,8 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
// RepresentationGetter and apply max length there
|
|
|
|
|
|
style.RepresentationGetter = s => { return s.ToString ().Length < 15 ? s.ToString () : s.ToString ().Substring (0, 13) + "..."; };
|
|
|
-
|
|
|
- tableView.LayoutSubviews ();
|
|
|
tableView.SetNeedsDraw ();
|
|
|
- tableView.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected =
|
|
|
@"
|
|
@@ -509,10 +505,9 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
// (Up to MaxWidth) but the renderer can accept using
|
|
|
// less space down to this limit
|
|
|
style.MinAcceptableWidth = 5;
|
|
|
-
|
|
|
- tableView.LayoutSubviews ();
|
|
|
tableView.SetNeedsDraw ();
|
|
|
- tableView.Draw ();
|
|
|
+
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected =
|
|
|
@"
|
|
@@ -529,8 +524,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
driver.ClearContents ();
|
|
|
|
|
|
tableView.Viewport = new (0, 0, 9, 5);
|
|
|
- tableView.LayoutSubviews ();
|
|
|
- tableView.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected =
|
|
|
@"
|
|
@@ -546,8 +540,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
// meet MinAcceptableWidth of 5. Column width includes terminator line
|
|
|
// symbol (e.g. ┤ or │)
|
|
|
tableView.Viewport = new (0, 0, 10, 5);
|
|
|
- tableView.LayoutSubviews ();
|
|
|
- tableView.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected =
|
|
|
@"
|
|
@@ -568,8 +561,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
tableView.MaxCellWidth = 10;
|
|
|
tableView.MinCellWidth = 3;
|
|
|
|
|
|
- tableView.LayoutSubviews ();
|
|
|
- tableView.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected =
|
|
|
@"
|
|
@@ -583,10 +575,9 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
// MaxCellWidth limits MinCellWidth
|
|
|
tableView.MaxCellWidth = 5;
|
|
|
tableView.MinCellWidth = 10;
|
|
|
-
|
|
|
- tableView.LayoutSubviews ();
|
|
|
tableView.SetNeedsDraw ();
|
|
|
- tableView.Draw ();
|
|
|
+
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected =
|
|
|
@"
|
|
@@ -732,6 +723,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
|
|
|
// since A is now pushed off screen we get indicator showing
|
|
|
// that user can scroll left to see first column
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -746,6 +738,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
tableView.NewKeyDownEvent (new () { KeyCode = KeyCode.CursorRight });
|
|
|
tableView.NewKeyDownEvent (new () { KeyCode = KeyCode.CursorRight });
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -804,7 +797,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
|
|
|
// Scroll right
|
|
|
tableView.NewKeyDownEvent (new () { KeyCode = KeyCode.CursorRight });
|
|
|
-
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
// Note that with SmoothHorizontalScrolling only a single new column
|
|
@@ -852,7 +845,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
|
|
|
// select last visible column
|
|
|
tableView.SelectedColumn = 2; // column C
|
|
|
-
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
var expected =
|
|
@@ -864,7 +857,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
|
|
|
// Scroll right
|
|
|
tableView.NewKeyDownEvent (new () { KeyCode = KeyCode.CursorRight });
|
|
|
-
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
// notice that without smooth scrolling we just update the first column
|
|
@@ -1070,12 +1063,12 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
|
|
|
var top = new Toplevel ();
|
|
|
top.Add (tv);
|
|
|
- Application.Begin (top);
|
|
|
+ RunState rs = Application.Begin (top);
|
|
|
|
|
|
tv.HasFocus = focused;
|
|
|
Assert.Equal (focused, tv.HasFocus);
|
|
|
|
|
|
- tv.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
var expected = @"
|
|
|
┌─┬─┐
|
|
@@ -1108,7 +1101,8 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
dt.Rows [0] [1] = 5;
|
|
|
|
|
|
tv.SetNeedsDraw ();
|
|
|
- tv.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
+
|
|
|
|
|
|
expected = @"
|
|
|
┌─┬─┐
|
|
@@ -1166,7 +1160,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
|
|
|
var top = new Toplevel ();
|
|
|
top.Add (tv);
|
|
|
- Application.Begin (top);
|
|
|
+ RunState rs = Application.Begin (top);
|
|
|
|
|
|
tv.HasFocus = focused;
|
|
|
Assert.Equal (focused, tv.HasFocus);
|
|
@@ -1203,7 +1197,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
dt.Rows [0] [1] = 5;
|
|
|
|
|
|
tv.SetNeedsDraw ();
|
|
|
- tv.Draw ();
|
|
|
+ Application.RunIteration (ref rs);
|
|
|
|
|
|
expected = @"
|
|
|
┌─┬─┐
|
|
@@ -1986,6 +1980,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
◄─┼─┼─┤
|
|
|
│2│3│4│";
|
|
|
tableView.SetNeedsDraw ();
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
TestHelpers.AssertDriverContentsAre (expected, output);
|
|
@@ -1999,6 +1994,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
├─┼─┼─┤
|
|
|
│2│3│4│";
|
|
|
tableView.SetNeedsDraw ();
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
TestHelpers.AssertDriverContentsAre (expected, output);
|
|
@@ -2014,6 +2010,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
tableView.Style.ShowHorizontalHeaderUnderline = true;
|
|
|
tableView.LayoutSubviews ();
|
|
|
tableView.SetNeedsDraw ();
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
|
|
|
// normally we should have scroll indicators because DEF are of screen
|
|
@@ -2036,6 +2033,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|
|
├─┼─┼─┤
|
|
|
│1│2│3│";
|
|
|
tableView.SetNeedsDraw ();
|
|
|
+ Application.ClipToScreen ();
|
|
|
tableView.Draw ();
|
|
|
TestHelpers.AssertDriverContentsAre (expected, output);
|
|
|
}
|
|
@@ -2574,7 +2572,9 @@ A B C
|
|
|
[SetupFakeDriver]
|
|
|
public void TestTableViewCheckboxes_ByObject ()
|
|
|
{
|
|
|
- Assert.Equal (ConfigurationManager.ConfigLocations.DefaultOnly, ConfigurationManager.Locations);
|
|
|
+ ConfigurationManager.Locations = ConfigurationManager.ConfigLocations.DefaultOnly;
|
|
|
+ ConfigurationManager.Reset();
|
|
|
+
|
|
|
TableView tv = GetPetTable (out EnumerableTableSource<PickablePet> source);
|
|
|
tv.LayoutSubviews ();
|
|
|
IReadOnlyCollection<PickablePet> pets = source.Data;
|
|
@@ -2609,6 +2609,7 @@ A B C
|
|
|
|
|
|
Assert.True (pets.First ().IsPicked);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2628,7 +2629,7 @@ A B C
|
|
|
Assert.True (pets.ElementAt (0).IsPicked);
|
|
|
Assert.True (pets.ElementAt (1).IsPicked);
|
|
|
Assert.False (pets.ElementAt (2).IsPicked);
|
|
|
-
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2648,7 +2649,7 @@ A B C
|
|
|
Assert.False (pets.ElementAt (0).IsPicked);
|
|
|
Assert.True (pets.ElementAt (1).IsPicked);
|
|
|
Assert.False (pets.ElementAt (2).IsPicked);
|
|
|
-
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2676,6 +2677,7 @@ A B C
|
|
|
wrapper.CheckedRows.Add (0);
|
|
|
wrapper.CheckedRows.Add (2);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
var expected =
|
|
@@ -2699,6 +2701,7 @@ A B C
|
|
|
Assert.Contains (2, wrapper.CheckedRows);
|
|
|
Assert.Equal (3, wrapper.CheckedRows.Count);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2714,6 +2717,7 @@ A B C
|
|
|
// Untoggle the top 2
|
|
|
tv.NewKeyDownEvent (Key.Space);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2742,6 +2746,7 @@ A B C
|
|
|
tv.NewKeyDownEvent (Key.A.WithCtrl);
|
|
|
tv.NewKeyDownEvent (Key.Space);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
var expected =
|
|
@@ -2761,6 +2766,7 @@ A B C
|
|
|
// Untoggle all again
|
|
|
tv.NewKeyDownEvent (Key.Space);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2801,6 +2807,7 @@ A B C
|
|
|
|
|
|
Assert.True (pets.All (p => p.IsPicked));
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
var expected =
|
|
@@ -2820,6 +2827,7 @@ A B C
|
|
|
Assert.Empty (pets.Where (p => p.IsPicked));
|
|
|
#pragma warning restore xUnit2029
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2846,6 +2854,7 @@ A B C
|
|
|
var wrapper = new CheckBoxTableSourceWrapperByIndex (tv, tv.Table);
|
|
|
tv.Table = wrapper;
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
var expected =
|
|
@@ -2865,6 +2874,7 @@ A B C
|
|
|
|
|
|
Assert.Single (wrapper.CheckedRows, 0);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2884,6 +2894,7 @@ A B C
|
|
|
Assert.Contains (1, wrapper.CheckedRows);
|
|
|
Assert.Equal (2, wrapper.CheckedRows.Count);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2902,6 +2913,7 @@ A B C
|
|
|
|
|
|
Assert.Single (wrapper.CheckedRows, 1);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2933,6 +2945,7 @@ A B C
|
|
|
wrapper.UseRadioButtons = true;
|
|
|
|
|
|
tv.Table = wrapper;
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
var expected =
|
|
@@ -2955,6 +2968,7 @@ A B C
|
|
|
|
|
|
Assert.True (pets.First ().IsPicked);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2975,6 +2989,7 @@ A B C
|
|
|
Assert.True (pets.ElementAt (1).IsPicked);
|
|
|
Assert.False (pets.ElementAt (2).IsPicked);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|
|
@@ -2995,6 +3010,7 @@ A B C
|
|
|
Assert.False (pets.ElementAt (1).IsPicked);
|
|
|
Assert.False (pets.ElementAt (2).IsPicked);
|
|
|
|
|
|
+ Application.ClipToScreen ();
|
|
|
tv.Draw ();
|
|
|
|
|
|
expected =
|