|
@@ -23,6 +23,8 @@ public class ToScreenTests (ITestOutputHelper output)
|
|
public void FrameToScreen_NoSuperView (int frameX, int frameY, int expectedScreenX, int expectedScreenY)
|
|
public void FrameToScreen_NoSuperView (int frameX, int frameY, int expectedScreenX, int expectedScreenY)
|
|
{
|
|
{
|
|
var view = new View { X = frameX, Y = frameY, Width = 10, Height = 10 };
|
|
var view = new View { X = frameX, Y = frameY, Width = 10, Height = 10 };
|
|
|
|
+ view.Layout ();
|
|
|
|
+
|
|
var expected = new Rectangle (expectedScreenX, expectedScreenY, 10, 10);
|
|
var expected = new Rectangle (expectedScreenX, expectedScreenY, 10, 10);
|
|
Rectangle actual = view.FrameToScreen ();
|
|
Rectangle actual = view.FrameToScreen ();
|
|
Assert.Equal (expected, actual);
|
|
Assert.Equal (expected, actual);
|
|
@@ -48,6 +50,8 @@ public class ToScreenTests (ITestOutputHelper output)
|
|
|
|
|
|
var view = new View { X = frameX, Y = frameY, Width = 10, Height = 10 };
|
|
var view = new View { X = frameX, Y = frameY, Width = 10, Height = 10 };
|
|
super.Add (view);
|
|
super.Add (view);
|
|
|
|
+ super.Layout ();
|
|
|
|
+
|
|
var expected = new Rectangle (expectedScreenX, expectedScreenY, 10, 10);
|
|
var expected = new Rectangle (expectedScreenX, expectedScreenY, 10, 10);
|
|
Rectangle actual = view.FrameToScreen ();
|
|
Rectangle actual = view.FrameToScreen ();
|
|
Assert.Equal (expected, actual);
|
|
Assert.Equal (expected, actual);
|
|
@@ -337,6 +341,7 @@ public class ToScreenTests (ITestOutputHelper output)
|
|
Width = 10,
|
|
Width = 10,
|
|
Height = 10
|
|
Height = 10
|
|
};
|
|
};
|
|
|
|
+ view.Layout ();
|
|
view.SetContentSize (new (20, 20));
|
|
view.SetContentSize (new (20, 20));
|
|
|
|
|
|
Point testPoint = new (0, 0);
|
|
Point testPoint = new (0, 0);
|
|
@@ -633,10 +638,12 @@ public class ToScreenTests (ITestOutputHelper output)
|
|
Height = 10,
|
|
Height = 10,
|
|
ViewportSettings = ViewportSettings.AllowNegativeLocation
|
|
ViewportSettings = ViewportSettings.AllowNegativeLocation
|
|
};
|
|
};
|
|
|
|
+ view.Layout ();
|
|
|
|
|
|
Rectangle testRect = new Rectangle (0, 0, 1, 1);
|
|
Rectangle testRect = new Rectangle (0, 0, 1, 1);
|
|
Assert.Equal (new Point (0, 0), view.ViewportToScreen (testRect).Location);
|
|
Assert.Equal (new Point (0, 0), view.ViewportToScreen (testRect).Location);
|
|
view.Viewport = view.Viewport with { Location = new Point (1, 1) };
|
|
view.Viewport = view.Viewport with { Location = new Point (1, 1) };
|
|
|
|
+
|
|
Assert.Equal (new Rectangle (1, 1, 10, 10), view.Viewport);
|
|
Assert.Equal (new Rectangle (1, 1, 10, 10), view.Viewport);
|
|
Assert.Equal (new Point (0, 0), view.ViewportToScreen (testRect).Location);
|
|
Assert.Equal (new Point (0, 0), view.ViewportToScreen (testRect).Location);
|
|
}
|
|
}
|
|
@@ -654,6 +661,7 @@ public class ToScreenTests (ITestOutputHelper output)
|
|
|
|
|
|
var view = new View ();
|
|
var view = new View ();
|
|
view.Frame = frame;
|
|
view.Frame = frame;
|
|
|
|
+ view.Layout ();
|
|
|
|
|
|
// Act
|
|
// Act
|
|
var screen = view.ViewportToScreen (new Point (viewportX, 0));
|
|
var screen = view.ViewportToScreen (new Point (viewportX, 0));
|