|
@@ -254,82 +254,82 @@ public class PosTests (ITestOutputHelper output)
|
|
|
[TestRespondersDisposed]
|
|
|
public void LeftTopBottomRight_Win_ShouldNotThrow ()
|
|
|
{
|
|
|
- // Setup Fake driver
|
|
|
- (Toplevel top, Window win, Button button) setup ()
|
|
|
- {
|
|
|
- Application.Init (new FakeDriver ());
|
|
|
- Application.Iteration += (s, a) => { Application.RequestStop (); };
|
|
|
- var win = new Window { X = 0, Y = 0, Width = Dim.Fill (), Height = Dim.Fill () };
|
|
|
- var top = new Toplevel ();
|
|
|
- top.Add (win);
|
|
|
-
|
|
|
- var button = new Button { X = Pos.Center (), Text = "button" };
|
|
|
- win.Add (button);
|
|
|
-
|
|
|
- return (top, win, button);
|
|
|
- }
|
|
|
-
|
|
|
- RunState rs;
|
|
|
-
|
|
|
- void cleanup (RunState rs)
|
|
|
- {
|
|
|
- // Cleanup
|
|
|
- Application.End (rs);
|
|
|
-
|
|
|
- Application.Top.Dispose ();
|
|
|
-
|
|
|
- // Shutdown must be called to safely clean up Application if Init has been called
|
|
|
- Application.Shutdown ();
|
|
|
- }
|
|
|
-
|
|
|
// Test cases:
|
|
|
- (Toplevel top, Window win, Button button) app = setup ();
|
|
|
+ (Toplevel top, Window win, Button button) app = Setup ();
|
|
|
app.button.Y = Pos.Left (app.win);
|
|
|
- rs = Application.Begin (app.top);
|
|
|
+ RunState rs = Application.Begin (app.top);
|
|
|
|
|
|
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
|
|
Application.RunLoop (rs);
|
|
|
- cleanup (rs);
|
|
|
+ Cleanup (rs);
|
|
|
|
|
|
- app = setup ();
|
|
|
+ app = Setup ();
|
|
|
app.button.Y = Pos.X (app.win);
|
|
|
rs = Application.Begin (app.top);
|
|
|
|
|
|
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
|
|
Application.RunLoop (rs);
|
|
|
- cleanup (rs);
|
|
|
+ Cleanup (rs);
|
|
|
|
|
|
- app = setup ();
|
|
|
+ app = Setup ();
|
|
|
app.button.Y = Pos.Top (app.win);
|
|
|
rs = Application.Begin (app.top);
|
|
|
|
|
|
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
|
|
Application.RunLoop (rs);
|
|
|
- cleanup (rs);
|
|
|
+ Cleanup (rs);
|
|
|
|
|
|
- app = setup ();
|
|
|
+ app = Setup ();
|
|
|
app.button.Y = Pos.Y (app.win);
|
|
|
rs = Application.Begin (app.top);
|
|
|
|
|
|
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
|
|
Application.RunLoop (rs);
|
|
|
- cleanup (rs);
|
|
|
+ Cleanup (rs);
|
|
|
|
|
|
- app = setup ();
|
|
|
+ app = Setup ();
|
|
|
app.button.Y = Pos.Bottom (app.win);
|
|
|
rs = Application.Begin (app.top);
|
|
|
|
|
|
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
|
|
Application.RunLoop (rs);
|
|
|
- cleanup (rs);
|
|
|
+ Cleanup (rs);
|
|
|
|
|
|
- app = setup ();
|
|
|
+ app = Setup ();
|
|
|
app.button.Y = Pos.Right (app.win);
|
|
|
rs = Application.Begin (app.top);
|
|
|
|
|
|
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
|
|
Application.RunLoop (rs);
|
|
|
- cleanup (rs);
|
|
|
+ Cleanup (rs);
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+ void Cleanup (RunState rs)
|
|
|
+ {
|
|
|
+ // Cleanup
|
|
|
+ Application.End (rs);
|
|
|
+
|
|
|
+ Application.Top.Dispose ();
|
|
|
+
|
|
|
+ // Shutdown must be called to safely clean up Application if Init has been called
|
|
|
+ Application.Shutdown ();
|
|
|
+ }
|
|
|
+
|
|
|
+ // Setup Fake driver
|
|
|
+ (Toplevel top, Window win, Button button) Setup ()
|
|
|
+ {
|
|
|
+ Application.Init (new FakeDriver ());
|
|
|
+ Application.Iteration += (s, a) => { Application.RequestStop (); };
|
|
|
+ var win = new Window { X = 0, Y = 0, Width = Dim.Fill (), Height = Dim.Fill () };
|
|
|
+ var top = new Toplevel ();
|
|
|
+ top.Add (win);
|
|
|
+
|
|
|
+ var button = new Button { X = Pos.Center (), Text = "button" };
|
|
|
+ win.Add (button);
|
|
|
+
|
|
|
+ return (top, win, button);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
[Fact]
|