Ejemplo n.º 1
0
        [Test] public void RowBounds()
        {
            _nodeCollection.Add("Test");
            _nodeCollection.Add("Test2");
            _groupProvider.SetGroup("Test2", "Test");

            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode groupHeaderNode = (GroupHeaderNode)enumerator.Current;

            enumerator.MoveNext();
            JetListViewNode testNode = (JetListViewNode)enumerator.Current;

            enumerator.MoveNext();
            JetListViewNode test2Node = (JetListViewNode)enumerator.Current;

            int startY, endY;

            Assert.IsTrue(_rowListRenderer.GetRowBounds(groupHeaderNode, out startY, out endY));
            Assert.AreEqual(0, startY);
            Assert.AreEqual(10, endY);

            Assert.IsTrue(_rowListRenderer.GetRowBounds(testNode, out startY, out endY));
            Assert.AreEqual(10, startY);
            Assert.AreEqual(30, endY);

            Assert.IsTrue(_rowListRenderer.GetRowBounds(test2Node, out startY, out endY));
            Assert.AreEqual(30, startY);
            Assert.AreEqual(50, endY);
        }
Ejemplo n.º 2
0
        [Test] public void TopNodeOverwrite()
        {
            _nodeCollection.Add("Test");
            _nodeCollection.Add("Test2");
            _groupProvider.SetGroup("Test2", "Test");

            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode groupHeaderNode = (GroupHeaderNode)enumerator.Current;

            enumerator.MoveNext();
            JetListViewNode testNode = (JetListViewNode)enumerator.Current;

            enumerator.MoveNext();
            JetListViewNode test2Node = (JetListViewNode)enumerator.Current;

            enumerator = _groupCollection.GetDirectionalEnumerator(test2Node, MoveDirection.Down);
            // this could overwrite top node of group to test2Node, and subsequent iteration would
            // return incorrect results
            enumerator.MoveNext();

            enumerator = _groupCollection.GetDirectionalEnumerator(groupHeaderNode, MoveDirection.Down);
            VerifyGroupHeader(enumerator, "Test", true);
            VerifyNode(enumerator, "Test");
        }
Ejemplo n.º 3
0
        private void VerifyGroupHeader(IEnumerator enumerator, string text, bool expanded)
        {
            Assert.IsTrue(enumerator.MoveNext(), "Expected group header but found end of enumeration");
            Assert.IsNotNull(enumerator.Current, "Expected group header but found null");
            GroupHeaderNode headerNode = enumerator.Current as GroupHeaderNode;

            Assert.IsNotNull(headerNode, "Expected group header but found " + enumerator.Current);
            Assert.AreEqual(expanded, headerNode.Expanded);
            Assert.AreEqual(text, headerNode.Text);
        }
Ejemplo n.º 4
0
        [Test] public void GroupExpandChanged()
        {
            _groupCollection.GroupExpandChanged += new GroupEventHandler(HandleGroupEvent);
            _nodeCollection.Add("Test");
            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode groupHeaderNode = (GroupHeaderNode)enumerator.Current;

            groupHeaderNode.Expanded = false;
            Assert.AreEqual(groupHeaderNode, _lastEventGroup);
        }
Ejemplo n.º 5
0
        [Test] public void VisibleParent()
        {
            JetListViewNode testNode   = _nodeCollection.Add("Test");
            IEnumerator     enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode groupHeaderNode = (GroupHeaderNode)enumerator.Current;

            groupHeaderNode.Expanded = false;

            Assert.AreEqual(groupHeaderNode, _groupCollection.GetVisibleParent(testNode));
            Assert.IsFalse(_groupCollection.IsNodeVisible(testNode));
        }
Ejemplo n.º 6
0
        [Test] public void TestDirectionalEnumeratorFromGroup()
        {
            _nodeCollection.Add("Test");
            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode groupHeaderNode = (GroupHeaderNode)enumerator.Current;

            enumerator = _groupCollection.GetDirectionalEnumerator(groupHeaderNode, MoveDirection.Down);
            VerifyGroupHeader(enumerator, "Test", true);
            VerifyNode(enumerator, "Test");
            Assert.IsFalse(enumerator.MoveNext());
        }
