private void InsertTestResultItem(TestResultItem item) { detailList.BeginUpdate(); detailList.Items.Insert(detailList.Items.Count, item); detailList.SelectedIndex = 0; detailList.EndUpdate(); }
/// <summary> /// When one of the detail failure items is selected, display /// the stack trace and set up the tool tip for that item. /// </summary> private void detailList_SelectedIndexChanged(object sender, System.EventArgs e) { TestResultItem resultItem = (TestResultItem)detailList.SelectedItem; errorBrowser.StackTraceSource = resultItem.FilteredStackTrace; detailList.ContextMenuStrip = detailListContextMenuStrip; }
private void detailList_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e) { TestResultItem item = (TestResultItem)detailList.Items[e.Index]; string s = item.ToString(); SizeF size = this.WordWrap ? e.Graphics.MeasureString(item.ToString(), detailList.Font, detailList.ClientSize.Width) : e.Graphics.MeasureString(item.ToString(), detailList.Font); e.ItemHeight = (int)size.Height; e.ItemWidth = (int)size.Width; }
private void detailList_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (e.Index >= 0) { e.DrawBackground(); TestResultItem item = (TestResultItem)detailList.Items[e.Index]; Brush brush = (e.State & DrawItemState.Selected) == DrawItemState.Selected ? SystemBrushes.HighlightText : SystemBrushes.WindowText; e.Graphics.DrawString(item.ToString(), detailList.Font, brush, e.Bounds.Left, e.Bounds.Top + ITEM_MARGIN); } }
private void detailList_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e) { TestResultItem item = (TestResultItem)detailList.Items[e.Index]; SizeF size = e.Graphics.MeasureString(item.ToString(), detailList.Font); e.ItemHeight = (int)size.Height + 2 * ITEM_MARGIN; e.ItemWidth = (int)size.Width; if (e.ItemWidth > detailList.HorizontalExtent) { detailList.HorizontalExtent = e.ItemWidth; } }
private void detailList_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (e.Index >= 0) { e.DrawBackground(); TestResultItem item = (TestResultItem)detailList.Items[e.Index]; bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? true : false; Brush brush = selected ? SystemBrushes.HighlightText : SystemBrushes.WindowText; RectangleF layoutRect = e.Bounds; if (this.WordWrap && layoutRect.Width > detailList.ClientSize.Width) { layoutRect.Width = detailList.ClientSize.Width; } e.Graphics.DrawString(item.ToString(), detailList.Font, brush, layoutRect); } }
public void ToStringTest(string message, string stackTrace) { var item = new TestResultItem("dummy test name", message, stackTrace); Assert.IsNotNull(item.ToString()); }