@@ -908,6 +908,99 @@ public void TestTreeViewColor ()
908
908
new [ ] { tv . ColorScheme . Normal , pink } ) ;
909
909
}
910
910
911
+ [ Fact , AutoInitShutdown ]
912
+ public void TestBottomlessTreeView_MaxDepth_5 ( )
913
+ {
914
+ var tv = new TreeView < string > ( ) { Width = 20 , Height = 10 } ;
915
+
916
+ tv . TreeBuilder = new DelegateTreeBuilder < string > (
917
+ ( s ) => new [ ] { ( int . Parse ( s ) + 1 ) . ToString ( ) }
918
+ ) ;
919
+
920
+ tv . AddObject ( "1" ) ;
921
+ tv . ColorScheme = new ColorScheme ( ) ;
922
+
923
+ tv . LayoutSubviews ( ) ;
924
+ tv . Redraw ( tv . Bounds ) ;
925
+
926
+ // Nothing expanded
927
+ TestHelpers . AssertDriverContentsAre (
928
+ @"└+1
929
+ " , output ) ;
930
+ tv . MaxDepth = 5 ;
931
+ tv . ExpandAll ( ) ;
932
+
933
+ tv . Redraw ( tv . Bounds ) ;
934
+
935
+ // Normal drawing of the tree view
936
+ TestHelpers . AssertDriverContentsAre (
937
+ @"
938
+ └-1
939
+ └-2
940
+ └-3
941
+ └-4
942
+ └-5
943
+ └─6
944
+ " , output ) ;
945
+ Assert . False ( tv . CanExpand ( "6" ) ) ;
946
+ Assert . False ( tv . IsExpanded ( "6" ) ) ;
947
+
948
+ tv . Collapse ( "6" ) ;
949
+
950
+ Assert . False ( tv . CanExpand ( "6" ) ) ;
951
+ Assert . False ( tv . IsExpanded ( "6" ) ) ;
952
+
953
+ tv . Collapse ( "5" ) ;
954
+
955
+ Assert . True ( tv . CanExpand ( "5" ) ) ;
956
+ Assert . False ( tv . IsExpanded ( "5" ) ) ;
957
+
958
+ tv . Redraw ( tv . Bounds ) ;
959
+
960
+ // Normal drawing of the tree view
961
+ TestHelpers . AssertDriverContentsAre (
962
+ @"
963
+ └-1
964
+ └-2
965
+ └-3
966
+ └-4
967
+ └+5
968
+ " , output ) ;
969
+ }
970
+
971
+ [ Fact , AutoInitShutdown ]
972
+ public void TestBottomlessTreeView_MaxDepth_3 ( )
973
+ {
974
+ var tv = new TreeView < string > ( ) { Width = 20 , Height = 10 } ;
975
+
976
+ tv . TreeBuilder = new DelegateTreeBuilder < string > (
977
+ ( s ) => new [ ] { ( int . Parse ( s ) + 1 ) . ToString ( ) }
978
+ ) ;
979
+
980
+ tv . AddObject ( "1" ) ;
981
+ tv . ColorScheme = new ColorScheme ( ) ;
982
+
983
+ tv . LayoutSubviews ( ) ;
984
+ tv . Redraw ( tv . Bounds ) ;
985
+
986
+ // Nothing expanded
987
+ TestHelpers . AssertDriverContentsAre (
988
+ @"└+1
989
+ " , output ) ;
990
+ tv . MaxDepth = 3 ;
991
+ tv . ExpandAll ( ) ;
992
+ tv . Redraw ( tv . Bounds ) ;
993
+
994
+ // Normal drawing of the tree view
995
+ TestHelpers . AssertDriverContentsAre (
996
+ @"
997
+ └-1
998
+ └-2
999
+ └-3
1000
+ └─4
1001
+ " , output ) ;
1002
+ }
1003
+
911
1004
[ Fact , AutoInitShutdown ]
912
1005
public void TestTreeView_Filter ( )
913
1006
{
0 commit comments