mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Fixed TabView
This commit is contained in:
@@ -181,18 +181,33 @@ namespace Terminal.Gui.DialogTests {
|
||||
|
||||
// This is because of PostionTopLevels and EnsureVisibleBounds
|
||||
Assert.Equal (new Point (3, 2), d.Frame.Location);
|
||||
Assert.Equal (new Size (17, 8), d.Frame.Size);
|
||||
// #3127: Before
|
||||
// Assert.Equal (new Size (17, 8), d.Frame.Size);
|
||||
// TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
//╔══════════════════╗
|
||||
//║ ║
|
||||
//║ ┌───────────────┐
|
||||
//║ │ │
|
||||
//║ │ │
|
||||
//║ │ │
|
||||
//║ │ │
|
||||
//║ │ │
|
||||
//║ │ │
|
||||
//╚══└───────────────┘", output);
|
||||
|
||||
// #3127: After: Because Toplevel is now Width/Height = Dim.Filll
|
||||
Assert.Equal (new Size (15, 6), d.Frame.Size);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
╔══════════════════╗
|
||||
║ ║
|
||||
║ ┌───────────────┐
|
||||
║ │ │
|
||||
║ │ │
|
||||
║ │ │
|
||||
║ │ │
|
||||
║ │ │
|
||||
║ │ │
|
||||
╚══└───────────────┘", output);
|
||||
║ ┌─────────────┐ ║
|
||||
║ │ │ ║
|
||||
║ │ │ ║
|
||||
║ │ │ ║
|
||||
║ │ │ ║
|
||||
║ └─────────────┘ ║
|
||||
║ ║
|
||||
╚══════════════════╝", output);
|
||||
|
||||
} else if (iterations > 0) {
|
||||
Application.RequestStop ();
|
||||
@@ -971,20 +986,11 @@ namespace Terminal.Gui.DialogTests {
|
||||
Application.Refresh ();
|
||||
Assert.Equal (new Rect (10, 0, 6, 1), btn.Frame);
|
||||
Assert.Equal (new Rect (0, 0, 6, 1), btn.Bounds);
|
||||
// #3127: Before: This test was clearly wrong before. The math above is correct, but the result is wrong.
|
||||
// var expected = @$"
|
||||
//┌──────────────────┐
|
||||
//│┌────────────────┐│
|
||||
//││23456789 {b}││
|
||||
//│└────────────────┘│
|
||||
//└──────────────────┘";
|
||||
|
||||
// #3127: After: This test was clearly wrong before. The math above is correct, but the result is wrong.
|
||||
// See also `PosDimFunction` in SetRelativeLayoutTests.cs
|
||||
var expected = @$"
|
||||
┌──────────────────┐
|
||||
│┌────────────────┐│
|
||||
││012345678 {b}││
|
||||
││23456789 {b}││
|
||||
│└────────────────┘│
|
||||
└──────────────────┘";
|
||||
|
||||
@@ -998,7 +1004,7 @@ namespace Terminal.Gui.DialogTests {
|
||||
expected = @$"
|
||||
┌──────────────────┐
|
||||
│┌────────────────┐│
|
||||
││012345678 {b}││
|
||||
││23456789 {b}││
|
||||
│└────────────────┘│
|
||||
└──────────────────┘";
|
||||
_ = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
||||
|
||||
@@ -265,20 +265,20 @@ namespace Terminal.Gui.ViewTests {
|
||||
int tc = 0, wc = 0, v1c = 0, v2c = 0, sv1c = 0;
|
||||
|
||||
winAddedToTop.Added += (s, e) => {
|
||||
Assert.Equal (e.Parent.Bounds.Width, winAddedToTop.Frame.Width);
|
||||
Assert.Equal (e.Parent.Bounds.Height, winAddedToTop.Frame.Height);
|
||||
Assert.Equal (e.Parent.Frame.Width, winAddedToTop.Frame.Width);
|
||||
Assert.Equal (e.Parent.Frame.Height, winAddedToTop.Frame.Height);
|
||||
};
|
||||
v1AddedToWin.Added += (s, e) => {
|
||||
Assert.Equal (e.Parent.Bounds.Width, v1AddedToWin.Frame.Width);
|
||||
Assert.Equal (e.Parent.Bounds.Height, v1AddedToWin.Frame.Height);
|
||||
Assert.Equal (e.Parent.Frame.Width, v1AddedToWin.Frame.Width);
|
||||
Assert.Equal (e.Parent.Frame.Height, v1AddedToWin.Frame.Height);
|
||||
};
|
||||
v2AddedToWin.Added += (s, e) => {
|
||||
Assert.Equal (e.Parent.Bounds.Width, v2AddedToWin.Frame.Width);
|
||||
Assert.Equal (e.Parent.Bounds.Height, v2AddedToWin.Frame.Height);
|
||||
Assert.Equal (e.Parent.Frame.Width, v2AddedToWin.Frame.Width);
|
||||
Assert.Equal (e.Parent.Frame.Height, v2AddedToWin.Frame.Height);
|
||||
};
|
||||
svAddedTov1.Added += (s, e) => {
|
||||
Assert.Equal (e.Parent.Bounds.Width, svAddedTov1.Frame.Width);
|
||||
Assert.Equal (e.Parent.Bounds.Height, svAddedTov1.Frame.Height);
|
||||
Assert.Equal (e.Parent.Frame.Width, svAddedTov1.Frame.Width);
|
||||
Assert.Equal (e.Parent.Frame.Height, svAddedTov1.Frame.Height);
|
||||
};
|
||||
|
||||
top.Initialized += (s, e) => {
|
||||
|
||||
@@ -188,6 +188,8 @@ namespace Terminal.Gui.ViewsTests {
|
||||
Application.Top.Add (sv);
|
||||
Application.Begin (Application.Top);
|
||||
|
||||
Assert.Equal (new Rect (0, 0, 10, 10), sv.Bounds);
|
||||
|
||||
Assert.False (sv.AutoHideScrollBars);
|
||||
Assert.True (sv.ShowHorizontalScrollIndicator);
|
||||
Assert.True (sv.ShowVerticalScrollIndicator);
|
||||
@@ -206,7 +208,9 @@ namespace Terminal.Gui.ViewsTests {
|
||||
", output);
|
||||
|
||||
sv.ShowHorizontalScrollIndicator = false;
|
||||
Assert.Equal (new Rect (0, 0, 10, 10), sv.Bounds);
|
||||
sv.ShowVerticalScrollIndicator = true;
|
||||
Assert.Equal (new Rect (0, 0, 10, 10), sv.Bounds);
|
||||
|
||||
Assert.False (sv.AutoHideScrollBars);
|
||||
Assert.False (sv.ShowHorizontalScrollIndicator);
|
||||
@@ -220,6 +224,7 @@ namespace Terminal.Gui.ViewsTests {
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
┴
|
||||
▼
|
||||
", output);
|
||||
@@ -241,7 +246,7 @@ namespace Terminal.Gui.ViewsTests {
|
||||
|
||||
|
||||
|
||||
◄├─────┤►
|
||||
◄├──────┤►
|
||||
", output);
|
||||
|
||||
sv.ShowHorizontalScrollIndicator = false;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Terminal.Gui.ViewsTests {
|
||||
tv.BeginInit ();
|
||||
tv.EndInit ();
|
||||
tv.ColorScheme = new ColorScheme ();
|
||||
tv.AddTab (tab1 = new Tab ("Tab1", new TextField ("hi")), false);
|
||||
tv.AddTab (tab1 = new Tab ("Tab1", new TextField ("hi") { Width = 2 }), false);
|
||||
tv.AddTab (tab2 = new Tab ("Tab2", new Label ("hi2")), false);
|
||||
return tv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user