[Test] public void AutoSizeMinWidthMultiple() { _rowRenderer.VisibleWidth = 30; _columnCollection.BeginUpdate(); MockJetListViewColumn col = new MockJetListViewColumn(); col.AutoSize = true; col.AutoSizeMinWidth = 40; col.Width = 40; _columnCollection.Add(col); MockJetListViewColumn col2 = new MockJetListViewColumn(); col2.Width = 10; col2.AutoSize = true; _columnCollection.Add(col2); _columnCollection.EndUpdate(); Assert.AreEqual(40, col.Width); Assert.AreEqual(10, col2.Width); _rowRenderer.VisibleWidth = 60; Assert.AreEqual(40, col.Width); Assert.AreEqual(20, col2.Width); _rowRenderer.VisibleWidth = 100; Assert.AreEqual(50, col.Width); Assert.AreEqual(50, col2.Width); }
[Test] public void CompressIndent() // OM-8539 { SetupTreeStructureColumn(); MockJetListViewColumn col = new MockJetListViewColumn(); col.Width = 20; col.FixedSize = true; _columnCollection.Add(col); MockJetListViewColumn col2 = new MockJetListViewColumn(); col2.Width = 30; _columnCollection.Add(col2); MockJetListViewColumn col3 = new MockJetListViewColumn(); col3.Width = 30; _columnCollection.Add(col3); JetListViewNode node = _nodeCollection.Add("Test"); _rowRenderer.DrawRow(null, new Rectangle(0, 0, 100, 20), node, RowState.None); Assert.AreEqual(new Rectangle(20, 0, 20, 20), col.LastDrawItemRect); JetListViewNode child = _nodeCollection.Add("Child", node); _rowRenderer.DrawRow(null, new Rectangle(0, 0, 100, 20), child, RowState.None); Assert.AreEqual(new Rectangle(40, 0, 10, 20), col.LastDrawItemRect); Assert.AreEqual(new Rectangle(50, 0, 30, 20), col3.LastDrawItemRect); }
[Test] public void ScrollOffsetTest() { MockJetListViewColumn col = new MockJetListViewColumn(); col.Width = 20; _columnCollection.Add(col); JetListViewNode node = _nodeCollection.Add("Test"); _rowRenderer.ScrollOffset = 10; _rowRenderer.DrawRow(null, new Rectangle(0, 0, 20, 20), node, RowState.None); Assert.AreEqual(new Rectangle(-10, 0, 20, 20), col.LastDrawItemRect); }
[Test] public void AutoSize() { _rowRenderer.VisibleWidth = 10; MockJetListViewColumn col = new MockJetListViewColumn(); col.AutoSize = true; _columnCollection.Add(col); Assert.AreEqual(10, col.Width); _rowRenderer.VisibleWidth = 30; Assert.AreEqual(30, col.Width); }
[Test] public void ScrollRangeChangeOnManualResize() { MockJetListViewColumn col = new MockJetListViewColumn(); col.Width = 20; col.FixedSize = true; _columnCollection.Add(col); _rowRenderer.ScrollRangeChanged += new EventHandler(HandleScrollRangeChanged); col.Width = 30; Assert.AreEqual(1, _scrollRangeChanges); }
[SetUp] public void SetUp() { _schemeProvider = new MockColumnSchemeProvider(); _defaultScheme = _schemeProvider.DefaultScheme; _columnCollection = new JetListViewColumnCollection(); _renderer = new MultiLineRowRenderer(_columnCollection); _renderer.ColumnSchemeProvider = _schemeProvider; _renderer.VisibleWidth = 100; _renderer.RowHeight = 20; _nodeCollection = new JetListViewNodeCollection(null); _testNode = _nodeCollection.Add("Test"); _column1 = new MockJetListViewColumn(); _column2 = new MockJetListViewColumn(); }
[Test] public void MouseDownIndented() { SetupTreeStructureColumn(); MockJetListViewColumn col = new MockJetListViewColumn(); col.Width = 100; _columnCollection.Add(col); JetListViewNode node = _nodeCollection.Add("Test"); JetListViewNode child = _nodeCollection.Add("Child", node); _rowRenderer.HandleMouseDown(child, 30, 10, MouseButtons.Left, Keys.None); Assert.AreEqual(new Point(-1, -1), col.LastMouseDownPoint); _rowRenderer.HandleMouseDown(node, 30, 10, MouseButtons.Left, Keys.None); Assert.AreEqual(new Point(10, 10), col.LastMouseDownPoint); }
[SetUp] public void SetUp() { _nodeCollection = new JetListViewNodeCollection(null); _columnCollection = new JetListViewColumnCollection(); _baseRowRenderer = new SingleLineRowRenderer(_columnCollection, _nodeCollection); _baseColumn = new MockJetListViewColumn(); _baseColumn.Width = 100; _columnCollection.Add(_baseColumn); _baseRowRenderer.RowHeight = 17; _previewColumn = new MockJetListViewColumn(); _previewColumn.AutoPreviewHeight = 10; _rowRenderer = new AutoPreviewRowRenderer(_baseRowRenderer, _previewColumn, _columnCollection); _rowRenderer.VisibleWidth = 100; _controlPainter = new MockControlPainter(); _columnCollection.ControlPainter = _controlPainter; }
[Test] public void TotalWidthWithIndentColumn() { SetupTreeStructureColumn(); MockJetListViewColumn col2 = new MockJetListViewColumn(); col2.FixedSize = true; col2.Width = 20; _columnCollection.Add(col2); SetupSizeToContentColumn(); _controlPainter.SetExpectedSize("Test", new Size(10, 10)); _rowRenderer.ScrollRangeChanged += new EventHandler(HandleScrollRangeChanged); _nodeCollection.Add("Test"); Assert.AreEqual(1, _scrollRangeChanges); Assert.AreEqual(50, _rowRenderer.ScrollRange); }
[Test] public void AutoSizeNegative() // OM-8701 { _rowRenderer.VisibleWidth = 30; MockJetListViewColumn col = new MockJetListViewColumn(); col.Width = 20; _columnCollection.Add(col); MockJetListViewColumn col2 = new MockJetListViewColumn(); col2.AutoSize = true; _columnCollection.Add(col2); _rowRenderer.VisibleWidth = 10; Assert.AreEqual(10, col2.Width); }
[Test] public void DrawIndented() { SetupTreeStructureColumn(); MockJetListViewColumn col = new MockJetListViewColumn(); col.Width = 100; _columnCollection.Add(col); JetListViewNode node = _nodeCollection.Add("Test"); JetListViewNode child = _nodeCollection.Add("Child", node); _rowRenderer.DrawRow(null, new Rectangle(0, 0, 100, 20), node, RowState.None); Assert.AreEqual(new Rectangle(20, 0, 80, 20), col.LastDrawItemRect); _rowRenderer.DrawRow(null, new Rectangle(0, 0, 100, 20), child, RowState.None); Assert.AreEqual(new Rectangle(40, 0, 60, 20), col.LastDrawItemRect); }
[Test] public void MouseDownTest() { MockJetListViewColumn col = new MockJetListViewColumn(); col.Width = 20; _columnCollection.Add(col); MockJetListViewColumn col2 = new MockJetListViewColumn(); col2.Width = 20; _columnCollection.Add(col2); JetListViewNode node = _nodeCollection.Add("Test"); _rowRenderer.HandleMouseDown(node, 30, 5, MouseButtons.Left, Keys.None); Assert.AreEqual(new Point(10, 5), col2.LastMouseDownPoint); }
[Test] public void AutoSizeMultiple() // OM-8700 { _rowRenderer.VisibleWidth = 30; MockJetListViewColumn col = new MockJetListViewColumn(); col.AutoSize = true; _columnCollection.Add(col); MockJetListViewColumn col2 = new MockJetListViewColumn(); col2.AutoSize = true; _columnCollection.Add(col2); Assert.AreEqual(15, col.Width); Assert.AreEqual(15, col2.Width); _rowRenderer.VisibleWidth = 40; Assert.AreEqual(20, col.Width); Assert.AreEqual(20, col2.Width); }