Пример #1
0
        public void TestMultiSelectionByMouse()
        {
            Screen      screen = new Screen();
            ListControl list   = new ListControl();

            list.Bounds         = new UniRectangle(10, 10, 100, 100);
            list.SelectionMode  = ListSelectionMode.Multi;
            list.ListRowLocator = new DummyListRowLocator();
            screen.Desktop.Children.Add(list);

            // Put 20 items in the list
            fillList(list, 20);

            Assert.AreEqual(0, list.SelectedItems.Count);

            list.ProcessMouseMove(100, 100, 50, 35);
            list.ProcessMousePress(MouseButtons.Left);
            list.ProcessMouseRelease(MouseButtons.Left);

            Assert.AreEqual(1, list.SelectedItems.Count);
            Assert.AreEqual(2, list.SelectedItems[0]);

            list.ProcessMouseMove(100, 100, 50, 55);
            list.ProcessMousePress(MouseButtons.Left);
            list.ProcessMouseRelease(MouseButtons.Left);

            Assert.AreEqual(2, list.SelectedItems.Count);
            Assert.AreEqual(2, list.SelectedItems[0]);
            Assert.AreEqual(4, list.SelectedItems[1]);

            list.ProcessMouseMove(100, 100, 50, 35);
            list.ProcessMousePress(MouseButtons.Left);
            list.ProcessMouseRelease(MouseButtons.Left);

            Assert.AreEqual(1, list.SelectedItems.Count);
            Assert.AreEqual(4, list.SelectedItems[0]);
        }
Пример #2
0
        public void TestSingleSelectionByMouse()
        {
            Screen      screen = new Screen();
            ListControl list   = new ListControl();

            list.Bounds         = new UniRectangle(10, 10, 100, 100);
            list.SelectionMode  = ListSelectionMode.Single;
            list.ListRowLocator = new DummyListRowLocator();
            screen.Desktop.Children.Add(list);

            // Put 20 items in the list
            fillList(list, 20);

            // At the beginning, no items should be selected
            Assert.AreEqual(0, list.SelectedItems.Count);

            // Click on item 2 and verify that it is now selected
            list.ProcessMouseMove(100, 100, 50, 35);
            list.ProcessMousePress(MouseButtons.Left);
            list.ProcessMouseRelease(MouseButtons.Left);
            Assert.AreEqual(1, list.SelectedItems.Count);
            Assert.AreEqual(2, list.SelectedItems[0]);

            // Now click on item 4, which should unselect item 2 and select item 4
            list.ProcessMouseMove(100, 100, 50, 55);
            list.ProcessMousePress(MouseButtons.Left);
            list.ProcessMouseRelease(MouseButtons.Left);
            Assert.AreEqual(1, list.SelectedItems.Count);
            Assert.AreEqual(4, list.SelectedItems[0]);

            // Repeat the click on item 4, nothing should happen
            list.ProcessMouseMove(100, 100, 50, 55);
            list.ProcessMousePress(MouseButtons.Left);
            list.ProcessMouseRelease(MouseButtons.Left);
            Assert.AreEqual(1, list.SelectedItems.Count);
            Assert.AreEqual(4, list.SelectedItems[0]);
        }
Пример #3
0
    public void TestMultiSelectionByMouse() {
      Screen screen = new Screen();
      ListControl list = new ListControl();
      list.Bounds = new UniRectangle(10, 10, 100, 100);
      list.SelectionMode = ListSelectionMode.Multi;
      list.ListRowLocator = new DummyListRowLocator();
      screen.Desktop.Children.Add(list);

      // Put 20 items in the list
      fillList(list, 20);

      Assert.AreEqual(0, list.SelectedItems.Count);

      list.ProcessMouseMove(100, 100, 50, 35);
      list.ProcessMousePress(MouseButtons.Left);
      list.ProcessMouseRelease(MouseButtons.Left);

      Assert.AreEqual(1, list.SelectedItems.Count);
      Assert.AreEqual(2, list.SelectedItems[0]);

      list.ProcessMouseMove(100, 100, 50, 55);
      list.ProcessMousePress(MouseButtons.Left);
      list.ProcessMouseRelease(MouseButtons.Left);

      Assert.AreEqual(2, list.SelectedItems.Count);
      Assert.AreEqual(2, list.SelectedItems[0]);
      Assert.AreEqual(4, list.SelectedItems[1]);

      list.ProcessMouseMove(100, 100, 50, 35);
      list.ProcessMousePress(MouseButtons.Left);
      list.ProcessMouseRelease(MouseButtons.Left);

      Assert.AreEqual(1, list.SelectedItems.Count);
      Assert.AreEqual(4, list.SelectedItems[0]);
    }
Пример #4
0
    public void TestSingleSelectionByMouse() {
      Screen screen = new Screen();
      ListControl list = new ListControl();
      list.Bounds = new UniRectangle(10, 10, 100, 100);
      list.SelectionMode = ListSelectionMode.Single;
      list.ListRowLocator = new DummyListRowLocator();
      screen.Desktop.Children.Add(list);

      // Put 20 items in the list
      fillList(list, 20);

      // At the beginning, no items should be selected
      Assert.AreEqual(0, list.SelectedItems.Count);

      // Click on item 2 and verify that it is now selected
      list.ProcessMouseMove(100, 100, 50, 35);
      list.ProcessMousePress(MouseButtons.Left);
      list.ProcessMouseRelease(MouseButtons.Left);
      Assert.AreEqual(1, list.SelectedItems.Count);
      Assert.AreEqual(2, list.SelectedItems[0]);

      // Now click on item 4, which should unselect item 2 and select item 4
      list.ProcessMouseMove(100, 100, 50, 55);
      list.ProcessMousePress(MouseButtons.Left);
      list.ProcessMouseRelease(MouseButtons.Left);
      Assert.AreEqual(1, list.SelectedItems.Count);
      Assert.AreEqual(4, list.SelectedItems[0]);

      // Repeat the click on item 4, nothing should happen
      list.ProcessMouseMove(100, 100, 50, 55);
      list.ProcessMousePress(MouseButtons.Left);
      list.ProcessMouseRelease(MouseButtons.Left);
      Assert.AreEqual(1, list.SelectedItems.Count);
      Assert.AreEqual(4, list.SelectedItems[0]);
    }