* Experiment 2

* Build property

* Add Xunit.Runner.Jason.

* Seperate Cursor changes from tests.

* Update Directory.Build.props

Co-authored-by: Jeremy Kuhne <jkuhne@microsoft.com>

* Add tracking bug.

---------

Co-authored-by: Jeremy Kuhne <jkuhne@microsoft.com>
This commit is contained in:
Devendar Reddy Adulla 2023-03-16 14:41:46 -07:00 коммит произвёл GitHub
Родитель 6167d44995
Коммит 1a220e9268
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 46 добавлений и 60 удалений

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

@ -28,6 +28,11 @@
<EnableTrimAnalyzer Condition="$(IsTestProject) or $(IsAnalyzerProject) or $(MSBuildProjectDirectory.Contains('\tests\'))">false</EnableTrimAnalyzer>
</PropertyGroup>
<!-- Making all tests run sequentially until we regroup tests. Tracked under issue https://github.com/dotnet/winforms/issues/8810. -->
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<XUnitCoreSettingsFile>$(RepositoryEngineeringDir)xunit.runner.json</XUnitCoreSettingsFile>
</PropertyGroup>
<!--
Set assembly version to align with major and minor version, as for the patches and revisions should be manually
updated per assembly if it is serviced.

5
eng/xunit.runner.json Normal file
Просмотреть файл

@ -0,0 +1,5 @@
{
"maxParallelThreads": 1,
"parallelizeTestCollections": false,
"re-run-failed-tests": 1
}

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

@ -7,7 +7,6 @@ using System.Windows.Forms.Primitives;
namespace System.Windows.Forms.Tests
{
[Collection(nameof(SynchronousCollection))]
public class LocalAppContextSwitchesTest
{
private void ResetLocalSwitches(dynamic testAccessor)

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

@ -1,13 +0,0 @@
// Licensed to the.NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Windows.Forms.Tests
{
[CollectionDefinition(nameof(SynchronousCollection), DisableParallelization = true)]
public class SynchronousCollection
{
// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition]
}
}

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

@ -47,9 +47,6 @@
<None Update="Resources\move.bmp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

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

@ -1,4 +0,0 @@
{
"maxParallelThreads": 1,
"parallelizeTestCollections": false
}

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

@ -73,8 +73,7 @@ namespace System.Windows.Forms.Tests
State.PenColor(SystemColors.ControlDark)));
}
[WinFormsFact(Skip = "TODO, refer to https://github.com/dotnet/winforms/issues/4212")]
[ActiveIssue("https://github.com/dotnet/winforms/issues/4212")]
[WinFormsFact]
public unsafe void Button_VisualStyles_on_Default_LineDrawing()
{
if (!Application.RenderWithVisualStyles)

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

@ -268,8 +268,7 @@ namespace System.Windows.Forms.Tests
Assert.True(Clipboard.ContainsData(data.GetType().FullName));
}
[ActiveIssue("https://github.com/dotnet/winforms/issues/6729")]
[WinFormsTheory(Skip = "Flaky tests, see: https://github.com/dotnet/winforms/issues/6729")]
[WinFormsTheory]
[InlineData(1, true)]
[InlineData(1, false)]
[InlineData("data", true)]

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

