public void SetDisplayRectLocation_InvokeWithHandle_Success(bool autoScroll, int x, int y, Rectangle expectedDisplayRectangle, Rectangle expectedBounds) { var control = new SubScrollableControl { AutoScroll = autoScroll, ClientSize = new Size(70, 80) }; // Without child. control.SetDisplayRectLocation(x, y); Assert.Equal(new Rectangle(0, 0, 70, 80), control.DisplayRectangle); Assert.Equal(Point.Empty, control.AutoScrollPosition); // With child. var child = new LargeControl(); control.Controls.Add(child); Assert.Equal(new Rectangle(0, 0, 100, 150), child.Bounds); // With created handle. Assert.NotEqual(IntPtr.Zero, child.Handle); control.SetDisplayRectLocation(x, y); Assert.Equal(expectedDisplayRectangle, control.DisplayRectangle); Assert.Equal(expectedDisplayRectangle.Location, control.AutoScrollPosition); Assert.Equal(expectedBounds, child.Bounds); }
public void SetDisplayRectLocation_Invoke_Success(bool autoScroll, int width, int height, int scrollX, int scrollY, Point expectedDisplayRectangleLocation, Size expectedDisplayRectangleSize) { var control = new SubScrollableControl { AutoScroll = autoScroll, ClientSize = new Size(width, height) }; // Without child. control.SetDisplayRectLocation(scrollX, scrollY); Assert.Equal(new Rectangle(0, 0, width, height), control.DisplayRectangle); Assert.Equal(Point.Empty, control.AutoScrollPosition); // With child. var child = new LargeControl(); control.Controls.Add(child); Assert.Equal(child.ExpectedSize, child.Bounds); control.SetDisplayRectLocation(scrollX, scrollY); Assert.Equal(expectedDisplayRectangleSize, control.DisplayRectangle.Size); Assert.Equal(expectedDisplayRectangleLocation, control.DisplayRectangle.Location); Assert.Equal(expectedDisplayRectangleLocation, control.AutoScrollPosition); Assert.Equal(child.ExpectedSize, child.Bounds); }