ScreenToFrame -> Point

This commit is contained in:
Tig
2024-05-08 15:02:47 -06:00
parent f3ed17227d
commit 37a1464c7c
8 changed files with 38 additions and 36 deletions

View File

@@ -198,7 +198,7 @@ public class ScreenToTests
BorderStyle = LineStyle.Single
};
Point actual = view.ScreenToFrame (x, y);
Point actual = view.ScreenToFrame (new (x, y));
Assert.Equal (expectedX, actual.X);
Assert.Equal (expectedY, actual.Y);
}
@@ -220,7 +220,7 @@ public class ScreenToTests
{
var view = new View { X = viewX, Y = viewY, Width = 10, Height = 10 };
Point actual = view.ScreenToFrame (x, y);
Point actual = view.ScreenToFrame (new (x, y));
Assert.Equal (expectedX, actual.X);
Assert.Equal (expectedY, actual.Y);
}
@@ -248,7 +248,7 @@ public class ScreenToTests
var view = new View { X = viewX, Y = viewY, Width = 5, Height = 5 };
super.Add (view);
Point actual = view.ScreenToFrame (x, y);
Point actual = view.ScreenToFrame (new (x, y));
Assert.Equal (expectedX, actual.X);
Assert.Equal (expectedY, actual.Y);
}
@@ -269,7 +269,7 @@ public class ScreenToTests
var view = new View { X = viewX, Y = viewY, Width = 5, Height = 5 };
super.Add (view);
Point actual = view.ScreenToFrame (x, y);
Point actual = view.ScreenToFrame (new (x, y));
Assert.Equal (expectedX, actual.X);
Assert.Equal (expectedY, actual.Y);
}

View File

