コード例 #1
0
        public void TestInjectButtonPress()
        {
            Screen             screen  = new Screen();
            GamePadTestControl control = new GamePadTestControl();

            screen.Desktop.Children.Add(control);

            screen.InjectButtonPress(Buttons.A);
            Assert.AreEqual(1, control.HeldButtonCount);
        }
コード例 #2
0
        public void TestButtonPressWithFocusedControl()
        {
            Screen             screen = new Screen(100.0f, 100.0f);
            GamePadTestControl child1 = new GamePadTestControl();
            GamePadTestControl child2 = new GamePadTestControl();

            screen.Desktop.Children.Add(child1);
            screen.Desktop.Children.Add(child2);

            screen.FocusedControl = child2;

            screen.InjectButtonPress(Buttons.A);
            Assert.AreEqual(0, child1.HeldButtonCount);
            Assert.AreEqual(1, child2.HeldButtonCount);
            screen.InjectButtonRelease(Buttons.A);
            Assert.AreEqual(0, child1.HeldButtonCount);
            Assert.AreEqual(0, child2.HeldButtonCount);
        }
コード例 #3
0
        public void TestButtonPressWithActivatedControl()
        {
            Screen             screen = new Screen(100.0f, 100.0f);
            GamePadTestControl child1 = new GamePadTestControl();
            GamePadTestControl child2 = new GamePadTestControl();

            child2.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);
            screen.Desktop.Children.Add(child1);
            screen.Desktop.Children.Add(child2);

            // Click on child 2
            screen.InjectMouseMove(50.0f, 50.0f);
            screen.InjectMousePress(MouseButtons.Left);

            // Now child 2 should be receiving the input instead of child 1
            screen.InjectButtonPress(Buttons.A);
            Assert.AreEqual(0, child1.HeldButtonCount);
            Assert.AreEqual(1, child2.HeldButtonCount);
            screen.InjectButtonRelease(Buttons.A);
            Assert.AreEqual(0, child1.HeldButtonCount);
            Assert.AreEqual(0, child2.HeldButtonCount);
        }
コード例 #4
0
ファイル: Screen.Test.cs プロジェクト: pr0gramm3r1/AngryTanks
    public void TestButtonPressWithFocusedControl() {
      Screen screen = new Screen(100.0f, 100.0f);
      GamePadTestControl child1 = new GamePadTestControl();
      GamePadTestControl child2 = new GamePadTestControl();
      screen.Desktop.Children.Add(child1);
      screen.Desktop.Children.Add(child2);

      screen.FocusedControl = child2;

      screen.InjectButtonPress(Buttons.A);
      Assert.AreEqual(0, child1.HeldButtonCount);
      Assert.AreEqual(1, child2.HeldButtonCount);
      screen.InjectButtonRelease(Buttons.A);
      Assert.AreEqual(0, child1.HeldButtonCount);
      Assert.AreEqual(0, child2.HeldButtonCount);
    }
コード例 #5
0
ファイル: Screen.Test.cs プロジェクト: pr0gramm3r1/AngryTanks
    public void TestButtonPressWithActivatedControl() {
      Screen screen = new Screen(100.0f, 100.0f);
      GamePadTestControl child1 = new GamePadTestControl();
      GamePadTestControl child2 = new GamePadTestControl();
      child2.Bounds = new UniRectangle(10.0f, 10.0f, 80.0f, 80.0f);
      screen.Desktop.Children.Add(child1);
      screen.Desktop.Children.Add(child2);

      // Click on child 2
      screen.InjectMouseMove(50.0f, 50.0f);
      screen.InjectMousePress(MouseButtons.Left);

      // Now child 2 should be receiving the input instead of child 1
      screen.InjectButtonPress(Buttons.A);
      Assert.AreEqual(0, child1.HeldButtonCount);
      Assert.AreEqual(1, child2.HeldButtonCount);
      screen.InjectButtonRelease(Buttons.A);
      Assert.AreEqual(0, child1.HeldButtonCount);
      Assert.AreEqual(0, child2.HeldButtonCount);
    }
コード例 #6
0
ファイル: Screen.Test.cs プロジェクト: pr0gramm3r1/AngryTanks
    public void TestInjectButtonPress() {
      Screen screen = new Screen();
      GamePadTestControl control = new GamePadTestControl();
      screen.Desktop.Children.Add(control);

      screen.InjectButtonPress(Buttons.A);
      Assert.AreEqual(1, control.HeldButtonCount);
    }