@ -25,7 +25,7 @@ public unsafe class COM2FontConverterTests
default,
default);
[Fact(Skip = "https://github.com/dotnet/winforms/issues/8632")]
[Fact]
public void COM2FontConverter_ConvertNativeToManaged()
{
fixed (char* n = "Arial")
@ -44,6 +44,9 @@ public unsafe class COM2FontConverterTests
Com2FontConverter converter = new();
using Font font = (Font)converter.ConvertNativeToManaged(wrapper, s_stubDescriptor);
// Converter might have failed and returned DefaultFont.
Assert.NotEqual(font, Control.DefaultFont);
Assert.Equal("Arial", font.Name);
Assert.Equal(12, font.Size);
@ -54,7 +57,7 @@ public unsafe class COM2FontConverterTests
}
}
[Fact (Skip = "Flaky test being investigated. See:https://github.com/dotnet/winforms/issues/8602")]
[Fact]
public void COM2FontConverter_ConvertManagedToNative()
{
fixed (char* n = "Arial")

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

@ -134,7 +134,7 @@ namespace System.Windows.Forms.Tests.ComponentModel.Com2Interop
Assert.Same(exclamationIcon, Instance.ConvertNativeToManaged(picture, null));
}
[Fact(Skip = "Flaky test being investigated. see:https://github.com/dotnet/winforms/issues/8609")]
[Fact]
public unsafe void ConvertManagedToNative_Bitmap()
{
bool cancelSet = true;

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

@ -74,26 +74,26 @@ public class CursorTests
Assert.Null(cursor.Tag);
}
[Fact]
public void Cursor_Ctor_Stream_NonStartPosition()
{
using var stream = new MemoryStream(File.ReadAllBytes(Path.Combine("bitmaps", "cursor.cur")));
stream.Position = 5;
using var cursor = new Cursor(stream);
Assert.NotNull(cursor);
}
[Fact]
public void Cursor_Ctor_Stream_NonStartPosition()
{
using var stream = new MemoryStream(File.ReadAllBytes(Path.Combine("bitmaps", "cursor.cur")));
stream.Position = 5;
using var cursor = new Cursor(stream);
Assert.NotNull(cursor);
}
[Fact]
public void Cursor_Ctor_EmptyStream_ThrowsArgumentException()
{
Assert.Throws<ArgumentException>("stream", () => new Cursor(new MemoryStream()));
}
[Fact]
public void Cursor_Ctor_EmptyStream_ThrowsArgumentException()
{
Assert.Throws<ArgumentException>("stream", () => new Cursor(new MemoryStream()));
}
[Fact]
public void Cursor_Ctor_NullStream_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>("stream", () => new Cursor((Stream)null));
}
[Fact]
public void Cursor_Ctor_NullStream_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>("stream", () => new Cursor((Stream)null));
}
public static IEnumerable<object[]> Ctor_InvalidFile_TestData()
{
@ -357,6 +357,7 @@ public class CursorTests
{
var cursor = new Cursor(2);
cursor.Dispose();
Assert.Throws<ObjectDisposedException>(() => cursor.Handle);
Assert.Throws<ObjectDisposedException>(() => cursor.HotSpot);

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

@ -22,7 +22,7 @@ namespace System.Windows.Forms.Tests
yield return new object[] { I(() => Cursors.Default) };
yield return new object[] { I(() => Cursors.Hand) };
yield return new object[] { I(() => Cursors.Help) };
yield return new object[] { I(() => Cursors.HSplit) };
// yield return new object[] { I(() => Cursors.HSplit) }; Tracking issue: https://github.com/dotnet/winforms/issues/8810.
yield return new object[] { I(() => Cursors.IBeam) };
yield return new object[] { I(() => Cursors.No) };
yield return new object[] { I(() => Cursors.NoMove2D) };
@ -42,7 +42,7 @@ namespace System.Windows.Forms.Tests
yield return new object[] { I(() => Cursors.SizeNWSE) };
yield return new object[] { I(() => Cursors.SizeWE) };
yield return new object[] { I(() => Cursors.UpArrow) };
yield return new object[] { I(() => Cursors.VSplit) };
// yield return new object[] { I(() => Cursors.VSplit) }; Tracking issue: https://github.com/dotnet/winforms/issues/8810.
yield return new object[] { I(() => Cursors.WaitCursor) };
}

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

@ -230,7 +230,7 @@ namespace System.Windows.Forms.Tests
public static TheoryData ExpectedCursorNames()
=> (TheoryData)s_expectedCursorNames.Split(Environment.NewLine).ToTheoryData();
[Theory(Skip = "Flaky test being investigated. See: https://github.com/dotnet/winforms/issues/8601")]
[Theory]
[MemberData(nameof(ExpectedCursorNames))]
public void EmbeddedResource_ResourcesExist_Cursor(string resourceName)
{

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

@ -746,7 +746,7 @@ namespace System.Windows.Forms.Tests
Assert.False(control.IsHandleCreated);
}
[WinFormsFact(Skip = " Flaky test being investigated. See:https://github.com/dotnet/winforms/issues/8611")]
[WinFormsFact]
public void MenuStrip_WndProc_InvokeMouseActivate_Success()
{
using var control = new SubMenuStrip();

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

@ -456,8 +456,7 @@ namespace System.Windows.Forms.Tests
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (TextFormatFlags)int.MaxValue };
}
[ActiveIssue("https://github.com/dotnet/winforms/issues/3647")]
[WinFormsTheory(Skip = "Flaky tests, see: https://github.com/dotnet/winforms/issues/3647")]
[WinFormsTheory]
[MemberData(nameof(MeasureText_String_Font_Size_TextFormatFlags_TestData))]
public void TextRenderer_MeasureText_InvokeStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize, TextFormatFlags flags)
{
@ -484,8 +483,7 @@ namespace System.Windows.Forms.Tests
Assert.Equal(result, TextRenderer.MeasureText(graphics, text, font));
}
[ActiveIssue("https://github.com/dotnet/winforms/issues/3647")]
[WinFormsTheory(Skip = "Flaky tests, see: https://github.com/dotnet/winforms/issues/3647")]
[WinFormsTheory]
[MemberData(nameof(MeasureText_String_Font_Size_TestData))]
public void TextRenderer_MeasureText_InvokeIDeviceContextStringFontSize_ReturnsExpected(string text, Font font, Size proposedSize)
{
@ -500,8 +498,7 @@ namespace System.Windows.Forms.Tests
Assert.Equal(result, TextRenderer.MeasureText(graphics, text, font, proposedSize));
}
[ActiveIssue("https://github.com/dotnet/winforms/issues/3647")]
[WinFormsTheory(Skip = "Flaky tests, see: https://github.com/dotnet/winforms/issues/3647")]
[WinFormsTheory]
[MemberData(nameof(MeasureText_String_Font_Size_TextFormatFlags_TestData))]
public void TextRenderer_MeasureText_InvokeIDeviceContextStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize, TextFormatFlags flags)
{

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

@ -7103,8 +7103,7 @@ namespace System.Windows.Forms.Tests
Assert.Throws<NotSupportedException>(() => control.SetItemLocation(item, Point.Empty));
}
[ActiveIssue("https://github.com/dotnet/winforms/issues/6610")]
[WinFormsFact(Skip = "Flaky tests, see: https://github.com/dotnet/winforms/issues/6610")]
[WinFormsFact]
public void ToolStrip_WndProc_InvokeMouseActivate_Success()
{
using var control = new SubToolStrip();
@ -7118,8 +7117,7 @@ namespace System.Windows.Forms.Tests
Assert.True(control.IsHandleCreated);
}
[ActiveIssue("https://github.com/dotnet/winforms/issues/6610")]
[WinFormsFact(Skip = "Flaky tests, see: https://github.com/dotnet/winforms/issues/6610")]
[WinFormsFact]
public void ToolStrip_WndProc_InvokeMouseActivateWithHandle_Success()
{
using var control = new SubToolStrip();