Ejemplo n.º 1
0
        public void TestMoveCaretByMouseWithoutLocator()
        {
            Screen       screen = new Screen(100, 100);
            InputControl input  = new InputControl();

            input.Bounds = new UniRectangle(10, 10, 100, 100);
            screen.Desktop.Children.Add(input);

            input.Text          = "Hello World";
            input.CaretPosition = 0;

            // This should move the caret. Because the control has no locator and it
            // doesn't know which font is being used (controls have no connection to
            // their rendering code), it can only move the caret to the end.
            input.ProcessMouseMove(100, 100, 50, 50);
            input.ProcessMousePress(MouseButtons.Left);

            Assert.AreEqual(input.Text.Length, input.CaretPosition);
        }
Ejemplo n.º 2
0
        public void TestMoveCaretByMouseWitLocator()
        {
            Screen       screen = new Screen(100, 100);
            InputControl input  = new InputControl();

            input.Bounds = new UniRectangle(10, 10, 100, 100);
            screen.Desktop.Children.Add(input);

            input.Text          = "Hello World";
            input.CaretPosition = 0;

            // Assign a dummy locator for text openings which will always report that
            // the mouse is between the 4th and 5th letters.
            input.OpeningLocator = new DummyLocator(4);

            // This should move the caret. Because the dummy locator is assigned, it
            // should be asked for the position the user has clicked on.
            input.ProcessMouseMove(100, 100, 50, 50);
            input.ProcessMousePress(MouseButtons.Left);

            Assert.AreEqual(4, input.CaretPosition);
        }
Ejemplo n.º 3
0
    public void TestMoveCaretByMouseWitLocator() {
      Screen screen = new Screen(100, 100);
      InputControl input = new InputControl();
      input.Bounds = new UniRectangle(10, 10, 100, 100);
      screen.Desktop.Children.Add(input);

      input.Text = "Hello World";
      input.CaretPosition = 0;

      // Assign a dummy locator for text openings which will always report that
      // the mouse is between the 4th and 5th letters.
      input.OpeningLocator = new DummyLocator(4);

      // This should move the caret. Because the dummy locator is assigned, it
      // should be asked for the position the user has clicked on.
      input.ProcessMouseMove(100, 100, 50, 50);
      input.ProcessMousePress(MouseButtons.Left);

      Assert.AreEqual(4, input.CaretPosition);
    }
Ejemplo n.º 4
0
    public void TestMoveCaretByMouseWithoutLocator() {
      Screen screen = new Screen(100, 100);
      InputControl input = new InputControl();
      input.Bounds = new UniRectangle(10, 10, 100, 100);
      screen.Desktop.Children.Add(input);

      input.Text = "Hello World";
      input.CaretPosition = 0;

      // This should move the caret. Because the control has no locator and it
      // doesn't know which font is being used (controls have no connection to
      // their rendering code), it can only move the caret to the end.      
      input.ProcessMouseMove(100, 100, 50, 50);
      input.ProcessMousePress(MouseButtons.Left);

      Assert.AreEqual(input.Text.Length, input.CaretPosition);
    }