public static class Helpers
{
public const string IsDrawingSupported = nameof(Helpers) + "." + nameof(GetIsDrawingSupported);
+ public const string IsWindowsOrAtLeastLibgdiplus6 = nameof(Helpers) + "." + nameof(GetIsWindowsOrAtLeastLibgdiplus6);
public const string RecentGdiplusIsAvailable = nameof(Helpers) + "." + nameof(GetRecentGdiPlusIsAvailable);
public const string RecentGdiplusIsAvailable2 = nameof(Helpers) + "." + nameof(GetRecentGdiPlusIsAvailable2);
public const string GdiPlusIsAvailableNotRedhat73 = nameof(Helpers) + "." + nameof(GetGdiPlusIsAvailableNotRedhat73);
public static bool GetIsDrawingSupported() => PlatformDetection.IsDrawingSupported;
+ public static bool GetIsWindowsOrAtLeastLibgdiplus6()
+ {
+ if (!PlatformDetection.IsDrawingSupported)
+ {
+ return false;
+ }
+
+ if (PlatformDetection.IsWindows)
+ {
+ return true;
+ }
+
+ Version installedVersion;
+
+ try
+ {
+ installedVersion = new Version(GetLibgdiplusVersion());
+ }
+ catch (EntryPointNotFoundException)
+ {
+ return false;
+ }
+
+ return installedVersion.Major >= 6;
+ }
+
public static bool IsNotUnix => PlatformDetection.IsWindows;
public static bool IsWindowsRS3OrEarlier => !PlatformDetection.IsWindows10Version1803OrGreater;
private const int MONITOR_DEFAULTTOPRIMARY = 1;
+ [DllImport("libgdiplus", ExactSpelling = true)]
+ internal static extern string GetLibgdiplusVersion();
+
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr MonitorFromWindow(IntPtr hWnd, int dwFlags);
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Ctor_NullFilePath_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("path", () => new Bitmap((string)null));
AssertExtensions.Throws<ArgumentNullException>("path", () => new Bitmap((string)null, false));
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData("", "path")]
[InlineData("\0", "path")]
[InlineData("NoSuchPath", null)]
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Bitmap((Stream)null, false));
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Ctor_InvalidBytesInStream_ThrowsArgumentException()
{
using (var stream = new MemoryStream(new byte[0]))
AssertExtensions.Throws<ArgumentException>(null, () => new Bitmap(1, height, 0, PixelFormat.Format16bppArgb1555, IntPtr.Zero));
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(PixelFormat.Undefined - 1)]
[InlineData(PixelFormat.Undefined)]
[InlineData(PixelFormat.Gdi - 1)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void GetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void GetPixel_InvalidY_ThrowsArgumentOutOfRangeException(int y)
AssertExtensions.Throws<ArgumentException>(null, () => bitmap.GetHicon());
}
+ // This test causes an AV on Linux
[ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
public void FromHicon_InvalidHandle_ThrowsArgumentException()
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void MakeTransparent_Icon_ThrowsInvalidOperationException()
{
using (var bitmap = new Bitmap(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void SetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void SetPixel_InvalidY_ThrowsArgumentOutOfRangeException(int y)
Do_LockBits_Invoke_Success(bitmap, rectangle, lockMode, pixelFormat, expectedStride, expectedReserved);
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
+ // This test causes an AV on Unix
+ [ActiveIssue("https://github.com/dotnet/corefx/issues/40224", TestPlatforms.AnyUnix)]
[ConditionalTheory(Helpers.IsDrawingSupported)]
[MemberData(nameof(LockBits_NotUnix_TestData))]
public void LockBits_Invoke_Success_NotUnix(Bitmap bitmap, Rectangle rectangle, ImageLockMode lockMode, PixelFormat pixelFormat, int expectedStride, int expectedReserved)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1, 0, 1, 1)]
[InlineData(2, 0, 1, 1)]
[InlineData(0, -1, 1, 1)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(PixelFormat.DontCare)]
[InlineData(PixelFormat.Max)]
[InlineData(PixelFormat.Indexed)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(PixelFormat.Indexed)]
[InlineData(PixelFormat.Gdi)]
public void UnlockBits_InvalidPixelFormat_Nop(PixelFormat format)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void UnlockBits_NotLocked_ThrowsExternalException()
{
using (var bitmap = new Bitmap(1, 1))
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void UnlockBits_AlreadyUnlocked_ThrowsExternalException()
{
using (var bitmap = new Bitmap(1, 1))
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void BaseCap_ReturnsTriangle()
{
using (AdjustableArrowCap arrowCap = new AdjustableArrowCap(1, 1))
yield return new object[] { fillPath, null, LineCap.Flat, 0f, LineCap.Flat };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Ctor_Path_Path_LineCap_Float_TestData))]
public void Ctor_Path_Path_LineCap_Float(GraphicsPath fillPath, GraphicsPath strokePath, LineCap baseCap, float baseInset, LineCap expectedCap)
{
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
// These values are outside the valid range of the LineCap enum.
[InlineData(LineCap.Flat - 1)]
[InlineData(LineCap.Custom + 1)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(LineCap.SquareAnchor, LineCap.SquareAnchor)]
[InlineData(LineCap.Custom, LineCap.Custom)]
[InlineData(LineCap.Square, LineCap.Custom)]
}
}
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(LineCap.NoAnchor)]
[InlineData(LineCap.SquareAnchor)]
[InlineData(LineCap.RoundAnchor)]
[InlineData(LineCap.Custom)]
[InlineData(LineCap.Flat - 1)]
[InlineData(LineCap.Custom + 1)]
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884")]
public void BaseCap_Set_InvalidLineCap_ThrowsArgumentException(LineCap baseCap)
{
using (GraphicsPath strokePath = new GraphicsPath())
[ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
[ConditionalFact(Helpers.IsDrawingSupported)]
- public void NextSubpath_FigureNotClosed_ReturnsExpeced()
+ public void NextSubpath_FigureNotClosed_ReturnsExpected()
{
using (GraphicsPath gp = new GraphicsPath())
using (GraphicsPathIterator gpi = new GraphicsPathIterator(gp))
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(FillMode.Alternate - 1)]
[InlineData(FillMode.Winding + 1)]
public void GraphicsPath_InvalidFillMode_ThrowsInvalidEnumArgumentException(FillMode fillMode)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(0, 0)]
[InlineData(1, 0)]
[InlineData(0, 1)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(0, 0)]
[InlineData(2, 0)]
[InlineData(0, 2)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_Point_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_Rectangle_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_NegativeSize_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_EmptyString_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_StringNull_ThrowsNullReferenceException()
{
using (GraphicsPath gp = new GraphicsPath())
yield return new object[] { new Point(4, 6), new Point(1, 2), Color.Black, Color.Wheat, new RectangleF(1, 2, 3, 4) };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/32706", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Ctor_Point_TestData))]
public void Ctor_PointF_PointF_Color_Color(Point point1, Point point2, Color color1, Color color2, RectangleF expectedRectangle)
{
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/32706", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Ctor_Point_TestData))]
public void Ctor_Point_Point_Color_Color(Point point1, Point point2, Color color1, Color color2, RectangleF expectedRectangle)
{
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(0, 0)]
[InlineData(1, 1)]
public void Ctor_EqualPoints_ThrowsOutOfMemoryException(int x, int y)
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Blend_GetWithInterpolationColorsSet_ReturnsNull()
{
using (var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true))
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(new float[] { 1 }, new float[] { 1 })]
[InlineData(new float[] { 0 }, new float[] { 0 })]
[InlineData(new float[] { float.MaxValue }, new float[] { float.MaxValue })]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void InterpolationColors_SetBlend_ThrowsArgumentException()
{
using (var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true)
AssertExtensions.Throws<ArgumentException>(null, () => brush.LinearColors = new Color[] { Color.Red, Color.Wheat });
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Rectangle_GetDisposed_ThrowsArgumentException()
{
var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true);
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(MatrixOrder.Prepend)]
[InlineData(MatrixOrder.Append)]
[InlineData(MatrixOrder.Prepend - 1)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(float.NaN)]
[InlineData(float.NegativeInfinity)]
[InlineData(float.PositiveInfinity)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(float.NaN)]
[InlineData(float.PositiveInfinity)]
[InlineData(float.NegativeInfinity)]
yield return new object[] { new Matrix(10, 20, 30, 40, 50, 60), new Matrix(float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue), MatrixOrder.Append, new float[] { float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue } };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Multiply_TestData))]
public void Multiply_Matrix_Success(Matrix matrix, Matrix multiple, MatrixOrder order, float[] expected)
{
yield return new object[] { new Matrix(10, 20, 30, 40, 50, 60), float.MaxValue, float.MaxValue, MatrixOrder.Append, new float[] { float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue } };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Scale_TestData))]
public void Scale_Matrix_Succss(Matrix matrix, float scaleX, float scaleY, MatrixOrder order, float[] expectedElements)
{
yield return new object[] { new Matrix(10, 20, 30, 40, 50, 60), float.MaxValue, float.MaxValue, MatrixOrder.Append, new float[] { float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue } };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Shear_TestData))]
public void Shear_Matrix_Succss(Matrix matrix, float shearX, float shearY, MatrixOrder order, float[] expectedElements)
{
yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), float.MaxValue, float.MaxValue, MatrixOrder.Append, new float[] { 1, 2, 3, 4, float.MaxValue, float.MaxValue } };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Translate_TestData))]
public void Translate_Matrix_Success(Matrix matrix, float offsetX, float offsetY, MatrixOrder order, float[] expectedElements)
{
private readonly PointF[] _defaultFloatPoints = new PointF[2] { new PointF(1, 2), new PointF(20, 30) };
private readonly RectangleF _defaultRectangle = new RectangleF(1, 2, 19, 28);
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Ctor_Points_ReturnsExpected()
{
using (PathGradientBrush bi = new PathGradientBrush(_defaultIntPoints))
yield return new object[] { WrapMode.TileFlipY };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(WrapMode_TestData))]
public void Ctor_PointsWrapMode_ReturnsExpected(WrapMode wrapMode)
{
new PathGradientBrush(_defaultFloatPoints, (WrapMode)int.MaxValue));
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Ctor_Path_ReturnsExpected()
{
using (GraphicsPath path = new GraphicsPath(_defaultFloatPoints, new byte[] { 0, 1 }))
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Clone_ReturnsExpected()
{
using (GraphicsPath path = new GraphicsPath(_defaultFloatPoints, new byte[] { 0, 1 }))
AssertExtensions.Throws<ArgumentException>(null, () => brush.CenterColor = Color.Blue);
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void SurroundColors_ReturnsExpected()
{
Color[] expectedColors = new Color[2] { Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 255, 0, 0) };
yield return new object[] { new float[1] { 1 }, new float[3] { 0, 3, 1 } };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Blend_FactorsPositions_TestData))]
public void Blend_ReturnsExpected(float[] factors, float[] positions)
{
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void InterpolationColors_CannotChange()
{
Color[] colors = new Color[2] { Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 255, 0, 0) };
Assert.Throws<NullReferenceException>(() => new Font(null, FontStyle.Regular));
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Ctor_DisposedFont_Success()
{
using (FontFamily family = FontFamily.GenericSerif)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(GraphicsUnit.Display)]
[InlineData(GraphicsUnit.World - 1)]
[InlineData(GraphicsUnit.Millimeter + 1)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Clone_Invoke_ReturnsExpected()
{
using (FontFamily family = FontFamily.GenericSansSerif)
AssertExtensions.Throws<ArgumentException>(null, () => Font.FromHfont(IntPtr.Zero));
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void GetHeight_Parameterless_ReturnsExpected()
{
using (FontFamily family = FontFamily.GenericSansSerif)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void GetHeight_Graphics_ReturnsExpected()
{
using (FontFamily family = FontFamily.GenericSansSerif)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(FontStyle.Strikeout | FontStyle.Bold | FontStyle.Italic, 255, true, "@", 700)]
[InlineData(FontStyle.Regular, 0, false, "", 400)]
[InlineData(FontStyle.Regular, 10, false, "", 400)]
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "AV Exception is wrapped in a TargetInvocationException in the .NET Framework.")]
public void ToLogFont_NullLogFont_ThrowsArgumentNullException()
{
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void ToLogFont_NullGraphics_ThrowsArgumentNullException()
{
using (FontFamily family = FontFamily.GenericMonospace)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void ToHfont_Disposed_ThrowsArgumentException()
{
using (FontFamily family = FontFamily.GenericSansSerif)
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void ToString_Invoke_ReturnsExpected()
{
using (FontFamily family = FontFamily.GenericSansSerif)
--- /dev/null
+// 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.
+
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing.Text;
+using Xunit;
+
+namespace System.Drawing.Tests
+{
+ public class GdiplusTests
+ {
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsOSX))]
+ public void IsAtLeastLibgdiplus6()
+ {
+ Assert.True(Helpers.GetIsWindowsOrAtLeastLibgdiplus6());
+ }
+ }
+}
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void DrawBezier_Busy_ThrowsInvalidOperationException()
{
using (var image = new Bitmap(10, 10))
}
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void DrawBezier_Disposed_ThrowsArgumentException()
{
using (var image = new Bitmap(10, 10))
yield return new object[] { Color.PapayaWhip, Color.PapayaWhip };
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalTheory(Helpers.IsDrawingSupported)]
+ [ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Colors_TestData))]
public void Ctor_Color(Color color, Color expectedColor)
{
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
}
- [ActiveIssue("https://github.com/dotnet/corefx/issues/20884", TestPlatforms.AnyUnix)]
- [ConditionalFact(Helpers.IsDrawingSupported)]
+ [ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Color_EmptyAndGetDisposed_ThrowsArgumentException()
{
var brush = new SolidBrush(new Color());
<Compile Include="DrawingTest.cs" />
<Compile Include="FontTests.cs" />
<Compile Include="FontFamilyTests.cs" />
+ <Compile Include="GdiplusTests.cs" />
<Compile Include="GraphicsTests.cs" />
<Compile Include="Graphics_DrawBezierTests.cs" />
<Compile Include="Graphics_DrawLineTests.cs" />