Browse Source

Address todos

Thomas 2 years ago
parent
commit
5d6ccb9cd4
2 changed files with 23 additions and 26 deletions
  1. 0 26
      Terminal.Gui/Views/TileView.cs
  2. 23 0
      UnitTests/TileViewTests.cs

+ 0 - 26
Terminal.Gui/Views/TileView.cs

@@ -926,32 +926,6 @@ namespace Terminal.Gui {
 		{
 		{
 			return IntegratedBorder != BorderStyle.None;
 			return IntegratedBorder != BorderStyle.None;
 		}
 		}
-		private bool HasAnyTitles ()
-		{
-			return tiles.Any (t => t.Title.Length > 0);
-
-		}
-
-
-		private class ChildSplitterLine {
-
-			readonly TileViewLineView currentLine;
-			internal ChildSplitterLine (TileViewLineView currentLine)
-			{
-				this.currentLine = currentLine;
-			}
-
-			internal void DrawTitles ()
-			{
-				//TODO: Implement this
-				/*if(currentLine.Orientation == Orientation.Horizontal) 
-				{
-					var screenRect = currentLine.ViewToScreen (
-						new Rect(0,0,currentLine.Frame.Width,currentLine.Frame.Height));
-					Driver.DrawWindowTitle (screenRect, currentLine.Parent.View2Title, 0, 0, 0, 0);
-				}*/
-			}
-		}
 	}
 	}
 
 
 	/// <summary>
 	/// <summary>

+ 23 - 0
UnitTests/TileViewTests.cs

@@ -1,6 +1,7 @@
 using System;
 using System;
 using System.Linq;
 using System.Linq;
 using Terminal.Gui;
 using Terminal.Gui;
+using Terminal.Gui.Graphs;
 using Xunit;
 using Xunit;
 using Xunit.Abstractions;
 using Xunit.Abstractions;
 
 
@@ -864,6 +865,28 @@ namespace UnitTests {
 			}
 			}
 		}
 		}
 
 
+		[Fact,AutoInitShutdown]
+		public void TestIsRoot_Yes()
+		{
+			var tv  = new TileView{Width=10,Height=5,ColorScheme = new ColorScheme(),IntegratedBorder = BorderStyle.Single};
+			var tv2 = new TileView{Width=10,Height=5,ColorScheme = new ColorScheme(),IntegratedBorder = BorderStyle.Single,Orientation = Orientation.Horizontal};
+			
+			Assert.True(tv.IsRootTileView());
+
+			tv.Tiles.ElementAt(0).View = tv2;
+
+			// tv2 is still considered a root because 
+			// it was manually created by API user.  That
+			// means it will not have its lines joined to
+			// parents and it is permitted to have a border
+			Assert.True(tv2.IsRootTileView());
+
+			// TODO: Test that this draws correctly with nested borders
+		}
+
+		// TODO: Add case showing no nested borders for child splits
+		// even when IntegratedBorder is set.
+
 		/// <summary>
 		/// <summary>
 		/// Creates a vertical orientation root container with left pane split into
 		/// Creates a vertical orientation root container with left pane split into
 		/// two (with horizontal splitter line).
 		/// two (with horizontal splitter line).