public void Contains() { Rect2 rect = new Rect2(10, 20, 50, 30); Assert.True(rect.Contains(rect.Center)); Assert.True(rect.ToCorners().All(x => rect.Contains(x))); Assert.False(rect.Contains(rect.CenterX, 0)); Assert.False(rect.Contains(rect.CenterX, 100)); Assert.False(rect.Contains(100, rect.CenterY)); Assert.False(rect.Contains(-50, rect.CenterY)); }
public HitResult HitTest(Win2DRenderNode renderNode, Vector2 hitPosition) { return(renderBounds.Contains(hitPosition) ? new HitResult(renderNode, HitTarget.ExpandButton) : null); }
public void Contains_TooBottom_ReturnsFalse() { Rect2 rect = new Rect2(400, 400, 400, 400); Assert.False(rect.Contains(new Rect2(300, 900, 300, 100))); }
public void Contains_TooRight_ReturnsFalse() { Rect2 rect = new Rect2(400, 400, 400, 400); Assert.False(rect.Contains(new Rect2(900, 200, 100, 300))); }
public void Contains_InsideRect_ReturnsTrue() { Rect2 rect = new Rect2(400, 400, 400, 400); Assert.True(rect.Contains(new Rect2(500, 500, 200, 200))); }