@@ -851,7 +851,7 @@ public class NavigationTests
);
// top
Assert.Equal (Point.Empty, top.ScreenToFrame (0, 0));
Assert.Equal (Point.Empty, top.ScreenToFrame (new (0, 0)));
Rectangle screen = top.Margin.ViewportToScreen (new (0, 0, 0, 0));
Assert.Equal (0, screen.X);
Assert.Equal (0, screen.Y);
@@ -872,7 +872,7 @@ public class NavigationTests
Assert.Equal (0, found.Frame.X);
Assert.Equal (0, found.Frame.Y);
Assert.Equal (new Point (3, 2), top.ScreenToFrame (3, 2));
Assert.Equal (new Point (3, 2), top.ScreenToFrame (new (3, 2)));
screen = top.ViewportToScreen (new (3, 2, 0, 0));
Assert.Equal (4, screen.X);
Assert.Equal (3, screen.Y);
@@ -884,7 +884,7 @@ public class NavigationTests
Assert.Equal (top, found);
//Assert.Equal (3, found.FrameToScreen ().X);
//Assert.Equal (2, found.FrameToScreen ().Y);
Assert.Equal (new Point (13, 2), top.ScreenToFrame (13, 2));
Assert.Equal (new Point (13, 2), top.ScreenToFrame (new (13, 2)));
screen = top.ViewportToScreen (new (12, 2, 0, 0));
Assert.Equal (13, screen.X);
Assert.Equal (3, screen.Y);
@@ -899,7 +899,7 @@ public class NavigationTests
Assert.Equal (top, found);
//Assert.Equal (13, found.FrameToScreen ().X);
//Assert.Equal (2, found.FrameToScreen ().Y);
Assert.Equal (new Point (14, 3), top.ScreenToFrame (14, 3));
Assert.Equal (new Point (14, 3), top.ScreenToFrame (new (14, 3)));
screen = top.ViewportToScreen (new (14, 3, 0, 0));
Assert.Equal (15, screen.X);
Assert.Equal (4, screen.Y);
@@ -909,7 +909,7 @@ public class NavigationTests
//Assert.Equal (3, found.FrameToScreen ().Y);
// view
Assert.Equal (new Point (-4, -3), view.ScreenToFrame (0, 0));
Assert.Equal (new Point (-4, -3), view.ScreenToFrame (new (0, 0)));
screen = view.Margin.ViewportToScreen (new (-3, -2, 0, 0));
Assert.Equal (1, screen.X);
Assert.Equal (1, screen.Y);
@@ -928,21 +928,21 @@ public class NavigationTests
found = View.FindDeepestView (top, 0, 0);
Assert.Equal (top.Border, found);
Assert.Equal (new Point (-1, -1), view.ScreenToFrame (3, 2));
Assert.Equal (new Point (-1, -1), view.ScreenToFrame (new (3, 2)));
screen = view.ViewportToScreen (new (0, 0, 0, 0));
Assert.Equal (4, screen.X);
Assert.Equal (3, screen.Y);
found = View.FindDeepestView (top, 4, 3);
Assert.Equal (view, found);
Assert.Equal (new Point (9, -1), view.ScreenToFrame (13, 2));
Assert.Equal (new Point (9, -1), view.ScreenToFrame (new (13, 2)));
screen = view.ViewportToScreen (new (10, 0, 0, 0));
Assert.Equal (14, screen.X);
Assert.Equal (3, screen.Y);
found = View.FindDeepestView (top, 14, 3);
Assert.Equal (top, found);
Assert.Equal (new Point (10, 0), view.ScreenToFrame (14, 3));
Assert.Equal (new Point (10, 0), view.ScreenToFrame (new (14, 3)));
screen = view.ViewportToScreen (new (11, 1, 0, 0));
Assert.Equal (15, screen.X);
Assert.Equal (4, screen.Y);
@@ -1005,7 +1005,7 @@ public class NavigationTests
Assert.Equal (new Rectangle (3, 2, 23, 10), frame);
// top
Assert.Equal (new Point (-3, -2), top.ScreenToFrame (0, 0));
Assert.Equal (new Point (-3, -2), top.ScreenToFrame (new (0, 0)));
Rectangle screen = top.Margin.ViewportToScreen (new (-3, -2, 0, 0));
Assert.Equal (0, screen.X);
Assert.Equal (0, screen.Y);
@@ -1023,28 +1023,28 @@ public class NavigationTests
Assert.Equal (0, screen.Y);
var found = View.FindDeepestView (top, -4, -3);
Assert.Null (found);
Assert.Equal (Point.Empty, top.ScreenToFrame (3, 2));
Assert.Equal (Point.Empty, top.ScreenToFrame (new (3, 2)));
screen = top.ViewportToScreen (new (0, 0, 0, 0));
Assert.Equal (4, screen.X);
Assert.Equal (3, screen.Y);
Assert.Equal (top.Border, View.FindDeepestView (top, 3, 2));
//Assert.Equal (0, found.FrameToScreen ().X);
//Assert.Equal (0, found.FrameToScreen ().Y);
Assert.Equal (new Point (10, 0), top.ScreenToFrame (13, 2));
Assert.Equal (new Point (10, 0), top.ScreenToFrame (new (13, 2)));
screen = top.ViewportToScreen (new (10, 0, 0, 0));
Assert.Equal (14, screen.X);
Assert.Equal (3, screen.Y);
Assert.Equal (top.Border, View.FindDeepestView (top, 13, 2));
//Assert.Equal (10, found.FrameToScreen ().X);
//Assert.Equal (0, found.FrameToScreen ().Y);
Assert.Equal (new Point (11, 1), top.ScreenToFrame (14, 3));
Assert.Equal (new Point (11, 1), top.ScreenToFrame (new (14, 3)));
screen = top.ViewportToScreen (new (11, 1, 0, 0));
Assert.Equal (15, screen.X);
Assert.Equal (4, screen.Y);
Assert.Equal (top, View.FindDeepestView (top, 14, 3));
// view
Assert.Equal (new Point (-7, -5), view.ScreenToFrame (0, 0));
Assert.Equal (new Point (-7, -5), view.ScreenToFrame (new (0, 0)));
screen = view.Margin.ViewportToScreen (new (-6, -4, 0, 0));
Assert.Equal (1, screen.X);
Assert.Equal (1, screen.Y);
@@ -1058,27 +1058,27 @@ public class NavigationTests
Assert.Equal (1, screen.X);
Assert.Equal (1, screen.Y);
Assert.Null (View.FindDeepestView (top, 1, 1));
Assert.Equal (new Point (-4, -3), view.ScreenToFrame (3, 2));
Assert.Equal (new Point (-4, -3), view.ScreenToFrame (new (3, 2)));
screen = view.ViewportToScreen (new (-3, -2, 0, 0));
Assert.Equal (4, screen.X);
Assert.Equal (3, screen.Y);
Assert.Equal (top, View.FindDeepestView (top, 4, 3));
Assert.Equal (new Point (-1, -1), view.ScreenToFrame (6, 4));
Assert.Equal (new Point (-1, -1), view.ScreenToFrame (new (6, 4)));
screen = view.ViewportToScreen (new (0, 0, 0, 0));
Assert.Equal (7, screen.X);
Assert.Equal (5, screen.Y);
Assert.Equal (view, View.FindDeepestView (top, 7, 5));
Assert.Equal (new Point (6, -1), view.ScreenToFrame (13, 4));
Assert.Equal (new Point (6, -1), view.ScreenToFrame (new (13, 4)));
screen = view.ViewportToScreen (new (7, 0, 0, 0));
Assert.Equal (14, screen.X);
Assert.Equal (5, screen.Y);
Assert.Equal (view, View.FindDeepestView (top, 14, 5));
Assert.Equal (new Point (7, -2), view.ScreenToFrame (14, 3));
Assert.Equal (new Point (7, -2), view.ScreenToFrame (new (14, 3)));
screen = view.ViewportToScreen (new (8, -1, 0, 0));
Assert.Equal (15, screen.X);
Assert.Equal (4, screen.Y);
Assert.Equal (top, View.FindDeepestView (top, 15, 4));
Assert.Equal (new Point (16, -2), view.ScreenToFrame (23, 3));
Assert.Equal (new Point (16, -2), view.ScreenToFrame (new (23, 3)));
screen = view.ViewportToScreen (new (17, -1, 0, 0));
Assert.Equal (24, screen.X);
Assert.Equal (4, screen.Y);