Пример #1
0
    public void TestWindowDragging() {
      WindowControl window = new WindowControl();
      window.Bounds = new UniRectangle(10, 10, 100, 100);

      window.ProcessMouseMove(100, 100, 50, 50);
      window.ProcessMousePress(MouseButtons.Left);
      window.ProcessMouseMove(100, 100, 60, 50);

      Assert.AreEqual(20, window.Bounds.Location.X.Offset);

      window.ProcessMouseMove(100, 100, 40, 40);

      Assert.AreEqual(0, window.Bounds.Location.X.Offset);
      Assert.AreEqual(0, window.Bounds.Location.Y.Offset);

      window.ProcessMouseRelease(MouseButtons.Left);
      window.ProcessMouseMove(100, 100, 70, 70);

      Assert.AreEqual(0, window.Bounds.Location.X.Offset);
      Assert.AreEqual(0, window.Bounds.Location.Y.Offset);
    }
Пример #2
0
        public void TestWindowDragging()
        {
            WindowControl window = new WindowControl();

            window.Bounds = new UniRectangle(10, 10, 100, 100);

            window.ProcessMouseMove(100, 100, 50, 50);
            window.ProcessMousePress(MouseButtons.Left);
            window.ProcessMouseMove(100, 100, 60, 50);

            Assert.AreEqual(20, window.Bounds.Location.X.Offset);

            window.ProcessMouseMove(100, 100, 40, 40);

            Assert.AreEqual(0, window.Bounds.Location.X.Offset);
            Assert.AreEqual(0, window.Bounds.Location.Y.Offset);

            window.ProcessMouseRelease(MouseButtons.Left);
            window.ProcessMouseMove(100, 100, 70, 70);

            Assert.AreEqual(0, window.Bounds.Location.X.Offset);
            Assert.AreEqual(0, window.Bounds.Location.Y.Offset);
        }
Пример #3
0
        public void DisableDragging()
        {
            WindowControl window = new WindowControl();

            window.Bounds = new UniRectangle(10, 10, 100, 100);

            // By default, dragging should be enabled
            Assert.IsTrue(window.EnableDragging);

            // Turn it off
            window.EnableDragging = false;

            // Now it should be off ;-)
            Assert.IsFalse(window.EnableDragging);

            // Try to drag the window
            window.ProcessMouseMove(100, 100, 50, 50);
            window.ProcessMousePress(MouseButtons.Left);
            window.ProcessMouseMove(100, 100, 60, 50);

            // Make sure the window has not moved
            Assert.AreEqual(10, window.Bounds.Location.X.Offset);
        }
Пример #4
0
    public void DisableDragging() {
      WindowControl window = new WindowControl();
      window.Bounds = new UniRectangle(10, 10, 100, 100);

      // By default, dragging should be enabled
      Assert.IsTrue(window.EnableDragging);

      // Turn it off
      window.EnableDragging = false;

      // Now it should be off ;-)
      Assert.IsFalse(window.EnableDragging);

      // Try to drag the window
      window.ProcessMouseMove(100, 100, 50, 50);
      window.ProcessMousePress(MouseButtons.Left);
      window.ProcessMouseMove(100, 100, 60, 50);

      // Make sure the window has not moved
      Assert.AreEqual(10, window.Bounds.Location.X.Offset);
    }