|
@@ -908,6 +908,99 @@ namespace Terminal.Gui.ViewTests {
|
|
new [] { tv.ColorScheme.Normal, pink });
|
|
new [] { tv.ColorScheme.Normal, pink });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ [Fact, AutoInitShutdown]
|
|
|
|
+ public void TestBottomlessTreeView_MaxDepth_5 ()
|
|
|
|
+ {
|
|
|
|
+ var tv = new TreeView<string> () { Width = 20, Height = 10 };
|
|
|
|
+
|
|
|
|
+ tv.TreeBuilder = new DelegateTreeBuilder<string> (
|
|
|
|
+ (s) => new [] { (int.Parse (s) + 1).ToString () }
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ tv.AddObject ("1");
|
|
|
|
+ tv.ColorScheme = new ColorScheme ();
|
|
|
|
+
|
|
|
|
+ tv.LayoutSubviews ();
|
|
|
|
+ tv.Redraw (tv.Bounds);
|
|
|
|
+
|
|
|
|
+ // Nothing expanded
|
|
|
|
+ TestHelpers.AssertDriverContentsAre (
|
|
|
|
+@"└+1
|
|
|
|
+", output);
|
|
|
|
+ tv.MaxDepth = 5;
|
|
|
|
+ tv.ExpandAll ();
|
|
|
|
+
|
|
|
|
+ tv.Redraw (tv.Bounds);
|
|
|
|
+
|
|
|
|
+ // Normal drawing of the tree view
|
|
|
|
+ TestHelpers.AssertDriverContentsAre (
|
|
|
|
+@"
|
|
|
|
+└-1
|
|
|
|
+ └-2
|
|
|
|
+ └-3
|
|
|
|
+ └-4
|
|
|
|
+ └-5
|
|
|
|
+ └─6
|
|
|
|
+", output);
|
|
|
|
+ Assert.False (tv.CanExpand ("6"));
|
|
|
|
+ Assert.False (tv.IsExpanded ("6"));
|
|
|
|
+
|
|
|
|
+ tv.Collapse("6");
|
|
|
|
+
|
|
|
|
+ Assert.False (tv.CanExpand ("6"));
|
|
|
|
+ Assert.False (tv.IsExpanded ("6"));
|
|
|
|
+
|
|
|
|
+ tv.Collapse ("5");
|
|
|
|
+
|
|
|
|
+ Assert.True (tv.CanExpand ("5"));
|
|
|
|
+ Assert.False (tv.IsExpanded ("5"));
|
|
|
|
+
|
|
|
|
+ tv.Redraw (tv.Bounds);
|
|
|
|
+
|
|
|
|
+ // Normal drawing of the tree view
|
|
|
|
+ TestHelpers.AssertDriverContentsAre (
|
|
|
|
+@"
|
|
|
|
+└-1
|
|
|
|
+ └-2
|
|
|
|
+ └-3
|
|
|
|
+ └-4
|
|
|
|
+ └+5
|
|
|
|
+", output);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [Fact, AutoInitShutdown]
|
|
|
|
+ public void TestBottomlessTreeView_MaxDepth_3 ()
|
|
|
|
+ {
|
|
|
|
+ var tv = new TreeView<string> () { Width = 20, Height = 10 };
|
|
|
|
+
|
|
|
|
+ tv.TreeBuilder = new DelegateTreeBuilder<string> (
|
|
|
|
+ (s) => new [] { (int.Parse (s) + 1).ToString () }
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ tv.AddObject ("1");
|
|
|
|
+ tv.ColorScheme = new ColorScheme ();
|
|
|
|
+
|
|
|
|
+ tv.LayoutSubviews ();
|
|
|
|
+ tv.Redraw (tv.Bounds);
|
|
|
|
+
|
|
|
|
+ // Nothing expanded
|
|
|
|
+ TestHelpers.AssertDriverContentsAre (
|
|
|
|
+@"└+1
|
|
|
|
+", output);
|
|
|
|
+ tv.MaxDepth = 3;
|
|
|
|
+ tv.ExpandAll ();
|
|
|
|
+ tv.Redraw (tv.Bounds);
|
|
|
|
+
|
|
|
|
+ // Normal drawing of the tree view
|
|
|
|
+ TestHelpers.AssertDriverContentsAre (
|
|
|
|
+@"
|
|
|
|
+└-1
|
|
|
|
+ └-2
|
|
|
|
+ └-3
|
|
|
|
+ └─4
|
|
|
|
+", output);
|
|
|
|
+ }
|
|
|
|
+
|
|
[Fact, AutoInitShutdown]
|
|
[Fact, AutoInitShutdown]
|
|
public void TestTreeView_Filter ()
|
|
public void TestTreeView_Filter ()
|
|
{
|
|
{
|