示例#1
0
        [Test] public void ScrollUpTest()
        {
            _nodeCollection.Add("Item1", null);
            _nodeCollection.Add("Item2", null);
            _rowListRenderer.ScrollOffset = 30;
            _rowListRenderer.ScrollOffset = 10;
            _rowListRenderer.Draw(null, new Rectangle(0, 0, 100, 100));

            Assert.AreEqual(2, _rowRenderer.DrawOperations.Count);
            DrawRowOperation op = (DrawRowOperation)_rowRenderer.DrawOperations [0];

            Assert.AreEqual(new Rectangle(0, -10, 100, 17), op.Rect);
            Assert.AreEqual("Item1", op.ItemNode.Data);

            _rowRenderer.DrawOperations.Clear();
            _rowListRenderer.ScrollOffset = 5;
            _rowListRenderer.Draw(null, new Rectangle(0, 0, 100, 100));

            Assert.AreEqual(2, _rowRenderer.DrawOperations.Count);
            op = (DrawRowOperation)_rowRenderer.DrawOperations [0];
            Assert.AreEqual(new Rectangle(0, -5, 100, 17), op.Rect);
            Assert.AreEqual("Item1", op.ItemNode.Data);

            _rowRenderer.DrawOperations.Clear();
            _rowListRenderer.ScrollOffset = 0;
            _rowListRenderer.Draw(null, new Rectangle(0, 0, 100, 100));
            Assert.AreEqual(2, _rowRenderer.DrawOperations.Count);
            op = (DrawRowOperation)_rowRenderer.DrawOperations [0];
            Assert.AreEqual(new Rectangle(0, 0, 100, 17), op.Rect);
            Assert.AreEqual("Item1", op.ItemNode.Data);
        }
示例#2
0
        [Test] public void DropTargetDraw()
        {
            _nodeCollection.Add("Item");

            _rowListRenderer.SetDropTarget(_rowListRenderer.GetRowAt(10), DropTargetRenderMode.Over);
            _rowListRenderer.Draw(null, _clientRect);
            DrawRowOperation op = (DrawRowOperation)_rowRenderer.DrawOperations [0];

            Assert.AreEqual(RowState.DropTarget, op.State);
        }
示例#3
0
        [Test] public void SelectByClick()
        {
            _nodeCollection.Add("Item1", null);
            _rowListRenderer.HandleMouseDown(10, 10, MouseButtons.Left, Keys.None);
            _rowListRenderer.Draw(null, _clientRect);
            Assert.AreEqual(1, _rowRenderer.DrawOperations.Count);
            DrawRowOperation op = (DrawRowOperation)_rowRenderer.DrawOperations [0];

            Assert.AreEqual(RowState.ActiveSelected | RowState.Focused, op.State);
        }
示例#4
0
        [Test] public void SimpleTest()
        {
            JetListViewNode itemNode = _nodeCollection.Add("Item1", null);

            _rowListRenderer.Draw(null, _clientRect);

            Assert.AreEqual(1, _rowRenderer.DrawOperations.Count);
            DrawRowOperation op = (DrawRowOperation)_rowRenderer.DrawOperations [0];

            Assert.AreEqual(new Rectangle(0, 0, 100, 17), op.Rect);
            Assert.AreEqual(itemNode, op.ItemNode);
        }
示例#5
0
        [Test] public void InactiveSelection()
        {
            JetListViewNode item1 = _nodeCollection.Add("Item1", null);

            _selectionModel.HandleMouseDown(item1, Keys.None);

            _rowListRenderer.Invalidate     += new InvalidateEventHandler(_rowListRenderer_Invalidate);
            _rowListRenderer.ActiveSelection = false;
            Assert.AreEqual(1, _rowInvalidates.Count);

            _rowListRenderer.Draw(null, _clientRect);

            Assert.AreEqual(1, _rowRenderer.DrawOperations.Count);
            DrawRowOperation op = (DrawRowOperation)_rowRenderer.DrawOperations [0];

            Assert.AreEqual(new Rectangle(0, 0, 100, 17), op.Rect);
            Assert.AreEqual(RowState.InactiveSelected, op.State);
        }
示例#6
0
        [Test] public void ScrollOffsetExactUpTest3()
        {
            _nodeCollection.Add("Item1", null);
            _nodeCollection.Add("Item2", null);
            _nodeCollection.Add("Item3", null);
            _rowListRenderer.ScrollOffset = 34;
            _rowListRenderer.ScrollOffset = 17;
            _rowListRenderer.Draw(null, new Rectangle(0, 0, 100, 100));

            Assert.AreEqual(2, _rowRenderer.DrawOperations.Count);
            DrawRowOperation op = (DrawRowOperation)_rowRenderer.DrawOperations [0];

            Assert.AreEqual(new Rectangle(0, 0, 100, 17), op.Rect);
            Assert.AreEqual("Item2", op.ItemNode.Data);
            op = (DrawRowOperation)_rowRenderer.DrawOperations [1];
            Assert.AreEqual(new Rectangle(0, 17, 100, 17), op.Rect);
            Assert.AreEqual("Item3", op.ItemNode.Data);
        }