From 09239c9245259bc83fb0af7af437d014a73bc4ba Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 10:58:36 +0300 Subject: [PATCH 01/14] Disable some of System.Diagnostics.Tracing.Tests tests due to failures --- .../tests/BasicEventSourceTest/ActivityTracking.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/ActivityTracking.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/ActivityTracking.cs index 1330901b00bff7..409efbedd73bb2 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/ActivityTracking.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/ActivityTracking.cs @@ -14,6 +14,7 @@ namespace BasicEventSourceTests public class ActivityTracking { [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56073", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void StartStopCreatesActivity() { using ActivityEventListener l = new ActivityEventListener(); @@ -27,6 +28,7 @@ public void StartStopCreatesActivity() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56073", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public async Task ActivityFlowsAsync() { using ActivityEventListener l = new ActivityEventListener(); @@ -75,6 +77,7 @@ private async Task YieldTwoActivitiesDeep(ActivityEventSource es) // the future we might decide it wasn't even desirable to begin with. // Compare with SetCurrentActivityIdAfterEventDoesNotFlowAsync below. [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56073", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public async Task SetCurrentActivityIdBeforeEventFlowsAsync() { using ActivityEventListener l = new ActivityEventListener(); @@ -100,6 +103,7 @@ public async Task SetCurrentActivityIdBeforeEventFlowsAsync() // the future we might decide it wasn't even desirable to begin with. // Compare with SetCurrentActivityIdBeforeEventFlowsAsync above. [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56073", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public async Task SetCurrentActivityIdAfterEventDoesNotFlowAsync() { using ActivityEventListener l = new ActivityEventListener(); From 38224c84887919fc70cb0deb25af5616b844c646 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 11:24:42 +0300 Subject: [PATCH 02/14] Disable ImageTests.FromFile_NullFileName_ThrowsArgumentNullException test due to a failure --- src/libraries/System.Drawing.Common/tests/ImageTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Drawing.Common/tests/ImageTests.cs b/src/libraries/System.Drawing.Common/tests/ImageTests.cs index 08cce1156a2e8f..7ecb70c46ce7ff 100644 --- a/src/libraries/System.Drawing.Common/tests/ImageTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ImageTests.cs @@ -520,6 +520,7 @@ public void FromFile_InvalidBytes_ThrowsOutOfMemoryException(byte[] bytes) } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void FromFile_NullFileName_ThrowsArgumentNullException() { AssertExtensions.Throws("path", () => Image.FromFile(null)); From 146049dae5af8be3afacb15a09ce60b5db220e1e Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 11:32:19 +0300 Subject: [PATCH 03/14] Disable System.Runtime.Tests.JitInfoTests.JitInfoIsPopulated test --- .../System.Runtime/tests/System/Runtime/JitInfoTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs b/src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs index f0a7eca83ee67b..f44266ebc1897c 100644 --- a/src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs @@ -38,6 +38,7 @@ private long MakeAndInvokeDynamicSquareMethod(int input) } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // JitInfo metrics will be 0 in AOT scenarios + [ActiveIssue("https://github.com/dotnet/runtime/issues/55712", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void JitInfoIsPopulated() { TimeSpan beforeCompilationTime = System.Runtime.JitInfo.GetCompilationTime(); From 99b22aea13fbc5ccc665f0f7585fd7e69c31eae1 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 14:03:05 +0300 Subject: [PATCH 04/14] Disable System.Drawing.Tests.ImageTests.FromFile_LongSegment_ThrowsException test --- src/libraries/System.Drawing.Common/tests/ImageTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Drawing.Common/tests/ImageTests.cs b/src/libraries/System.Drawing.Common/tests/ImageTests.cs index 7ecb70c46ce7ff..d0c83ec004c418 100644 --- a/src/libraries/System.Drawing.Common/tests/ImageTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ImageTests.cs @@ -535,6 +535,7 @@ public void FromFile_EmptyFileName_ThrowsArgumentNullException() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void FromFile_LongSegment_ThrowsException() { // Throws PathTooLongException on Desktop and FileNotFoundException elsewhere. From 71f614ceb201522b8d0aea8fc10a0c371228a223 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 14:04:00 +0300 Subject: [PATCH 05/14] Exclude System.Runtime.Experimental.Tests test suite due to an app crash --- src/libraries/tests.proj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 5217eb585644b3..285c5a4fee3f22 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -193,6 +193,9 @@ + + + From 48ed88e2ae480da13b9892caf5bedd995eedbcc7 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 14:08:40 +0300 Subject: [PATCH 06/14] Disable System.Drawing.Tests.BrushTests.SetNativeBrush_Brush_Success --- src/libraries/System.Drawing.Common/tests/BrushTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Drawing.Common/tests/BrushTests.cs b/src/libraries/System.Drawing.Common/tests/BrushTests.cs index 3060b851061822..182944236a55f0 100644 --- a/src/libraries/System.Drawing.Common/tests/BrushTests.cs +++ b/src/libraries/System.Drawing.Common/tests/BrushTests.cs @@ -8,6 +8,7 @@ namespace System.Drawing.Tests public class BrushTests { [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void SetNativeBrush_Brush_Success() { using (var brush = new SubBrush()) From 3c7d0c403f87dcb428869906de293064039552dc Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 14:40:25 +0300 Subject: [PATCH 07/14] Disable some of System.Tests.OperatingSystemTests test on MacCatalyst --- .../tests/System/OperatingSystemTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs b/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs index 405cf4373f9b8d..40fea32233194e 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/OperatingSystemTests.cs @@ -102,9 +102,11 @@ public static void IsOSPlatformVersionAtLeast_InvalidArgs_Throws() public static void TestIsOSVersionAtLeast_Android_21() => Assert.True(OperatingSystem.IsAndroidVersionAtLeast(21)); // 21 is our min supported version [Fact, PlatformSpecific(TestPlatforms.iOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSPlatform_IOS() => TestIsOSPlatform("iOS", OperatingSystem.IsIOS); [Fact, PlatformSpecific(TestPlatforms.iOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSVersionAtLeast_IOS() => TestIsOSVersionAtLeast("iOS"); [Fact, PlatformSpecific(TestPlatforms.OSX)] @@ -127,9 +129,11 @@ public static void OSX_Is_Treated_as_macOS() } [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSPlatform_MacCatalyst() => TestIsOSPlatform("MacCatalyst", OperatingSystem.IsMacCatalyst); [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void TestIsOSVersionAtLeast_MacCatalyst() => TestIsOSVersionAtLeast("MacCatalyst"); [Fact, PlatformSpecific(TestPlatforms.MacCatalyst)] @@ -143,6 +147,7 @@ public static void MacCatalyst_Is_Also_iOS() } [Fact, PlatformSpecific(TestPlatforms.iOS)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56084", TestPlatforms.MacCatalyst)] public static void IOS_Is_Not_Also_MacCatalyst() { Assert.False(OperatingSystem.IsOSPlatform("MacCatalyst")); From 3d78e69628c619987a960d9227194a0ca7f3d4af Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 14:54:06 +0300 Subject: [PATCH 08/14] Disable System.Text.Json.SourceGeneration.Tests on MacCatalyst due to a crash --- src/libraries/tests.proj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 285c5a4fee3f22..6e39e1b2d12263 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -228,6 +228,9 @@ + + + From 49eb71172ee1f28fabeb91daaa70796a371511db Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 17:45:19 +0300 Subject: [PATCH 09/14] Disable System.Drawing.Drawing2D.Tests.HatchBrushTests.Ctor_InvalidHatchStyle_ThrowsArgumentException --- .../System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs b/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs index 8ed7826c2fb7ea..4df1bdba99f0f5 100644 --- a/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs +++ b/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs @@ -54,6 +54,7 @@ public void Ctor_HatchStyle_ForeColor_BackColor(HatchStyle hatchStyle, Color for [Theory] [InlineData(HatchStyle.Horizontal -1 )] [InlineData(HatchStyle.SolidDiamond + 1)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void Ctor_InvalidHatchStyle_ThrowsArgumentException(HatchStyle hatchStyle) { AssertExtensions.Throws("hatchstyle", null, () => new HatchBrush(hatchStyle, Color.Empty)); From f6972808fdef88bf6bd35e3c0b127dd49cff5228 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 20:52:34 +0300 Subject: [PATCH 10/14] Disable System.Drawing.Tests.ImageTests.FromFile_NoSuchFile_ThrowsFileNotFoundException test --- src/libraries/System.Drawing.Common/tests/ImageTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Drawing.Common/tests/ImageTests.cs b/src/libraries/System.Drawing.Common/tests/ImageTests.cs index d0c83ec004c418..0c5182acc5046e 100644 --- a/src/libraries/System.Drawing.Common/tests/ImageTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ImageTests.cs @@ -558,6 +558,7 @@ public void FromFile_LongSegment_ThrowsException() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void FromFile_NoSuchFile_ThrowsFileNotFoundException() { Assert.Throws(() => Image.FromFile("NoSuchFile")); From 5aa66f141d7f811cf386daa8d072ce7874cb35be Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Wed, 21 Jul 2021 21:24:34 +0300 Subject: [PATCH 11/14] Use IsDrawingSupported helper for System.Drawing.Common tests --- src/libraries/System.Drawing.Common/tests/BrushTests.cs | 3 +-- .../tests/Drawing2D/HatchBrushTests.cs | 3 +-- src/libraries/System.Drawing.Common/tests/ImageTests.cs | 9 +++------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libraries/System.Drawing.Common/tests/BrushTests.cs b/src/libraries/System.Drawing.Common/tests/BrushTests.cs index 182944236a55f0..5cf621afa229ba 100644 --- a/src/libraries/System.Drawing.Common/tests/BrushTests.cs +++ b/src/libraries/System.Drawing.Common/tests/BrushTests.cs @@ -7,8 +7,7 @@ namespace System.Drawing.Tests { public class BrushTests { - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void SetNativeBrush_Brush_Success() { using (var brush = new SubBrush()) diff --git a/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs b/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs index 4df1bdba99f0f5..09aeae84fe2cd7 100644 --- a/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs +++ b/src/libraries/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs @@ -51,10 +51,9 @@ public void Ctor_HatchStyle_ForeColor_BackColor(HatchStyle hatchStyle, Color for } } - [Theory] + [ConditionalTheory(Helpers.IsDrawingSupported)] [InlineData(HatchStyle.Horizontal -1 )] [InlineData(HatchStyle.SolidDiamond + 1)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] public void Ctor_InvalidHatchStyle_ThrowsArgumentException(HatchStyle hatchStyle) { AssertExtensions.Throws("hatchstyle", null, () => new HatchBrush(hatchStyle, Color.Empty)); diff --git a/src/libraries/System.Drawing.Common/tests/ImageTests.cs b/src/libraries/System.Drawing.Common/tests/ImageTests.cs index 0c5182acc5046e..be3fa64746bb22 100644 --- a/src/libraries/System.Drawing.Common/tests/ImageTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ImageTests.cs @@ -519,8 +519,7 @@ public void FromFile_InvalidBytes_ThrowsOutOfMemoryException(byte[] bytes) } } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void FromFile_NullFileName_ThrowsArgumentNullException() { AssertExtensions.Throws("path", () => Image.FromFile(null)); @@ -534,8 +533,7 @@ public void FromFile_EmptyFileName_ThrowsArgumentNullException() AssertExtensions.Throws("path", null, () => Image.FromFile(string.Empty, useEmbeddedColorManagement: true)); } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void FromFile_LongSegment_ThrowsException() { // Throws PathTooLongException on Desktop and FileNotFoundException elsewhere. @@ -557,8 +555,7 @@ public void FromFile_LongSegment_ThrowsException() } } - [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/56048", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void FromFile_NoSuchFile_ThrowsFileNotFoundException() { Assert.Throws(() => Image.FromFile("NoSuchFile")); From 8864f7d542dfe66f671aebf08d27653b2835b683 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Thu, 22 Jul 2021 14:03:36 +0300 Subject: [PATCH 12/14] Annotate the entire System.Drawing.Tests.ImageTests class with PlatformDetection.IsDrawingSupported --- src/libraries/System.Drawing.Common/tests/ImageTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Drawing.Common/tests/ImageTests.cs b/src/libraries/System.Drawing.Common/tests/ImageTests.cs index be3fa64746bb22..c679f1a3befca1 100644 --- a/src/libraries/System.Drawing.Common/tests/ImageTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ImageTests.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using System.Collections.Generic; using System.Drawing.Imaging; using System.IO; @@ -13,6 +14,7 @@ namespace System.Drawing.Tests { + [ConditionalClass(typeof(PlatformDetection),nameof(PlatformDetection.IsDrawingSupported))] public class ImageTests { private const int PropertyTagLuminanceTable = 0x5090; From e5d8808bfb6be96cbcb0df6b41b8189e0112778a Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Thu, 22 Jul 2021 17:18:14 +0300 Subject: [PATCH 13/14] Remove individual method annotations in favor of class annotation --- .../System.Drawing.Common/tests/ImageTests.cs | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/libraries/System.Drawing.Common/tests/ImageTests.cs b/src/libraries/System.Drawing.Common/tests/ImageTests.cs index c679f1a3befca1..b5a53d6c081931 100644 --- a/src/libraries/System.Drawing.Common/tests/ImageTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ImageTests.cs @@ -24,7 +24,7 @@ public class ImageTests private const int PropertyTagTypeShort = 3; [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void PropertyIdList_GetBitmapJpg_Success() { using var bitmap = new Bitmap(Helpers.GetTestBitmapPath("nature24bits.jpg")); @@ -32,7 +32,7 @@ public void PropertyIdList_GetBitmapJpg_Success() Assert.NotSame(bitmap.PropertyIdList, bitmap.PropertyIdList); } - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Returns new int[0] in .NET Framework.")] public void PropertyIdList_GetEmptyMemoryBitmap_ReturnsExpected() { @@ -42,7 +42,7 @@ public void PropertyIdList_GetEmptyMemoryBitmap_ReturnsExpected() } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void PropertyItems_GetBitmapJpg_Success() { using var bitmap = new Bitmap(Helpers.GetTestBitmapPath("nature24bits.jpg")); @@ -84,7 +84,7 @@ public void PropertyItems_GetBitmapJpg_Success() Assert.NotSame(items, bitmap.PropertyItems); } - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Returns new PropertyItem[0] in .NET Framework.")] public void PropertyItems_GetEmptyBitmapBmp_Success() { @@ -93,7 +93,7 @@ public void PropertyItems_GetEmptyBitmapBmp_Success() Assert.Same(bitmap.PropertyItems, bitmap.PropertyItems); } - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Returns new PropertyItem[0] in .NET Framework.")] public void PropertyItems_GetEmptyMemoryBitmap_ReturnsExpected() { @@ -103,7 +103,7 @@ public void PropertyItems_GetEmptyMemoryBitmap_ReturnsExpected() } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void GetPropertyItem_InvokeExistsBitmapBmp_Success() { using var bitmap = new Bitmap(Helpers.GetTestBitmapPath("nature24bits.jpg")); @@ -114,7 +114,7 @@ public void GetPropertyItem_InvokeExistsBitmapBmp_Success() Assert.Equal("LEAD Technologies Inc. V1.01\0", Encoding.ASCII.GetString(item.Value)); } - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -124,7 +124,7 @@ public void GetPropertyItem_NoSuchPropertyItemEmptyMemoryBitmap_ThrowsArgumentEx Assert.Throws(null, () => bitmap.GetPropertyItem(propid)); } - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -135,7 +135,7 @@ public void GetPropertyItem_NoSuchPropertyItemEmptyImageBitmapBmp_ThrowsArgument } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void RemovePropertyItem_InvokeMemoryBitmap_Success() { using var source = new Bitmap(Helpers.GetTestBitmapPath("nature24bits.jpg")); @@ -164,7 +164,7 @@ public void RemovePropertyItem_InvokeMemoryBitmap_Success() } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void RemovePropertyItem_InvokeBitmapJpg_Success() { using var bitmap = new Bitmap(Helpers.GetTestBitmapPath("nature24bits.jpg")); @@ -185,7 +185,7 @@ public void RemovePropertyItem_InvokeBitmapJpg_Success() } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -196,7 +196,7 @@ public void RemovePropertyItem_NoSuchPropertyItemEmptyMemoryBitmap_ThrowsExterna } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -207,7 +207,7 @@ public void RemovePropertyItem_NoSuchPropertyItemEmptyImageBitmapBmp_ThrowsExter } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -226,7 +226,7 @@ public void RemovePropertyItem_NoSuchPropertyNotEmptyMemoryBitmap_ThrowsArgument } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -237,7 +237,7 @@ public void RemovePropertyItem_NoSuchPropertyNotEmptyBitmapJpg_ThrowsArgumentExc } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -297,7 +297,7 @@ public void SetPropertyItem_InvokeMemoryBitmap_Success(int propid) } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -440,7 +440,7 @@ public void SetPropertyItem_InvokeBitmapJpg_Success(int propid) } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [InlineData(0)] [InlineData(1)] [InlineData(-1)] @@ -510,7 +510,7 @@ public static IEnumerable InvalidBytes_TestData() } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [MemberData(nameof(InvalidBytes_TestData))] public void FromFile_InvalidBytes_ThrowsOutOfMemoryException(byte[] bytes) { @@ -521,7 +521,7 @@ public void FromFile_InvalidBytes_ThrowsOutOfMemoryException(byte[] bytes) } } - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void FromFile_NullFileName_ThrowsArgumentNullException() { AssertExtensions.Throws("path", () => Image.FromFile(null)); @@ -535,7 +535,7 @@ public void FromFile_EmptyFileName_ThrowsArgumentNullException() AssertExtensions.Throws("path", null, () => Image.FromFile(string.Empty, useEmbeddedColorManagement: true)); } - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void FromFile_LongSegment_ThrowsException() { // Throws PathTooLongException on Desktop and FileNotFoundException elsewhere. @@ -557,7 +557,7 @@ public void FromFile_LongSegment_ThrowsException() } } - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void FromFile_NoSuchFile_ThrowsFileNotFoundException() { Assert.Throws(() => Image.FromFile("NoSuchFile")); @@ -566,7 +566,7 @@ public void FromFile_NoSuchFile_ThrowsFileNotFoundException() [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] [ActiveIssue("https://github.com/dotnet/runtime/issues/34591", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [MemberData(nameof(InvalidBytes_TestData))] public void FromStream_InvalidBytes_ThrowsArgumentException(byte[] bytes) { @@ -665,7 +665,7 @@ public static IEnumerable GetEncoderParameterList_ReturnsExpected_Test } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [ConditionalTheory(Helpers.IsDrawingSupported)] + [Theory] [MemberData(nameof(GetEncoderParameterList_ReturnsExpected_TestData))] public void GetEncoderParameterList_ReturnsExpected(ImageFormat format, Guid[] expectedParameters) { @@ -688,7 +688,7 @@ public void GetEncoderParameterList_ReturnsExpected(ImageFormat format, Guid[] e } [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework throws ExternalException")] - [ConditionalFact(Helpers.IsDrawingSupported)] + [Fact] public void Save_InvalidDirectory_ThrowsDirectoryNotFoundException() { using (var bitmap = new Bitmap(1, 1)) From a5660f2610eef4175fb9d353ea461b151e13e02b Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Thu, 22 Jul 2021 19:05:03 +0300 Subject: [PATCH 14/14] Move back conditional theory attribute for System.Drawing.Tests.ImageTests.GetEncoderParameterList_ReturnsExpected test method --- src/libraries/System.Drawing.Common/tests/ImageTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Drawing.Common/tests/ImageTests.cs b/src/libraries/System.Drawing.Common/tests/ImageTests.cs index b5a53d6c081931..5357e9a48b3709 100644 --- a/src/libraries/System.Drawing.Common/tests/ImageTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ImageTests.cs @@ -665,7 +665,7 @@ public static IEnumerable GetEncoderParameterList_ReturnsExpected_Test } [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)] - [Theory] + [ConditionalTheory(Helpers.IsDrawingSupported)] [MemberData(nameof(GetEncoderParameterList_ReturnsExpected_TestData))] public void GetEncoderParameterList_ReturnsExpected(ImageFormat format, Guid[] expectedParameters) {