public void CanGetPositionWithAnchor(Anchor2d anchor, float expectedX, float expectedY) { var rect = new Rect2d(X, Y, W, H); var pos = rect.GetAnchorPosition(anchor); DolphAssert.EqualF(expectedX, pos.X); DolphAssert.EqualF(expectedY, pos.Y); }
public void CanGetPositionAtOrigin() { var anchor = Anchor2d.MiddleRight; var rect = new Rect2d(100, 200, 300, 400, anchor); var pos1 = rect.GetAnchorPosition(anchor); var pos2 = rect.GetOriginPosition(); Assert.Equal(pos1, pos2); }
public void CanSetPositionWithAnchor(Anchor2d anchor, float expectedTopLeftX, float expectedTopLeftY) { var rect = new Rect2d(X, Y, W, H, anchor); foreach (var kvp in RpMap) { var getAnchor = kvp.Key; var rp = kvp.Value; var pos = rect.GetAnchorPosition(getAnchor); DolphAssert.EqualF(rp.X(expectedTopLeftX), pos.X); DolphAssert.EqualF(rp.Y(expectedTopLeftY), pos.Y); } }