public void TestMouseOver()
        {
            MouseOverTestControl control = new MouseOverTestControl();

            control.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);

            Assert.IsFalse(control.MouseOver);
            control.ProcessMouseMove(100.0f, 100.0f, 20.0f, 20.0f);
            Assert.IsTrue(control.MouseOver);
            control.ProcessMouseMove(100.0f, 100.0f, -1.0f, -1.0f);
            Assert.IsFalse(control.MouseOver);
        }
        public void TestMouseOverWithActivatedControl()
        {
            Control parent = new Control();

            parent.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);
            MouseOverTestControl child = new MouseOverTestControl();

            child.Bounds = new UniRectangle(10.0f, 10.0f, 25.0f, 60.0f);
            parent.Children.Add(child);

            parent.ProcessMouseMove(100.0f, 100.0f, 20.0f, 30.0f);
            Assert.IsTrue(child.MouseOver);

            parent.ProcessMousePress(MouseButtons.Left);
            parent.ProcessMouseMove(100.0f, 100.0f, -1.0f, -1.0f);

            Assert.IsFalse(child.MouseOver);
        }
        public void TestMouseOverChildren()
        {
            Control parent = new Control();

            parent.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);
            MouseOverTestControl child1 = new MouseOverTestControl();

            child1.Bounds = new UniRectangle(10.0f, 10.0f, 25.0f, 60.0f);
            MouseOverTestControl child2 = new MouseOverTestControl();

            child2.Bounds = new UniRectangle(45.0f, 10.0f, 25.0f, 60.0f);

            parent.Children.Add(child1);
            parent.Children.Add(child2);

            Assert.IsFalse(child1.MouseOver);
            Assert.IsFalse(child2.MouseOver);
            parent.ProcessMouseMove(100.0f, 100.0f, 20.0f, 30.0f);
            Assert.IsTrue(child1.MouseOver);
            Assert.IsFalse(child2.MouseOver);
            parent.ProcessMouseMove(100.0f, 100.0f, 60.0f, 30.0f);
            Assert.IsFalse(child1.MouseOver);
            Assert.IsTrue(child2.MouseOver);
        }
Beispiel #4
0
    public void TestMouseOverWithActivatedControl() {
      Control parent = new Control();
      parent.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);
      MouseOverTestControl child = new MouseOverTestControl();
      child.Bounds = new UniRectangle(10.0f, 10.0f, 25.0f, 60.0f);
      parent.Children.Add(child);

      parent.ProcessMouseMove(100.0f, 100.0f, 20.0f, 30.0f);
      Assert.IsTrue(child.MouseOver);

      parent.ProcessMousePress(MouseButtons.Left);
      parent.ProcessMouseMove(100.0f, 100.0f, -1.0f, -1.0f);
      
      Assert.IsFalse(child.MouseOver);
    }
Beispiel #5
0
    public void TestMouseOverChildren() {
      Control parent = new Control();
      parent.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);
      MouseOverTestControl child1 = new MouseOverTestControl();
      child1.Bounds = new UniRectangle(10.0f, 10.0f, 25.0f, 60.0f);
      MouseOverTestControl child2 = new MouseOverTestControl();
      child2.Bounds = new UniRectangle(45.0f, 10.0f, 25.0f, 60.0f);
      
      parent.Children.Add(child1);
      parent.Children.Add(child2);

      Assert.IsFalse(child1.MouseOver);
      Assert.IsFalse(child2.MouseOver);
      parent.ProcessMouseMove(100.0f, 100.0f, 20.0f, 30.0f);
      Assert.IsTrue(child1.MouseOver);
      Assert.IsFalse(child2.MouseOver);
      parent.ProcessMouseMove(100.0f, 100.0f, 60.0f, 30.0f);
      Assert.IsFalse(child1.MouseOver);
      Assert.IsTrue(child2.MouseOver);
    }
Beispiel #6
0
    public void TestMouseOver() {
      MouseOverTestControl control = new MouseOverTestControl();
      control.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);

      Assert.IsFalse(control.MouseOver);      
      control.ProcessMouseMove(100.0f, 100.0f, 20.0f, 20.0f);
      Assert.IsTrue(control.MouseOver);
      control.ProcessMouseMove(100.0f, 100.0f, -1.0f, -1.0f);
      Assert.IsFalse(control.MouseOver);
    }