mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixed #3781
This commit is contained in:
@@ -464,8 +464,9 @@ public class Border : Adornment
|
||||
parentLoc.X - _startGrabPoint.X,
|
||||
parentLoc.Y - _startGrabPoint.Y,
|
||||
out int nx,
|
||||
out int ny,
|
||||
out _
|
||||
out int ny
|
||||
//,
|
||||
// out _
|
||||
);
|
||||
|
||||
Parent.X = parentLoc.X - _startGrabPoint.X;
|
||||
|
||||
@@ -38,13 +38,14 @@ public partial class View // Layout APIs
|
||||
int targetX,
|
||||
int targetY,
|
||||
out int nx,
|
||||
out int ny,
|
||||
out StatusBar? statusBar
|
||||
out int ny
|
||||
//,
|
||||
// out StatusBar? statusBar
|
||||
)
|
||||
{
|
||||
int maxDimension;
|
||||
View? superView;
|
||||
statusBar = null!;
|
||||
//statusBar = null!;
|
||||
|
||||
if (viewToMove is not Toplevel || viewToMove?.SuperView is null || viewToMove == Application.Top || viewToMove?.SuperView == Application.Top)
|
||||
{
|
||||
@@ -112,26 +113,26 @@ public partial class View // Layout APIs
|
||||
|
||||
ny = Math.Max (targetY, maxDimension);
|
||||
|
||||
if (viewToMove?.SuperView is null || viewToMove == Application.Top || viewToMove?.SuperView == Application.Top)
|
||||
{
|
||||
statusVisible = Application.Top?.StatusBar?.Visible == true;
|
||||
statusBar = Application.Top?.StatusBar!;
|
||||
}
|
||||
else
|
||||
{
|
||||
View? t = viewToMove!.SuperView;
|
||||
//if (viewToMove?.SuperView is null || viewToMove == Application.Top || viewToMove?.SuperView == Application.Top)
|
||||
//{
|
||||
// statusVisible = Application.Top?.StatusBar?.Visible == true;
|
||||
// statusBar = Application.Top?.StatusBar!;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// View? t = viewToMove!.SuperView;
|
||||
|
||||
while (t is { } and not Toplevel)
|
||||
{
|
||||
t = t.SuperView;
|
||||
}
|
||||
// while (t is { } and not Toplevel)
|
||||
// {
|
||||
// t = t.SuperView;
|
||||
// }
|
||||
|
||||
if (t is Toplevel topLevel)
|
||||
{
|
||||
statusVisible = topLevel.StatusBar?.Visible == true;
|
||||
statusBar = topLevel.StatusBar!;
|
||||
}
|
||||
}
|
||||
// if (t is Toplevel topLevel)
|
||||
// {
|
||||
// statusVisible = topLevel.StatusBar?.Visible == true;
|
||||
// statusBar = topLevel.StatusBar!;
|
||||
// }
|
||||
//}
|
||||
|
||||
if (viewToMove?.SuperView is null || viewToMove == Application.Top || viewToMove?.SuperView == Application.Top)
|
||||
{
|
||||
|
||||
@@ -72,9 +72,9 @@ public partial class Toplevel : View
|
||||
/// <summary>Gets the latest <see cref="MenuBar"/> added into this Toplevel.</summary>
|
||||
public MenuBar? MenuBar => (MenuBar?)Subviews?.LastOrDefault (s => s is MenuBar);
|
||||
|
||||
// TODO: Deprecate - Any view can host a statusbar in v2
|
||||
/// <summary>Gets the latest <see cref="StatusBar"/> added into this Toplevel.</summary>
|
||||
public StatusBar? StatusBar => (StatusBar?)Subviews?.LastOrDefault (s => s is StatusBar);
|
||||
//// TODO: Deprecate - Any view can host a statusbar in v2
|
||||
///// <summary>Gets the latest <see cref="StatusBar"/> added into this Toplevel.</summary>
|
||||
//public StatusBar? StatusBar => (StatusBar?)Subviews?.LastOrDefault (s => s is StatusBar);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -225,8 +225,9 @@ public partial class Toplevel : View
|
||||
top.Frame.X,
|
||||
top.Frame.Y,
|
||||
out int nx,
|
||||
out int ny,
|
||||
out StatusBar? sb
|
||||
out int ny
|
||||
//,
|
||||
// out StatusBar? sb
|
||||
);
|
||||
|
||||
if (superView is null)
|
||||
@@ -260,16 +261,16 @@ public partial class Toplevel : View
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: v2 - This is a hack to get the StatusBar to be positioned correctly.
|
||||
if (sb != null
|
||||
&& !top!.Subviews.Contains (sb)
|
||||
&& ny + top.Frame.Height != superView.Frame.Height - (sb.Visible ? 1 : 0)
|
||||
&& top.Height is DimFill
|
||||
&& -top.Height.GetAnchor (0) < 1)
|
||||
{
|
||||
top.Height = Dim.Fill (sb.Visible ? 1 : 0);
|
||||
layoutSubviews = true;
|
||||
}
|
||||
//// TODO: v2 - This is a hack to get the StatusBar to be positioned correctly.
|
||||
//if (sb != null
|
||||
// && !top!.Subviews.Contains (sb)
|
||||
// && ny + top.Frame.Height != superView.Frame.Height - (sb.Visible ? 1 : 0)
|
||||
// && top.Height is DimFill
|
||||
// && -top.Height.GetAnchor (0) < 1)
|
||||
//{
|
||||
// top.Height = Dim.Fill (sb.Visible ? 1 : 0);
|
||||
// layoutSubviews = true;
|
||||
//}
|
||||
|
||||
if (superView.LayoutNeeded || layoutSubviews)
|
||||
{
|
||||
|
||||
@@ -390,17 +390,17 @@ public class DynamicStatusBar : Scenario
|
||||
|
||||
_btnAdd.Accepting += (s, e) =>
|
||||
{
|
||||
if (StatusBar == null)
|
||||
{
|
||||
MessageBox.ErrorQuery (
|
||||
"StatusBar Bar Error",
|
||||
"Must add a StatusBar first!",
|
||||
"Ok"
|
||||
);
|
||||
_btnAddStatusBar.SetFocus ();
|
||||
//if (StatusBar == null)
|
||||
//{
|
||||
// MessageBox.ErrorQuery (
|
||||
// "StatusBar Bar Error",
|
||||
// "Must add a StatusBar first!",
|
||||
// "Ok"
|
||||
// );
|
||||
// _btnAddStatusBar.SetFocus ();
|
||||
|
||||
return;
|
||||
}
|
||||
// return;
|
||||
//}
|
||||
|
||||
var frameDetails = new DynamicStatusBarDetails ();
|
||||
DynamicStatusItem item = frameDetails.EnterStatusItem ();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Terminal.Gui;
|
||||
|
||||
namespace UICatalog.Scenarios;
|
||||
@@ -24,7 +25,11 @@ public class LineViewExample : Scenario
|
||||
};
|
||||
top.Add (menu);
|
||||
|
||||
var appWindow = new Window ();
|
||||
var appWindow = new Window ()
|
||||
{
|
||||
Y = 1,
|
||||
Height = Dim.Fill (1) // BUGBUG: what if StatusBar is taller than 1?
|
||||
};
|
||||
appWindow.Add (new Label { Y = 1, Text = "Regular Line" });
|
||||
|
||||
// creates a horizontal line
|
||||
@@ -79,8 +84,8 @@ public class LineViewExample : Scenario
|
||||
new (Application.QuitKey, "Quit", Quit)
|
||||
}
|
||||
);
|
||||
top.Add (statusBar);
|
||||
top.Add (appWindow);
|
||||
top.Add (statusBar);
|
||||
|
||||
// Run - Start the application.
|
||||
Application.Run (top);
|
||||
|
||||
@@ -211,8 +211,6 @@ public class ListColumns : Scenario
|
||||
]
|
||||
};
|
||||
|
||||
top.Add (menu);
|
||||
|
||||
var statusBar = new StatusBar (
|
||||
new Shortcut []
|
||||
{
|
||||
@@ -222,8 +220,6 @@ public class ListColumns : Scenario
|
||||
new (Application.QuitKey, "Quit", Quit)
|
||||
}
|
||||
);
|
||||
top.Add (statusBar);
|
||||
|
||||
appWindow.Add (_listColView);
|
||||
|
||||
var selectedCellLabel = new Label
|
||||
@@ -256,7 +252,9 @@ public class ListColumns : Scenario
|
||||
|
||||
_listColView.KeyBindings.ReplaceCommands (Key.Space, Command.Accept);
|
||||
|
||||
top.Add (appWindow);
|
||||
top.Add (menu, appWindow, statusBar);
|
||||
appWindow.Y = 1;
|
||||
appWindow.Height = Dim.Fill(Dim.Func (() => statusBar.Frame.Height));
|
||||
|
||||
// Run - Start the application.
|
||||
Application.Run (top);
|
||||
|
||||
@@ -57,16 +57,17 @@ public class SingleBackgroundWorker : Scenario
|
||||
)
|
||||
]
|
||||
};
|
||||
Add (menu);
|
||||
|
||||
var statusBar = new StatusBar (
|
||||
[
|
||||
new (Application.QuitKey, "Quit", () => Application.RequestStop ()),
|
||||
new (Key.R.WithCtrl, "Run Worker", RunWorker)
|
||||
]);
|
||||
Add (statusBar);
|
||||
|
||||
var workerLogTop = new Toplevel { Title = "Worker Log Top" };
|
||||
var workerLogTop = new Toplevel
|
||||
{
|
||||
Title = "Worker Log Top",
|
||||
};
|
||||
|
||||
workerLogTop.Add (
|
||||
new Label { X = Pos.Center (), Y = 0, Text = "Worker Log" }
|
||||
@@ -81,7 +82,11 @@ public class SingleBackgroundWorker : Scenario
|
||||
Source = new ListWrapper<string> (_log)
|
||||
};
|
||||
workerLogTop.Add (_listLog);
|
||||
Add (workerLogTop);
|
||||
|
||||
workerLogTop.Y = 1;
|
||||
workerLogTop.Height = Dim.Fill (Dim.Func (() => statusBar.Frame.Height));
|
||||
|
||||
Add (menu, workerLogTop, statusBar);
|
||||
Title = "MainApp";
|
||||
}
|
||||
|
||||
|
||||
@@ -139,55 +139,55 @@ public class StatusBarTests
|
||||
Assert.Equal (1, sb.Frame.Height);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RemoveAndThenAddStatusBar_ShouldNotChangeWidth ()
|
||||
{
|
||||
StatusBar statusBar;
|
||||
StatusBar statusBar2;
|
||||
//[Fact]
|
||||
//public void RemoveAndThenAddStatusBar_ShouldNotChangeWidth ()
|
||||
//{
|
||||
// StatusBar statusBar;
|
||||
// StatusBar statusBar2;
|
||||
|
||||
var w = new Window ();
|
||||
statusBar2 = new StatusBar () { Id = "statusBar2" };
|
||||
statusBar = new StatusBar () { Id = "statusBar" };
|
||||
w.Width = Dim.Fill (0);
|
||||
w.Height = Dim.Fill (0);
|
||||
w.X = 0;
|
||||
w.Y = 0;
|
||||
// var w = new Window ();
|
||||
// statusBar2 = new StatusBar () { Id = "statusBar2" };
|
||||
// statusBar = new StatusBar () { Id = "statusBar" };
|
||||
// w.Width = Dim.Fill (0);
|
||||
// w.Height = Dim.Fill (0);
|
||||
// w.X = 0;
|
||||
// w.Y = 0;
|
||||
|
||||
w.Visible = true;
|
||||
w.Modal = false;
|
||||
w.Title = "";
|
||||
statusBar.Width = Dim.Fill (0);
|
||||
statusBar.Height = 1;
|
||||
statusBar.X = 0;
|
||||
statusBar.Y = 0;
|
||||
statusBar.Visible = true;
|
||||
w.Add (statusBar);
|
||||
Assert.Equal (w.StatusBar, statusBar);
|
||||
// w.Visible = true;
|
||||
// w.Modal = false;
|
||||
// w.Title = "";
|
||||
// statusBar.Width = Dim.Fill (0);
|
||||
// statusBar.Height = 1;
|
||||
// statusBar.X = 0;
|
||||
// statusBar.Y = 0;
|
||||
// statusBar.Visible = true;
|
||||
// w.Add (statusBar);
|
||||
// Assert.Equal (w.StatusBar, statusBar);
|
||||
|
||||
statusBar2.Width = Dim.Fill (0);
|
||||
statusBar2.Height = 1;
|
||||
statusBar2.X = 0;
|
||||
statusBar2.Y = 4;
|
||||
statusBar2.Visible = true;
|
||||
w.Add (statusBar2);
|
||||
Assert.Equal (w.StatusBar, statusBar2);
|
||||
// statusBar2.Width = Dim.Fill (0);
|
||||
// statusBar2.Height = 1;
|
||||
// statusBar2.X = 0;
|
||||
// statusBar2.Y = 4;
|
||||
// statusBar2.Visible = true;
|
||||
// w.Add (statusBar2);
|
||||
// Assert.Equal (w.StatusBar, statusBar2);
|
||||
|
||||
var menuBars = w.Subviews.OfType<StatusBar> ().ToArray ();
|
||||
Assert.Equal (2, menuBars.Length);
|
||||
// var menuBars = w.Subviews.OfType<StatusBar> ().ToArray ();
|
||||
// Assert.Equal (2, menuBars.Length);
|
||||
|
||||
Assert.Equal (Dim.Fill (0), menuBars [0].Width);
|
||||
Assert.Equal (Dim.Fill (0), menuBars [1].Width);
|
||||
// Assert.Equal (Dim.Fill (0), menuBars [0].Width);
|
||||
// Assert.Equal (Dim.Fill (0), menuBars [1].Width);
|
||||
|
||||
// Goes wrong here
|
||||
w.Remove (statusBar);
|
||||
w.Remove (statusBar2);
|
||||
// // Goes wrong here
|
||||
// w.Remove (statusBar);
|
||||
// w.Remove (statusBar2);
|
||||
|
||||
w.Add (statusBar);
|
||||
w.Add (statusBar2);
|
||||
// w.Add (statusBar);
|
||||
// w.Add (statusBar2);
|
||||
|
||||
// These assertions fail
|
||||
Assert.Equal (Dim.Fill (0), menuBars [0].Width);
|
||||
Assert.Equal (Dim.Fill (0), menuBars [1].Width);
|
||||
}
|
||||
// // These assertions fail
|
||||
// Assert.Equal (Dim.Fill (0), menuBars [0].Width);
|
||||
// Assert.Equal (Dim.Fill (0), menuBars [1].Width);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
|
||||
Assert.False (top.Running);
|
||||
Assert.False (top.Modal);
|
||||
Assert.Null (top.MenuBar);
|
||||
Assert.Null (top.StatusBar);
|
||||
//Assert.Null (top.StatusBar);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -45,55 +45,55 @@ public partial class ToplevelTests (ITestOutputHelper output)
|
||||
|
||||
top.Add (new MenuBar ());
|
||||
Assert.NotNull (top.MenuBar);
|
||||
top.Add (new StatusBar ());
|
||||
Assert.NotNull (top.StatusBar);
|
||||
//top.Add (new StatusBar ());
|
||||
//Assert.NotNull (top.StatusBar);
|
||||
var menuBar = top.MenuBar;
|
||||
top.Remove (top.MenuBar);
|
||||
Assert.Null (top.MenuBar);
|
||||
Assert.NotNull (menuBar);
|
||||
var statusBar = top.StatusBar;
|
||||
top.Remove (top.StatusBar);
|
||||
Assert.Null (top.StatusBar);
|
||||
Assert.NotNull (statusBar);
|
||||
//var statusBar = top.StatusBar;
|
||||
//top.Remove (top.StatusBar);
|
||||
//Assert.Null (top.StatusBar);
|
||||
//Assert.NotNull (statusBar);
|
||||
#if DEBUG_IDISPOSABLE
|
||||
Assert.False (menuBar.WasDisposed);
|
||||
Assert.False (statusBar.WasDisposed);
|
||||
//Assert.False (statusBar.WasDisposed);
|
||||
menuBar.Dispose ();
|
||||
statusBar.Dispose ();
|
||||
//statusBar.Dispose ();
|
||||
Assert.True (menuBar.WasDisposed);
|
||||
Assert.True (statusBar.WasDisposed);
|
||||
//Assert.True (statusBar.WasDisposed);
|
||||
#endif
|
||||
|
||||
Application.Begin (top);
|
||||
Assert.Equal (top, Application.Top);
|
||||
|
||||
// Application.Top without menu and status bar.
|
||||
View supView = View.GetLocationEnsuringFullVisibility (top, 2, 2, out int nx, out int ny, out StatusBar sb);
|
||||
View supView = View.GetLocationEnsuringFullVisibility (top, 2, 2, out int nx, out int ny/*, out StatusBar sb*/);
|
||||
Assert.Equal (Application.Top, supView);
|
||||
Assert.Equal (0, nx);
|
||||
Assert.Equal (0, ny);
|
||||
Assert.Null (sb);
|
||||
//Assert.Null (sb);
|
||||
|
||||
top.Add (new MenuBar ());
|
||||
Assert.NotNull (top.MenuBar);
|
||||
|
||||
// Application.Top with a menu and without status bar.
|
||||
View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (0, nx);
|
||||
Assert.Equal (1, ny);
|
||||
Assert.Null (sb);
|
||||
//Assert.Null (sb);
|
||||
|
||||
top.Add (new StatusBar ());
|
||||
Assert.NotNull (top.StatusBar);
|
||||
//top.Add (new StatusBar ());
|
||||
//Assert.NotNull (top.StatusBar);
|
||||
|
||||
// Application.Top with a menu and status bar.
|
||||
View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (0, nx);
|
||||
|
||||
// The available height is lower than the Application.Top height minus
|
||||
// the menu bar and status bar, then the top can go beyond the bottom
|
||||
Assert.Equal (2, ny);
|
||||
Assert.NotNull (sb);
|
||||
//Assert.NotNull (sb);
|
||||
|
||||
menuBar = top.MenuBar;
|
||||
top.Remove (top.MenuBar);
|
||||
@@ -101,18 +101,18 @@ public partial class ToplevelTests (ITestOutputHelper output)
|
||||
Assert.NotNull (menuBar);
|
||||
|
||||
// Application.Top without a menu and with a status bar.
|
||||
View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (top, 2, 2, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (0, nx);
|
||||
|
||||
// The available height is lower than the Application.Top height minus
|
||||
// the status bar, then the top can go beyond the bottom
|
||||
Assert.Equal (2, ny);
|
||||
Assert.NotNull (sb);
|
||||
//Assert.NotNull (sb);
|
||||
|
||||
statusBar = top.StatusBar;
|
||||
top.Remove (top.StatusBar);
|
||||
Assert.Null (top.StatusBar);
|
||||
Assert.NotNull (statusBar);
|
||||
//statusBar = top.StatusBar;
|
||||
//top.Remove (top.StatusBar);
|
||||
//Assert.Null (top.StatusBar);
|
||||
//Assert.NotNull (statusBar);
|
||||
Assert.Null (top.MenuBar);
|
||||
|
||||
var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
|
||||
@@ -120,46 +120,46 @@ public partial class ToplevelTests (ITestOutputHelper output)
|
||||
top.LayoutSubviews ();
|
||||
|
||||
// The SuperView is always the same regardless of the caller.
|
||||
supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny, out sb);
|
||||
supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (Application.Top, supView);
|
||||
supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny, out sb);
|
||||
supView = View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (Application.Top, supView);
|
||||
|
||||
// Application.Top without menu and status bar.
|
||||
View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (0, nx);
|
||||
Assert.Equal (0, ny);
|
||||
Assert.Null (sb);
|
||||
//Assert.Null (sb);
|
||||
|
||||
top.Add (new MenuBar ());
|
||||
Assert.NotNull (top.MenuBar);
|
||||
|
||||
// Application.Top with a menu and without status bar.
|
||||
View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (0, nx);
|
||||
Assert.Equal (1, ny);
|
||||
Assert.Null (sb);
|
||||
//Assert.Null (sb);
|
||||
|
||||
top.Add (new StatusBar ());
|
||||
Assert.NotNull (top.StatusBar);
|
||||
//Assert.NotNull (top.StatusBar);
|
||||
|
||||
// Application.Top with a menu and status bar.
|
||||
View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (0, nx);
|
||||
|
||||
// The available height is lower than the Application.Top height minus
|
||||
// the menu bar and status bar, then the top can go beyond the bottom
|
||||
Assert.Equal (20, ny);
|
||||
Assert.NotNull (sb);
|
||||
//Assert.NotNull (sb);
|
||||
|
||||
menuBar = top.MenuBar;
|
||||
statusBar = top.StatusBar;
|
||||
//statusBar = top.StatusBar;
|
||||
top.Remove (top.MenuBar);
|
||||
Assert.Null (top.MenuBar);
|
||||
Assert.NotNull (menuBar);
|
||||
top.Remove (top.StatusBar);
|
||||
Assert.Null (top.StatusBar);
|
||||
Assert.NotNull (statusBar);
|
||||
//top.Remove (top.StatusBar);
|
||||
//Assert.Null (top.StatusBar);
|
||||
//Assert.NotNull (statusBar);
|
||||
|
||||
top.Remove (win);
|
||||
|
||||
@@ -167,28 +167,28 @@ public partial class ToplevelTests (ITestOutputHelper output)
|
||||
top.Add (win);
|
||||
|
||||
// Application.Top without menu and status bar.
|
||||
View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (win, 0, 0, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (0, nx);
|
||||
Assert.Equal (0, ny);
|
||||
Assert.Null (sb);
|
||||
//Assert.Null (sb);
|
||||
|
||||
top.Add (new MenuBar ());
|
||||
Assert.NotNull (top.MenuBar);
|
||||
|
||||
// Application.Top with a menu and without status bar.
|
||||
View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (win, 2, 2, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (2, nx);
|
||||
Assert.Equal (2, ny);
|
||||
Assert.Null (sb);
|
||||
//Assert.Null (sb);
|
||||
|
||||
top.Add (new StatusBar ());
|
||||
Assert.NotNull (top.StatusBar);
|
||||
//Assert.NotNull (top.StatusBar);
|
||||
|
||||
// Application.Top with a menu and status bar.
|
||||
View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny, out sb);
|
||||
View.GetLocationEnsuringFullVisibility (win, 30, 20, out nx, out ny/*, out sb*/);
|
||||
Assert.Equal (20, nx); // 20+60=80
|
||||
Assert.Equal (9, ny); // 9+15+1(mb)=25
|
||||
Assert.NotNull (sb);
|
||||
//Assert.NotNull (sb);
|
||||
|
||||
//Assert.Null (Toplevel._dragPosition);
|
||||
win.NewMouseEvent (new () { Position = new (6, 0), Flags = MouseFlags.Button1Pressed });
|
||||
@@ -204,18 +204,18 @@ public partial class ToplevelTests (ITestOutputHelper output)
|
||||
#if DEBUG_IDISPOSABLE
|
||||
|
||||
Assert.False (top.MenuBar.WasDisposed);
|
||||
Assert.False (top.StatusBar.WasDisposed);
|
||||
//Assert.False (top.StatusBar.WasDisposed);
|
||||
#endif
|
||||
menuBar = top.MenuBar;
|
||||
statusBar = top.StatusBar;
|
||||
//statusBar = top.StatusBar;
|
||||
top.Dispose ();
|
||||
Assert.Null (top.MenuBar);
|
||||
Assert.Null (top.StatusBar);
|
||||
//Assert.Null (top.StatusBar);
|
||||
Assert.NotNull (menuBar);
|
||||
Assert.NotNull (statusBar);
|
||||
//Assert.NotNull (statusBar);
|
||||
#if DEBUG_IDISPOSABLE
|
||||
Assert.True (menuBar.WasDisposed);
|
||||
Assert.True (statusBar.WasDisposed);
|
||||
//Assert.True (statusBar.WasDisposed);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1191,14 +1191,14 @@ public partial class ToplevelTests (ITestOutputHelper output)
|
||||
#endif
|
||||
tl.Add (mb, sb);
|
||||
Assert.NotNull (tl.MenuBar);
|
||||
Assert.NotNull (tl.StatusBar);
|
||||
//Assert.NotNull (tl.StatusBar);
|
||||
#if DEBUG
|
||||
Assert.False (mb.WasDisposed);
|
||||
Assert.False (sb.WasDisposed);
|
||||
#endif
|
||||
tl.RemoveAll ();
|
||||
Assert.Null (tl.MenuBar);
|
||||
Assert.Null (tl.StatusBar);
|
||||
//Assert.Null (tl.StatusBar);
|
||||
#if DEBUG
|
||||
Assert.False (mb.WasDisposed);
|
||||
Assert.False (sb.WasDisposed);
|
||||
|
||||
Reference in New Issue
Block a user