public void TestRightClickProducesNoAction() { DummySliderControl slider = new DummySliderControl(); slider.Bounds = new UniRectangle(10, 10, 100, 100); slider.ReportedThumbRegion = new RectangleF(10, 20, 100, 20); // Move the mouse over the thumb and do a right-click slider.ProcessMouseMove(100, 100, 50, 30); slider.ProcessMousePress(MouseButtons.Right); Assert.IsFalse(slider.ThumbDepressed); }
public void TestThumbPressing() { DummySliderControl slider = new DummySliderControl(); slider.Bounds = new UniRectangle(10, 10, 100, 100); slider.ReportedThumbRegion = new RectangleF(10, 20, 100, 20); // Move the mouse over the thumb slider.ProcessMouseMove(100, 100, 50, 30); // Press the left mouse button. The thumb should now be depressed. slider.ProcessMousePress(MouseButtons.Left); Assert.IsTrue(slider.ThumbDepressed); // Release the left mouse button. The thumb should have risen again. slider.ProcessMouseRelease(MouseButtons.Left); Assert.IsFalse(slider.ThumbDepressed); }
public void TestThumbDragging() { DummySliderControl slider = new DummySliderControl(); slider.Bounds = new UniRectangle(10, 10, 100, 100); slider.ReportedThumbRegion = new RectangleF(10, 20, 100, 20); // Move the mouse over the thumb, press the left mouse button and drag // it to a new location slider.ProcessMouseMove(100, 100, 50, 30); slider.ProcessMousePress(MouseButtons.Left); slider.ProcessMouseMove(100, 100, 60, 50); // The thumb should now be moved to the new location (these are // absolute coordinates: the slider was at 10, 20 and we moved // the mouse by 10, 20, so now it's at 20, 40) Assert.AreEqual(20.0f, slider.ThumbX); Assert.AreEqual(40.0f, slider.ThumbY); }