public void TestDragging() { DummyDraggableControl dummy = new DummyDraggableControl(); dummy.Bounds = new UniRectangle(10, 10, 100, 100); dummy.ProcessMouseMove(100, 100, 50, 50); dummy.ProcessMousePress(MouseButtons.Left); dummy.ProcessMouseMove(100, 100, 60, 50); Assert.AreEqual(20, dummy.Bounds.Location.X.Offset); dummy.ProcessMouseMove(100, 100, 40, 40); Assert.AreEqual(0, dummy.Bounds.Location.X.Offset); Assert.AreEqual(0, dummy.Bounds.Location.Y.Offset); dummy.ProcessMouseRelease(MouseButtons.Left); dummy.ProcessMouseMove(100, 100, 70, 70); Assert.AreEqual(0, dummy.Bounds.Location.X.Offset); Assert.AreEqual(0, dummy.Bounds.Location.Y.Offset); }
public void TestDragging() { DummyDraggableControl dummy = new DummyDraggableControl(); dummy.Bounds = new UniRectangle(10, 10, 100, 100); dummy.ProcessMouseMove(100, 100, 50, 50); dummy.ProcessMousePress(MouseButtons.Left); dummy.ProcessMouseMove(100, 100, 60, 50); Assert.AreEqual(20, dummy.Bounds.Location.X.Offset); dummy.ProcessMouseMove(100, 100, 40, 40); Assert.AreEqual(0, dummy.Bounds.Location.X.Offset); Assert.AreEqual(0, dummy.Bounds.Location.Y.Offset); dummy.ProcessMouseRelease(MouseButtons.Left); dummy.ProcessMouseMove(100, 100, 70, 70); Assert.AreEqual(0, dummy.Bounds.Location.X.Offset); Assert.AreEqual(0, dummy.Bounds.Location.Y.Offset); }
public void DisableDragging() { DummyDraggableControl dummy = new DummyDraggableControl(); dummy.Bounds = new UniRectangle(10, 10, 100, 100); // By default, dragging should be enabled Assert.IsTrue(dummy.EnableDragging); // Turn it off dummy.EnableDragging = false; // Now it should be off ;-) Assert.IsFalse(dummy.EnableDragging); // Try to drag the window dummy.ProcessMouseMove(100, 100, 50, 50); dummy.ProcessMousePress(MouseButtons.Left); dummy.ProcessMouseMove(100, 100, 60, 50); // Make sure the window has not moved Assert.AreEqual(10, dummy.Bounds.Location.X.Offset); }
public void TestFullConstructor() { DummyDraggableControl dummy = new DummyDraggableControl(true); Assert.IsTrue(dummy.AffectsOrdering); }
public void TestDefaultConstructor() { DummyDraggableControl dummy = new DummyDraggableControl(); Assert.IsFalse(dummy.AffectsOrdering); }
public void TestFullConstructor() { DummyDraggableControl dummy = new DummyDraggableControl(true); Assert.IsTrue(dummy.AffectsOrdering); }
public void TestDefaultConstructor() { DummyDraggableControl dummy = new DummyDraggableControl(); Assert.IsFalse(dummy.AffectsOrdering); }
public void DisableDragging() { DummyDraggableControl dummy = new DummyDraggableControl(); dummy.Bounds = new UniRectangle(10, 10, 100, 100); // By default, dragging should be enabled Assert.IsTrue(dummy.EnableDragging); // Turn it off dummy.EnableDragging = false; // Now it should be off ;-) Assert.IsFalse(dummy.EnableDragging); // Try to drag the window dummy.ProcessMouseMove(100, 100, 50, 50); dummy.ProcessMousePress(MouseButtons.Left); dummy.ProcessMouseMove(100, 100, 60, 50); // Make sure the window has not moved Assert.AreEqual(10, dummy.Bounds.Location.X.Offset); }