Ejemplo n.º 7
0
        [Test] public void CollapsedGroupScrollRange()
        {
            _nodeCollection.Add("Test");

            _rowListRenderer.Invalidate += new InvalidateEventHandler(HandleInvalidate);

            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode groupHeaderNode = (GroupHeaderNode)enumerator.Current;

            groupHeaderNode.Expanded = false;

            Assert.AreEqual(10, _rowListRenderer.ScrollRange);
        }
Ejemplo n.º 8
0
        [Test] public void InvalidateOnGroupExpand()
        {
            _nodeCollection.Add("Test");

            _rowListRenderer.Invalidate += new InvalidateEventHandler(HandleInvalidate);

            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode groupHeaderNode = (GroupHeaderNode)enumerator.Current;

            groupHeaderNode.Expanded = false;

            Assert.AreEqual(0, _lastInvalidateStartY);
        }
Ejemplo n.º 9
0
        [Test] public void GroupSelection()
        {
            _nodeCollection.Add("Test");

            _rowListRenderer.Draw(null, new Rectangle(0, 0, 100, 40));

            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode group = (GroupHeaderNode)enumerator.Current;

            _groupRenderer.MouseDownHandled = false;
            _rowListRenderer.HandleMouseDown(25, 5, MouseButtons.Left, Keys.None);
            Assert.IsTrue(_selection.IsNodeSelected(group), "Group must be selected");
        }
Ejemplo n.º 10
0
        [Test] public void CollapseGroup()
        {
            _nodeCollection.Add("Test");
            _nodeCollection.Add("Test2");

            IEnumerator enumerator = _groupCollection.GetFullEnumerator();

            enumerator.MoveNext();
            GroupHeaderNode node = enumerator.Current as GroupHeaderNode;

            node.Expanded = false;

            enumerator = _groupCollection.GetFullEnumerator();
            VerifyGroupHeader(enumerator, "Test", false);
            VerifyGroupHeader(enumerator, "Test2", true);
            VerifyNode(enumerator, "Test2");
            Assert.IsFalse(enumerator.MoveNext());
        }
Ejemplo n.º 11
0
        [SetUp] public void SetUp()
        {
            _nodeCollection  = new JetListViewNodeCollection(null);
            _groupProvider   = new MockGroupProvider();
            _groupCollection = new NodeGroupCollection(_nodeCollection, _groupProvider);

            _selection                   = new MultipleSelectionModel(_nodeCollection);
            _rowListRenderer             = new RowListRenderer(_nodeCollection, _selection);
            _rowRenderer                 = new MockRowRenderer();
            _rowRenderer.RowHeight       = 20;
            _rowListRenderer.RowRenderer = _rowRenderer;

            _groupRenderer = new MockGroupRenderer(10);
            _rowListRenderer.GroupRenderer       = _groupRenderer;
            _rowListRenderer.NodeGroupCollection = _groupCollection;

            _lastEventGroup       = null;
            _lastInvalidateStartY = -1;
        }
Ejemplo n.º 12
0
        [Test] public void GroupRowAt()
        {
            _nodeCollection.Add("Test");

            _rowListRenderer.Draw(null, new Rectangle(0, 0, 100, 40));

            int             deltaY;
            IViewNode       viewNode   = _rowListRenderer.GetRowAndDelta(5, out deltaY);
            GroupHeaderNode headerNode = viewNode as GroupHeaderNode;

            Assert.IsNotNull(headerNode);
            Assert.AreEqual(5, deltaY);

            viewNode = _rowListRenderer.GetRowAndDelta(15, out deltaY);
            JetListViewNode lvNode = viewNode as JetListViewNode;

            Assert.IsNotNull(lvNode);
            Assert.AreEqual(5, deltaY);
        }
Ejemplo n.º 13
0
 public bool HandleGroupKeyDown(GroupHeaderNode node, KeyEventArgs e)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 14
0
 public bool HandleMouseDown(GroupHeaderNode node, int x, int y, MouseButtons button, Keys modifiers)
 {
     _lastMouseDownPoint = new Point(x, y);
     return(_mouseDownHandled);
 }
Ejemplo n.º 15
0
 public void DrawGroupHeader(Graphics g, Rectangle rectangle, GroupHeaderNode node, RowState rowState)
 {
     _lastGroupText = node.Text;
     _lastGroupRect = rectangle;
 }
Ejemplo n.º 16
0
 private void HandleGroupEvent(object sender, GroupEventArgs e)
 {
     _lastEventGroup = e.GroupHeader;
 }