2009-11-03 19:41:14 +00:00
|
|
|
|
#region CPL License
|
|
|
|
|
/*
|
|
|
|
|
Nuclex Framework
|
2019-02-01 20:06:36 +00:00
|
|
|
|
Copyright (C) 2002-2019 Nuclex Development Labs
|
2009-11-03 19:41:14 +00:00
|
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the IBM Common Public License as
|
|
|
|
|
published by the IBM Corporation; either version 1.0 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
IBM Common Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the IBM Common Public
|
|
|
|
|
License along with this library
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#if UNITTEST
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
|
|
using Nuclex.Support;
|
|
|
|
|
|
|
|
|
|
namespace Nuclex.Windows.Forms {
|
|
|
|
|
|
|
|
|
|
/// <summary>Unit Test for the control container list view</summary>
|
2014-07-21 16:26:45 +00:00
|
|
|
|
[TestFixture, Explicit]
|
2009-11-03 19:41:14 +00:00
|
|
|
|
public class ContainerListViewTest {
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Verifies that the asynchronous progress bar's constructor is working
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestConstructor() {
|
|
|
|
|
using(ContainerListView listView = new ContainerListView()) {
|
|
|
|
|
|
|
|
|
|
// Let the control create its window handle
|
|
|
|
|
listView.CreateControl();
|
|
|
|
|
listView.Columns.Add("Numeric");
|
|
|
|
|
listView.Columns.Add("Spelled");
|
|
|
|
|
listView.Columns.Add("Nonsense");
|
|
|
|
|
|
|
|
|
|
addRow(listView, "1", "One");
|
|
|
|
|
addRow(listView, "2", "Two");
|
|
|
|
|
addRow(listView, "3", "Three");
|
|
|
|
|
|
|
|
|
|
using(CheckBox checkBox = new CheckBox()) {
|
|
|
|
|
listView.EmbeddedControls.Add(new ListViewEmbeddedControl(checkBox, 2, 0));
|
|
|
|
|
listView.EmbeddedControls.Clear();
|
|
|
|
|
|
|
|
|
|
listView.Refresh();
|
|
|
|
|
|
|
|
|
|
ListViewEmbeddedControl embeddedControl = new ListViewEmbeddedControl(
|
|
|
|
|
checkBox, 2, 0
|
|
|
|
|
);
|
|
|
|
|
listView.EmbeddedControls.Add(embeddedControl);
|
|
|
|
|
listView.EmbeddedControls.Remove(embeddedControl);
|
|
|
|
|
|
|
|
|
|
listView.Refresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>Adds a row to a control container list view</summary>
|
|
|
|
|
/// <param name="listView">List view control the row will be added to</param>
|
|
|
|
|
/// <param name="columns">Values that will appear in the individual columns</param>
|
|
|
|
|
private void addRow(ContainerListView listView, params string[] columns) {
|
|
|
|
|
listView.Items.Add(new ListViewItem(columns));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Nuclex.Windows.Forms
|
|
|
|
|
|
|
|
|
|
#endif // UNITTEST
|