Quite likely the observe AVE were a result of use reusing a shared instance
of an `ImageList` across theory runs. Quite likely xUnit would dispose the
instance while another test was run, leading to a corrupt heap.

Resolves #3358
This commit is contained in:
Igor Velikorossov 2020-07-02 11:04:48 +10:00
Родитель 9647c6b0b3
Коммит ef0f6dbf38
3 изменённых файлов: 186 добавлений и 213 удалений

Просмотреть файл

@ -531,6 +531,8 @@ namespace System.Windows.Forms
}
}
ImageStream?.Dispose();
DestroyHandle();
}

Просмотреть файл

@ -92,8 +92,7 @@ namespace System.Windows.Forms.Tests.Serialization
void ValidateResult(string blob)
{
ImageListStreamer result = BinarySerialization.EnsureDeserialize<ImageListStreamer>(blob);
using ImageListStreamer result = BinarySerialization.EnsureDeserialize<ImageListStreamer>(blob);
using (NativeImageList nativeImageList = result.GetNativeImageList())
{
Assert.True(ComCtl32.ImageList.GetIconSize(new HandleRef(this, nativeImageList.Handle), out int x, out int y).IsTrue());

Просмотреть файл

@ -1521,9 +1521,6 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> GroupImageList_Set_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
foreach (bool autoArrange in new bool[] { true, false })
{
foreach (bool virtualMode in new bool[] { true, false })
@ -1532,13 +1529,13 @@ namespace System.Windows.Forms.Tests
{
yield return new object[] { autoArrange, virtualMode, view, null };
yield return new object[] { autoArrange, virtualMode, view, new ImageList() };
yield return new object[] { autoArrange, virtualMode, view, nonEmptyImageList };
yield return new object[] { autoArrange, virtualMode, view, CreateNonEmpty() };
}
}
yield return new object[] { autoArrange, false, View.Tile, null };
yield return new object[] { autoArrange, false, View.Tile, new ImageList() };
yield return new object[] { autoArrange, false, View.Tile, nonEmptyImageList };
yield return new object[] { autoArrange, false, View.Tile, CreateNonEmpty() };
}
}
@ -1588,56 +1585,53 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> GroupImageList_SetWithHandle_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
yield return new object[] { true, false, View.Details, null };
yield return new object[] { true, false, View.Details, new ImageList() };
yield return new object[] { true, false, View.Details, nonEmptyImageList };
yield return new object[] { true, false, View.Details, CreateNonEmpty() };
yield return new object[] { true, false, View.LargeIcon, null };
yield return new object[] { true, false, View.LargeIcon, new ImageList() };
yield return new object[] { true, false, View.LargeIcon, nonEmptyImageList };
yield return new object[] { true, false, View.LargeIcon, CreateNonEmpty() };
yield return new object[] { true, false, View.List, null };
yield return new object[] { true, false, View.List, new ImageList() };
yield return new object[] { true, false, View.List, nonEmptyImageList };
yield return new object[] { true, false, View.List, CreateNonEmpty() };
yield return new object[] { true, false, View.SmallIcon, null };
yield return new object[] { true, false, View.SmallIcon, new ImageList() };
yield return new object[] { true, false, View.SmallIcon, nonEmptyImageList };
yield return new object[] { true, false, View.SmallIcon, CreateNonEmpty() };
yield return new object[] { true, false, View.Tile, null };
yield return new object[] { true, false, View.Tile, new ImageList() };
yield return new object[] { true, false, View.Tile, nonEmptyImageList };
yield return new object[] { true, false, View.Tile, CreateNonEmpty() };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { autoArrange, true, View.Details, null };
yield return new object[] { autoArrange, true, View.Details, new ImageList() };
yield return new object[] { autoArrange, true, View.Details, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.Details, CreateNonEmpty() };
yield return new object[] { autoArrange, true, View.LargeIcon, null };
yield return new object[] { autoArrange, true, View.LargeIcon, new ImageList() };
yield return new object[] { autoArrange, true, View.LargeIcon, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.LargeIcon, CreateNonEmpty() };
yield return new object[] { autoArrange, true, View.List, null };
yield return new object[] { autoArrange, true, View.List, new ImageList() };
yield return new object[] { autoArrange, true, View.List, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.List, CreateNonEmpty() };
yield return new object[] { autoArrange, true, View.SmallIcon, null };
yield return new object[] { autoArrange, true, View.SmallIcon, new ImageList() };
yield return new object[] { autoArrange, true, View.SmallIcon, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.SmallIcon, CreateNonEmpty() };
}
yield return new object[] { false, false, View.Details, null };
yield return new object[] { false, false, View.Details, new ImageList() };
yield return new object[] { false, false, View.Details, nonEmptyImageList };
yield return new object[] { false, false, View.Details, CreateNonEmpty() };
yield return new object[] { false, false, View.LargeIcon, null };
yield return new object[] { false, false, View.LargeIcon, new ImageList() };
yield return new object[] { false, false, View.LargeIcon, nonEmptyImageList };
yield return new object[] { false, false, View.LargeIcon, CreateNonEmpty() };
yield return new object[] { false, false, View.List, null };
yield return new object[] { false, false, View.List, new ImageList() };
yield return new object[] { false, false, View.List, nonEmptyImageList };
yield return new object[] { false, false, View.List, CreateNonEmpty() };
yield return new object[] { false, false, View.SmallIcon, null };
yield return new object[] { false, false, View.SmallIcon, new ImageList() };
yield return new object[] { false, false, View.SmallIcon, nonEmptyImageList };
yield return new object[] { false, false, View.SmallIcon, CreateNonEmpty() };
yield return new object[] { false, false, View.Tile, null };
yield return new object[] { false, false, View.Tile, new ImageList() };
yield return new object[] { false, false, View.Tile, nonEmptyImageList };
yield return new object[] { false, false, View.Tile, CreateNonEmpty() };
}
[WinFormsTheory]
@ -1677,56 +1671,53 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> GroupImageList_SetWithHandleWithNonNullOldValue_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
yield return new object[] { true, false, View.Details, null };
yield return new object[] { true, false, View.Details, new ImageList() };
yield return new object[] { true, false, View.Details, nonEmptyImageList };
yield return new object[] { true, false, View.Details, CreateNonEmpty() };
yield return new object[] { true, false, View.LargeIcon, null };
yield return new object[] { true, false, View.LargeIcon, new ImageList() };
yield return new object[] { true, false, View.LargeIcon, nonEmptyImageList };
yield return new object[] { true, false, View.LargeIcon, CreateNonEmpty() };
yield return new object[] { true, false, View.List, null };
yield return new object[] { true, false, View.List, new ImageList() };
yield return new object[] { true, false, View.List, nonEmptyImageList };
yield return new object[] { true, false, View.List, CreateNonEmpty() };
yield return new object[] { true, false, View.SmallIcon, null };
yield return new object[] { true, false, View.SmallIcon, new ImageList() };
yield return new object[] { true, false, View.SmallIcon, nonEmptyImageList };
yield return new object[] { true, false, View.SmallIcon, CreateNonEmpty() };
yield return new object[] { true, false, View.Tile, null };
yield return new object[] { true, false, View.Tile, new ImageList() };
yield return new object[] { true, false, View.Tile, nonEmptyImageList };
yield return new object[] { true, false, View.Tile, CreateNonEmpty() };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { autoArrange, true, View.Details, null };
yield return new object[] { autoArrange, true, View.Details, new ImageList() };
yield return new object[] { autoArrange, true, View.Details, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.Details, CreateNonEmpty() };
yield return new object[] { autoArrange, true, View.LargeIcon, null };
yield return new object[] { autoArrange, true, View.LargeIcon, new ImageList() };
yield return new object[] { autoArrange, true, View.LargeIcon, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.LargeIcon, CreateNonEmpty() };
yield return new object[] { autoArrange, true, View.List, null };
yield return new object[] { autoArrange, true, View.List, new ImageList() };
yield return new object[] { autoArrange, true, View.List, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.List, CreateNonEmpty() };
yield return new object[] { autoArrange, true, View.SmallIcon, null };
yield return new object[] { autoArrange, true, View.SmallIcon, new ImageList() };
yield return new object[] { autoArrange, true, View.SmallIcon, nonEmptyImageList };
yield return new object[] { autoArrange, true, View.SmallIcon, CreateNonEmpty() };
}
yield return new object[] { false, false, View.Details, null };
yield return new object[] { false, false, View.Details, new ImageList() };
yield return new object[] { false, false, View.Details, nonEmptyImageList };
yield return new object[] { false, false, View.Details, CreateNonEmpty() };
yield return new object[] { false, false, View.LargeIcon, null };
yield return new object[] { false, false, View.LargeIcon, new ImageList() };
yield return new object[] { false, false, View.LargeIcon, nonEmptyImageList };
yield return new object[] { false, false, View.LargeIcon, CreateNonEmpty() };
yield return new object[] { false, false, View.List, null };
yield return new object[] { false, false, View.List, new ImageList() };
yield return new object[] { false, false, View.List, nonEmptyImageList };
yield return new object[] { false, false, View.List, CreateNonEmpty() };
yield return new object[] { false, false, View.SmallIcon, null };
yield return new object[] { false, false, View.SmallIcon, new ImageList() };
yield return new object[] { false, false, View.SmallIcon, nonEmptyImageList };
yield return new object[] { false, false, View.SmallIcon, CreateNonEmpty() };
yield return new object[] { false, false, View.Tile, null };
yield return new object[] { false, false, View.Tile, new ImageList() };
yield return new object[] { false, false, View.Tile, nonEmptyImageList };
yield return new object[] { false, false, View.Tile, CreateNonEmpty() };
}
[WinFormsTheory]
@ -1738,7 +1729,6 @@ namespace System.Windows.Forms.Tests
AutoArrange = autoArrange,
VirtualMode = virtualMode,
View = view,
GroupImageList = new ImageList()
};
Assert.NotEqual(IntPtr.Zero, listView.Handle);
@ -2473,9 +2463,6 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> LargeImageList_Set_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
foreach (bool autoArrange in new bool[] { true, false })
{
foreach (bool virtualMode in new bool[] { true, false })
@ -2484,13 +2471,13 @@ namespace System.Windows.Forms.Tests
{
yield return new object[] { autoArrange, virtualMode, view, null };
yield return new object[] { autoArrange, virtualMode, view, new ImageList() };
yield return new object[] { autoArrange, virtualMode, view, nonEmptyImageList };
yield return new object[] { autoArrange, virtualMode, view, CreateNonEmpty() };
}
}
yield return new object[] { autoArrange, false, View.Tile, null };
yield return new object[] { autoArrange, false, View.Tile, new ImageList() };
yield return new object[] { autoArrange, false, View.Tile, nonEmptyImageList };
yield return new object[] { autoArrange, false, View.Tile, CreateNonEmpty() };
}
}
@ -2539,56 +2526,53 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> LargeImageList_SetWithHandle_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
yield return new object[] { true, false, View.Details, null, 0 };
yield return new object[] { true, false, View.Details, new ImageList(), 0 };
yield return new object[] { true, false, View.Details, nonEmptyImageList, 0 };
yield return new object[] { true, false, View.Details, CreateNonEmpty(), 0 };
yield return new object[] { true, false, View.LargeIcon, null, 0 };
yield return new object[] { true, false, View.LargeIcon, new ImageList(), 1 };
yield return new object[] { true, false, View.LargeIcon, nonEmptyImageList, 1 };
yield return new object[] { true, false, View.LargeIcon, CreateNonEmpty(), 1 };
yield return new object[] { true, false, View.List, null, 0 };
yield return new object[] { true, false, View.List, new ImageList(), 0 };
yield return new object[] { true, false, View.List, nonEmptyImageList, 0 };
yield return new object[] { true, false, View.List, CreateNonEmpty(), 0 };
yield return new object[] { true, false, View.SmallIcon, null, 0 };
yield return new object[] { true, false, View.SmallIcon, new ImageList(), 1 };
yield return new object[] { true, false, View.SmallIcon, nonEmptyImageList, 1 };
yield return new object[] { true, false, View.SmallIcon, CreateNonEmpty(), 1 };
yield return new object[] { true, false, View.Tile, null, 0 };
yield return new object[] { true, false, View.Tile, new ImageList(), 0 };
yield return new object[] { true, false, View.Tile, nonEmptyImageList, 0 };
yield return new object[] { true, false, View.Tile, CreateNonEmpty(), 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { autoArrange, true, View.Details, null, 0 };
yield return new object[] { autoArrange, true, View.Details, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.Details, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.Details, CreateNonEmpty(), 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, null, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0 };
yield return new object[] { autoArrange, true, View.List, null, 0 };
yield return new object[] { autoArrange, true, View.List, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.List, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.List, CreateNonEmpty(), 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, null, 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, CreateNonEmpty(), 0 };
}
yield return new object[] { false, false, View.Details, null, 0 };
yield return new object[] { false, false, View.Details, new ImageList(), 0 };
yield return new object[] { false, false, View.Details, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.Details, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.LargeIcon, null, 0 };
yield return new object[] { false, false, View.LargeIcon, new ImageList(), 0 };
yield return new object[] { false, false, View.LargeIcon, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.LargeIcon, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.List, null, 0 };
yield return new object[] { false, false, View.List, new ImageList(), 0 };
yield return new object[] { false, false, View.List, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.List, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.SmallIcon, null, 0 };
yield return new object[] { false, false, View.SmallIcon, new ImageList(), 0 };
yield return new object[] { false, false, View.SmallIcon, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.SmallIcon, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.Tile, null, 0 };
yield return new object[] { false, false, View.Tile, new ImageList(), 0 };
yield return new object[] { false, false, View.Tile, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.Tile, CreateNonEmpty(), 0 };
}
[WinFormsTheory]
@ -2627,56 +2611,53 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> LargeImageList_SetWithHandleWithNonNullOldValue_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
yield return new object[] { true, false, View.Details, null, 0 };
yield return new object[] { true, false, View.Details, new ImageList(), 0 };
yield return new object[] { true, false, View.Details, nonEmptyImageList, 0 };
yield return new object[] { true, false, View.Details, CreateNonEmpty(), 0 };
yield return new object[] { true, false, View.LargeIcon, null, 1 };
yield return new object[] { true, false, View.LargeIcon, new ImageList(), 1 };
yield return new object[] { true, false, View.LargeIcon, nonEmptyImageList, 1 };
yield return new object[] { true, false, View.LargeIcon, CreateNonEmpty(), 1 };
yield return new object[] { true, false, View.List, null, 0 };
yield return new object[] { true, false, View.List, new ImageList(), 0 };
yield return new object[] { true, false, View.List, nonEmptyImageList, 0 };
yield return new object[] { true, false, View.List, CreateNonEmpty(), 0 };
yield return new object[] { true, false, View.SmallIcon, null, 1 };
yield return new object[] { true, false, View.SmallIcon, new ImageList(), 1 };
yield return new object[] { true, false, View.SmallIcon, nonEmptyImageList, 1 };
yield return new object[] { true, false, View.SmallIcon, CreateNonEmpty(), 1 };
yield return new object[] { true, false, View.Tile, null, 0 };
yield return new object[] { true, false, View.Tile, new ImageList(), 0 };
yield return new object[] { true, false, View.Tile, nonEmptyImageList, 0 };
yield return new object[] { true, false, View.Tile, CreateNonEmpty(), 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { autoArrange, true, View.Details, null, 0 };
yield return new object[] { autoArrange, true, View.Details, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.Details, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.Details, CreateNonEmpty(), 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, null, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0 };
yield return new object[] { autoArrange, true, View.List, null, 0 };
yield return new object[] { autoArrange, true, View.List, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.List, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.List, CreateNonEmpty(), 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, null, 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, new ImageList(), 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, nonEmptyImageList, 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, CreateNonEmpty(), 0 };
}
yield return new object[] { false, false, View.Details, null, 0 };
yield return new object[] { false, false, View.Details, new ImageList(), 0 };
yield return new object[] { false, false, View.Details, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.Details, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.LargeIcon, null, 0 };
yield return new object[] { false, false, View.LargeIcon, new ImageList(), 0 };
yield return new object[] { false, false, View.LargeIcon, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.LargeIcon, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.List, null, 0 };
yield return new object[] { false, false, View.List, new ImageList(), 0 };
yield return new object[] { false, false, View.List, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.List, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.SmallIcon, null, 0 };
yield return new object[] { false, false, View.SmallIcon, new ImageList(), 0 };
yield return new object[] { false, false, View.SmallIcon, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.SmallIcon, CreateNonEmpty(), 0 };
yield return new object[] { false, false, View.Tile, null, 0 };
yield return new object[] { false, false, View.Tile, new ImageList(), 0 };
yield return new object[] { false, false, View.Tile, nonEmptyImageList, 0 };
yield return new object[] { false, false, View.Tile, CreateNonEmpty(), 0 };
}
[WinFormsTheory]
@ -3082,9 +3063,6 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> SmallImageList_Set_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
foreach (bool autoArrange in new bool[] { true, false })
{
foreach (bool virtualMode in new bool[] { true, false })
@ -3093,13 +3071,13 @@ namespace System.Windows.Forms.Tests
{
yield return new object[] { autoArrange, virtualMode, view, null };
yield return new object[] { autoArrange, virtualMode, view, new ImageList() };
yield return new object[] { autoArrange, virtualMode, view, nonEmptyImageList };
yield return new object[] { autoArrange, virtualMode, view, CreateNonEmpty() };
}
}
yield return new object[] { autoArrange, false, View.Tile, null };
yield return new object[] { autoArrange, false, View.Tile, new ImageList() };
yield return new object[] { autoArrange, false, View.Tile, nonEmptyImageList };
yield return new object[] { autoArrange, false, View.Tile, CreateNonEmpty() };
}
}
@ -3148,56 +3126,53 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> SmallImageList_SetWithHandle_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
yield return new object[] { true, false, View.Details, null, 0, 0 };
yield return new object[] { true, false, View.Details, new ImageList(), 1, 0 };
yield return new object[] { true, false, View.Details, nonEmptyImageList, 1, 0 };
yield return new object[] { true, false, View.Details, CreateNonEmpty(), 1, 0 };
yield return new object[] { true, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { true, false, View.LargeIcon, new ImageList(), 1, 0 };
yield return new object[] { true, false, View.LargeIcon, nonEmptyImageList, 1, 0 };
yield return new object[] { true, false, View.LargeIcon, CreateNonEmpty(), 1, 0 };
yield return new object[] { true, false, View.List, null, 0, 0 };
yield return new object[] { true, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { true, false, View.SmallIcon, new ImageList(), 4, 2 };
yield return new object[] { true, false, View.SmallIcon, nonEmptyImageList, 4, 2 };
yield return new object[] { true, false, View.SmallIcon, CreateNonEmpty(), 4, 2 };
yield return new object[] { true, false, View.Tile, null, 0, 0 };
yield return new object[] { true, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { true, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, View.Tile, CreateNonEmpty(), 0, 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { autoArrange, true, View.Details, null, 0, 0 };
yield return new object[] { autoArrange, true, View.Details, new ImageList(), 1, 0 };
yield return new object[] { autoArrange, true, View.Details, nonEmptyImageList, 1, 0 };
yield return new object[] { autoArrange, true, View.Details, CreateNonEmpty(), 1, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, null, 0, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { autoArrange, true, View.List, null, 0, 0 };
yield return new object[] { autoArrange, true, View.List, new ImageList(), 0, 0 };
yield return new object[] { autoArrange, true, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { autoArrange, true, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, null, 0, 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, new ImageList(), 2, 2 };
yield return new object[] { autoArrange, true, View.SmallIcon, nonEmptyImageList, 2, 2 };
yield return new object[] { autoArrange, true, View.SmallIcon, CreateNonEmpty(), 2, 2 };
}
yield return new object[] { false, false, View.Details, null, 0, 0 };
yield return new object[] { false, false, View.Details, new ImageList(), 1, 0 };
yield return new object[] { false, false, View.Details, nonEmptyImageList, 1, 0 };
yield return new object[] { false, false, View.Details, CreateNonEmpty(), 1, 0 };
yield return new object[] { false, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, View.List, null, 0, 0 };
yield return new object[] { false, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, false, View.SmallIcon, new ImageList(), 2, 2 };
yield return new object[] { false, false, View.SmallIcon, nonEmptyImageList, 2, 2 };
yield return new object[] { false, false, View.SmallIcon, CreateNonEmpty(), 2, 2 };
yield return new object[] { false, false, View.Tile, null, 0, 0 };
yield return new object[] { false, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { false, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, View.Tile, CreateNonEmpty(), 0, 0 };
}
[WinFormsTheory]
@ -3236,56 +3211,53 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> SmallImageList_SetWithHandleWithNonNullOldValue_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
yield return new object[] { true, false, View.Details, null, 1, 0 };
yield return new object[] { true, false, View.Details, new ImageList(), 1, 0 };
yield return new object[] { true, false, View.Details, nonEmptyImageList, 1, 0 };
yield return new object[] { true, false, View.Details, CreateNonEmpty(), 1, 0 };
yield return new object[] { true, false, View.LargeIcon, null, 1, 0 };
yield return new object[] { true, false, View.LargeIcon, new ImageList(), 1, 0 };
yield return new object[] { true, false, View.LargeIcon, nonEmptyImageList, 1, 0 };
yield return new object[] { true, false, View.LargeIcon, CreateNonEmpty(), 1, 0 };
yield return new object[] { true, false, View.List, null, 0, 0 };
yield return new object[] { true, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, false, View.SmallIcon, null, 4, 2 };
yield return new object[] { true, false, View.SmallIcon, new ImageList(), 4, 2 };
yield return new object[] { true, false, View.SmallIcon, nonEmptyImageList, 4, 2 };
yield return new object[] { true, false, View.SmallIcon, CreateNonEmpty(), 4, 2 };
yield return new object[] { true, false, View.Tile, null, 0, 0 };
yield return new object[] { true, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { true, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, View.Tile, CreateNonEmpty(), 0, 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { autoArrange, true, View.Details, null, 1, 0 };
yield return new object[] { autoArrange, true, View.Details, new ImageList(), 1, 0 };
yield return new object[] { autoArrange, true, View.Details, nonEmptyImageList, 1, 0 };
yield return new object[] { autoArrange, true, View.Details, CreateNonEmpty(), 1, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, null, 0, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { autoArrange, true, View.List, null, 0, 0 };
yield return new object[] { autoArrange, true, View.List, new ImageList(), 0, 0 };
yield return new object[] { autoArrange, true, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { autoArrange, true, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { autoArrange, true, View.SmallIcon, null, 2, 2 };
yield return new object[] { autoArrange, true, View.SmallIcon, new ImageList(), 2, 2 };
yield return new object[] { autoArrange, true, View.SmallIcon, nonEmptyImageList, 2, 2 };
yield return new object[] { autoArrange, true, View.SmallIcon, CreateNonEmpty(), 2, 2 };
}
yield return new object[] { false, false, View.Details, null, 1, 0 };
yield return new object[] { false, false, View.Details, new ImageList(), 1, 0 };
yield return new object[] { false, false, View.Details, nonEmptyImageList, 1, 0 };
yield return new object[] { false, false, View.Details, CreateNonEmpty(), 1, 0 };
yield return new object[] { false, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, View.List, null, 0, 0 };
yield return new object[] { false, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, View.SmallIcon, null, 2, 2 };
yield return new object[] { false, false, View.SmallIcon, new ImageList(), 2, 2 };
yield return new object[] { false, false, View.SmallIcon, nonEmptyImageList, 2, 2 };
yield return new object[] { false, false, View.SmallIcon, CreateNonEmpty(), 2, 2 };
yield return new object[] { false, false, View.Tile, null, 0, 0 };
yield return new object[] { false, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { false, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, View.Tile, CreateNonEmpty(), 0, 0 };
}
[WinFormsTheory]
@ -3392,9 +3364,6 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> StateImageList_Set_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
foreach (bool useCompatibleStateImageBehavior in new bool[] { true, false })
{
foreach (bool checkBoxes in new bool[] { true, false })
@ -3407,7 +3376,7 @@ namespace System.Windows.Forms.Tests
{
yield return new object[] { useCompatibleStateImageBehavior, checkBoxes, autoArrange, virtualMode, view, null };
yield return new object[] { useCompatibleStateImageBehavior, checkBoxes, autoArrange, virtualMode, view, new ImageList() };
yield return new object[] { useCompatibleStateImageBehavior, checkBoxes, autoArrange, virtualMode, view, nonEmptyImageList };
yield return new object[] { useCompatibleStateImageBehavior, checkBoxes, autoArrange, virtualMode, view, CreateNonEmpty() };
}
}
}
@ -3415,11 +3384,11 @@ namespace System.Windows.Forms.Tests
yield return new object[] { useCompatibleStateImageBehavior, false, true, false, View.Tile, null };
yield return new object[] { useCompatibleStateImageBehavior, false, true, false, View.Tile, new ImageList() };
yield return new object[] { useCompatibleStateImageBehavior, false, true, false, View.Tile, nonEmptyImageList };
yield return new object[] { useCompatibleStateImageBehavior, false, true, false, View.Tile, CreateNonEmpty() };
yield return new object[] { useCompatibleStateImageBehavior, false, false, false, View.Tile, null };
yield return new object[] { useCompatibleStateImageBehavior, false, false, false, View.Tile, new ImageList() };
yield return new object[] { useCompatibleStateImageBehavior, false, false, false, View.Tile, nonEmptyImageList };
yield return new object[] { useCompatibleStateImageBehavior, false, false, false, View.Tile, CreateNonEmpty() };
}
}
@ -3472,154 +3441,151 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> StateImageList_SetWithHandle_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
// UseCompatibleStateImageBehavior true
foreach (bool checkBoxes in new bool[] { true, false })
{
yield return new object[] { true, checkBoxes, true, false, View.Details, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, CreateNonEmpty(), 0, 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, CreateNonEmpty(), 0, 0 };
}
yield return new object[] { true, checkBoxes, false, false, View.Details, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, CreateNonEmpty(), 0, 0 };
}
yield return new object[] { true, false, true, false, View.Tile, null, 0, 0 };
yield return new object[] { true, false, true, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { true, false, true, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, true, false, View.Tile, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, null, 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, CreateNonEmpty(), 0, 0 };
// UseCompatibleStateImageBehavior false, CheckBoxes true
yield return new object[] { false, true, true, false, View.Details, null, 0, 0 };
yield return new object[] { false, true, true, false, View.Details, new ImageList(), 1, 1 };
yield return new object[] { false, true, true, false, View.Details, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, true, false, View.Details, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, true, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, true, true, false, View.LargeIcon, new ImageList(), 3, 1 };
yield return new object[] { false, true, true, false, View.LargeIcon, nonEmptyImageList, 3, 1 };
yield return new object[] { false, true, true, false, View.LargeIcon, CreateNonEmpty(), 3, 1 };
yield return new object[] { false, true, true, false, View.List, null, 0, 0 };
yield return new object[] { false, true, true, false, View.List, new ImageList(), 1, 1 };
yield return new object[] { false, true, true, false, View.List, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, true, false, View.List, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, true, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, true, true, false, View.SmallIcon, new ImageList(), 3, 1 };
yield return new object[] { false, true, true, false, View.SmallIcon, nonEmptyImageList, 3, 1 };
yield return new object[] { false, true, true, false, View.SmallIcon, CreateNonEmpty(), 3, 1 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { false, true, autoArrange, true, View.Details, null, 0, 0 };
yield return new object[] { false, true, autoArrange, true, View.Details, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.Details, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.Details, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.List, null, 0, 0 };
yield return new object[] { false, true, autoArrange, true, View.List, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.List, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.List, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, CreateNonEmpty(), 1, 1 };
}
yield return new object[] { false, true, false, false, View.Details, null, 0, 0 };
yield return new object[] { false, true, false, false, View.Details, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.Details, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.Details, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, false, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, true, false, false, View.LargeIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.LargeIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.LargeIcon, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, false, false, View.List, null, 0, 0 };
yield return new object[] { false, true, false, false, View.List, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.List, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.List, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, false, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, true, false, false, View.SmallIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.SmallIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.SmallIcon, CreateNonEmpty(), 1, 1 };
// UseCompatibleStateImageBehavior false, CheckBoxes false
yield return new object[] { false, false, true, false, View.Details, null, 0, 0 };
yield return new object[] { false, false, true, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { false, false, true, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, true, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, new ImageList(), 1, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, nonEmptyImageList, 1, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, CreateNonEmpty(), 1, 0 };
yield return new object[] { false, false, true, false, View.List, null, 0, 0 };
yield return new object[] { false, false, true, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, true, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, true, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, new ImageList(), 1, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, nonEmptyImageList, 1, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, CreateNonEmpty(), 1, 0 };
yield return new object[] { false, false, true, false, View.Tile, null, 0, 0 };
yield return new object[] { false, false, true, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { false, false, true, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, true, false, View.Tile, CreateNonEmpty(), 0, 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { false, false, autoArrange, true, View.Details, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.Details, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, CreateNonEmpty(), 0, 0 };
}
yield return new object[] { false, false, false, false, View.Details, null, 0, 0 };
yield return new object[] { false, false, false, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.List, null, 0, 0 };
yield return new object[] { false, false, false, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, null, 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, CreateNonEmpty(), 0, 0 };
}
[WinFormsTheory]
@ -3660,154 +3626,151 @@ namespace System.Windows.Forms.Tests
public static IEnumerable<object[]> StateImageList_SetWithHandleWithNonNullOldValue_GetReturnsExpected()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
// UseCompatibleStateImageBehavior true
foreach (bool checkBoxes in new bool[] { true, false })
{
yield return new object[] { true, checkBoxes, true, false, View.Details, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, true, false, View.SmallIcon, CreateNonEmpty(), 0, 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, autoArrange, true, View.SmallIcon, CreateNonEmpty(), 0, 0 };
}
yield return new object[] { true, checkBoxes, false, false, View.Details, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { true, checkBoxes, false, false, View.SmallIcon, CreateNonEmpty(), 0, 0 };
}
yield return new object[] { true, false, true, false, View.Tile, null, 0, 0 };
yield return new object[] { true, false, true, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { true, false, true, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, true, false, View.Tile, CreateNonEmpty(), 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, null, 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { true, false, false, false, View.Tile, CreateNonEmpty(), 0, 0 };
// UseCompatibleStateImageBehavior false, CheckBoxes true
yield return new object[] { false, true, true, false, View.Details, null, 1, 1 };
yield return new object[] { false, true, true, false, View.Details, new ImageList(), 1, 1 };
yield return new object[] { false, true, true, false, View.Details, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, true, false, View.Details, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, true, false, View.LargeIcon, null, 3, 1 };
yield return new object[] { false, true, true, false, View.LargeIcon, new ImageList(), 3, 1 };
yield return new object[] { false, true, true, false, View.LargeIcon, nonEmptyImageList, 3, 1 };
yield return new object[] { false, true, true, false, View.LargeIcon, CreateNonEmpty(), 3, 1 };
yield return new object[] { false, true, true, false, View.List, null, 1, 1 };
yield return new object[] { false, true, true, false, View.List, new ImageList(), 1, 1 };
yield return new object[] { false, true, true, false, View.List, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, true, false, View.List, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, true, false, View.SmallIcon, null, 3, 1 };
yield return new object[] { false, true, true, false, View.SmallIcon, new ImageList(), 3, 1 };
yield return new object[] { false, true, true, false, View.SmallIcon, nonEmptyImageList, 3, 1 };
yield return new object[] { false, true, true, false, View.SmallIcon, CreateNonEmpty(), 3, 1 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { false, true, autoArrange, true, View.Details, null, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.Details, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.Details, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.Details, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, null, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.LargeIcon, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.List, null, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.List, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.List, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.List, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, null, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, autoArrange, true, View.SmallIcon, CreateNonEmpty(), 1, 1 };
}
yield return new object[] { false, true, false, false, View.Details, null, 1, 1 };
yield return new object[] { false, true, false, false, View.Details, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.Details, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.Details, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, false, false, View.LargeIcon, null, 1, 1 };
yield return new object[] { false, true, false, false, View.LargeIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.LargeIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.LargeIcon, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, false, false, View.List, null, 1, 1 };
yield return new object[] { false, true, false, false, View.List, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.List, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.List, CreateNonEmpty(), 1, 1 };
yield return new object[] { false, true, false, false, View.SmallIcon, null, 1, 1 };
yield return new object[] { false, true, false, false, View.SmallIcon, new ImageList(), 1, 1 };
yield return new object[] { false, true, false, false, View.SmallIcon, nonEmptyImageList, 1, 1 };
yield return new object[] { false, true, false, false, View.SmallIcon, CreateNonEmpty(), 1, 1 };
// UseCompatibleStateImageBehavior false, CheckBoxes false
yield return new object[] { false, false, true, false, View.Details, null, 0, 0 };
yield return new object[] { false, false, true, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { false, false, true, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, true, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, null, 1, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, new ImageList(), 1, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, nonEmptyImageList, 1, 0 };
yield return new object[] { false, false, true, false, View.LargeIcon, CreateNonEmpty(), 1, 0 };
yield return new object[] { false, false, true, false, View.List, null, 0, 0 };
yield return new object[] { false, false, true, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, true, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, true, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, null, 1, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, new ImageList(), 1, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, nonEmptyImageList, 1, 0 };
yield return new object[] { false, false, true, false, View.SmallIcon, CreateNonEmpty(), 1, 0 };
yield return new object[] { false, false, true, false, View.Tile, null, 0, 0 };
yield return new object[] { false, false, true, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { false, false, true, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, true, false, View.Tile, CreateNonEmpty(), 0, 0 };
foreach (bool autoArrange in new bool[] { true, false })
{
yield return new object[] { false, false, autoArrange, true, View.Details, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.Details, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, autoArrange, true, View.SmallIcon, CreateNonEmpty(), 0, 0 };
}
yield return new object[] { false, false, false, false, View.Details, null, 0, 0 };
yield return new object[] { false, false, false, false, View.Details, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.Details, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.Details, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, null, 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.LargeIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.List, null, 0, 0 };
yield return new object[] { false, false, false, false, View.List, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.List, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.List, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, null, 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.SmallIcon, CreateNonEmpty(), 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, null, 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, new ImageList(), 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, nonEmptyImageList, 0, 0 };
yield return new object[] { false, false, false, false, View.Tile, CreateNonEmpty(), 0, 0 };
}
[WinFormsTheory]
@ -3822,8 +3785,10 @@ namespace System.Windows.Forms.Tests
AutoArrange = autoArrange,
VirtualMode = virtualMode,
View = view,
StateImageList = imageList
};
listView.StateImageList = imageList;
Assert.NotEqual(IntPtr.Zero, listView.Handle);
int invalidatedCallCount = 0;
listView.Invalidated += (sender, e) => invalidatedCallCount++;
@ -4189,6 +4154,13 @@ namespace System.Windows.Forms.Tests
Assert.False(control.GetTopLevel());
}
private static ImageList CreateNonEmpty()
{
var nonEmptyImageList = new ImageList();
nonEmptyImageList.Images.Add(new Bitmap(10, 10));
return nonEmptyImageList;
}
private class SubListView : ListView
{
public new bool CanEnableIme => base.CanEnableIme;