Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename IsAtLeastLibgdiplus6 to IsWindowsOrAtLeastLibgdiplus6
  • Loading branch information
qmfrederik committed Feb 14, 2020
commit dbbee75ce83a6e49eac75707f0d3c6a06eb29ca8
4 changes: 2 additions & 2 deletions src/libraries/Common/tests/System/Drawing/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace System.Drawing
public static class Helpers
{
public const string IsDrawingSupported = nameof(Helpers) + "." + nameof(GetIsDrawingSupported);
public const string IsAtLeastLibgdiplus6 = nameof(Helpers) + "." + nameof(GetIsAtLeastLibgdiplus6);
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);
Expand All @@ -23,7 +23,7 @@ public static class Helpers

public static bool GetIsDrawingSupported() => PlatformDetection.IsDrawingSupported;

public static bool GetIsAtLeastLibgdiplus6()
public static bool GetIsWindowsOrAtLeastLibgdiplus6()
{
if (!PlatformDetection.IsDrawingSupported)
{
Expand Down
28 changes: 14 additions & 14 deletions src/libraries/System.Drawing.Common/tests/BitmapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ public void Ctor_FilePath_UseIcm(string filename, int width, int height, PixelFo
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[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));
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData("", "path")]
[InlineData("\0", "path")]
[InlineData("NoSuchPath", null)]
Expand Down Expand Up @@ -157,7 +157,7 @@ public void Ctor_NullStream_ThrowsArgumentNullException()
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Bitmap((Stream)null, false));
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Ctor_InvalidBytesInStream_ThrowsArgumentException()
{
using (var stream = new MemoryStream(new byte[0]))
Expand Down Expand Up @@ -263,7 +263,7 @@ public void Ctor_InvalidHeight_ThrowsArgumentException(int height)
AssertExtensions.Throws<ArgumentException>(null, () => new Bitmap(1, height, 0, PixelFormat.Format16bppArgb1555, IntPtr.Zero));
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(PixelFormat.Undefined - 1)]
[InlineData(PixelFormat.Undefined)]
[InlineData(PixelFormat.Gdi - 1)]
Expand Down Expand Up @@ -610,7 +610,7 @@ public void GetPixel_ValidPixelFormat_Success(Bitmap bitmap, int x, int y, Color
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void GetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x)
Expand All @@ -621,7 +621,7 @@ public void GetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x)
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void GetPixel_InvalidY_ThrowsArgumentOutOfRangeException(int y)
Expand Down Expand Up @@ -963,7 +963,7 @@ public void MakeTransparent_GrayscalePixelFormat_ThrowsArgumentException()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void MakeTransparent_Icon_ThrowsInvalidOperationException()
{
using (var bitmap = new Bitmap(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
Expand Down Expand Up @@ -998,7 +998,7 @@ public void SetPixel_IndexedPixelFormat_ThrowsInvalidOperationException(PixelFor
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void SetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x)
Expand All @@ -1009,7 +1009,7 @@ public void SetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x)
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1)]
[InlineData(1)]
public void SetPixel_InvalidY_ThrowsArgumentOutOfRangeException(int y)
Expand Down Expand Up @@ -1200,7 +1200,7 @@ public void LockBits_NullBitmapData_ThrowsArgumentException()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(-1, 0, 1, 1)]
[InlineData(2, 0, 1, 1)]
[InlineData(0, -1, 1, 1)]
Expand All @@ -1224,7 +1224,7 @@ public void LockBits_InvalidRect_ThrowsArgumentException(int x, int y, int width
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(PixelFormat.DontCare)]
[InlineData(PixelFormat.Max)]
[InlineData(PixelFormat.Indexed)]
Expand Down Expand Up @@ -1338,7 +1338,7 @@ public void UnlockBits_Scan0Zero_Nop()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(PixelFormat.Indexed)]
[InlineData(PixelFormat.Gdi)]
public void UnlockBits_InvalidPixelFormat_Nop(PixelFormat format)
Expand All @@ -1361,7 +1361,7 @@ public void UnlockBits_NullBitmapData_ThrowsArgumentException()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void UnlockBits_NotLocked_ThrowsExternalException()
{
using (var bitmap = new Bitmap(1, 1))
Expand All @@ -1370,7 +1370,7 @@ public void UnlockBits_NotLocked_ThrowsExternalException()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void UnlockBits_AlreadyUnlocked_ThrowsExternalException()
{
using (var bitmap = new Bitmap(1, 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void Clone_Success()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void BaseCap_ReturnsTriangle()
{
using (AdjustableArrowCap arrowCap = new AdjustableArrowCap(1, 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static IEnumerable<object[]> Ctor_Path_Path_LineCap_Float_TestData()
yield return new object[] { fillPath, null, LineCap.Flat, 0f, LineCap.Flat };
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[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)
{
Expand All @@ -56,7 +56,7 @@ public void Ctor_Path_Path_LineCap_Float(GraphicsPath fillPath, GraphicsPath str
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
// These values are outside the valid range of the LineCap enum.
[InlineData(LineCap.Flat - 1)]
[InlineData(LineCap.Custom + 1)]
Expand Down Expand Up @@ -112,7 +112,7 @@ public void SetThenGetStrokeCaps_Success(LineCap startCap, LineCap endCap)
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(LineCap.SquareAnchor, LineCap.SquareAnchor)]
[InlineData(LineCap.Custom, LineCap.Custom)]
[InlineData(LineCap.Square, LineCap.Custom)]
Expand Down Expand Up @@ -166,7 +166,7 @@ public void BaseCap_SetThenGet_Success(LineCap baseCap)
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(LineCap.NoAnchor)]
[InlineData(LineCap.SquareAnchor)]
[InlineData(LineCap.RoundAnchor)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void GraphicsPath_FillModeChange()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(FillMode.Alternate - 1)]
[InlineData(FillMode.Winding + 1)]
public void GraphicsPath_InvalidFillMode_ThrowsInvalidEnumArgumentException(FillMode fillMode)
Expand Down Expand Up @@ -418,7 +418,7 @@ public void AddArc_Rectangle_Success()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(0, 0)]
[InlineData(1, 0)]
[InlineData(0, 1)]
Expand Down Expand Up @@ -1026,7 +1026,7 @@ public void AddPie_Values_Success()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(0, 0)]
[InlineData(2, 0)]
[InlineData(0, 2)]
Expand Down Expand Up @@ -1162,7 +1162,7 @@ public void AddPath_PathNull_ThrowsArgumentNullException()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_Point_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
Expand All @@ -1176,7 +1176,7 @@ public void AddString_Point_Success()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_Rectangle_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
Expand All @@ -1190,7 +1190,7 @@ public void AddString_Rectangle_Success()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_NegativeSize_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
Expand Down Expand Up @@ -1231,7 +1231,7 @@ public void AddString_StringFormat_Success()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_EmptyString_Success()
{
using (GraphicsPath gpi = new GraphicsPath())
Expand All @@ -1245,7 +1245,7 @@ public void AddString_EmptyString_Success()
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void AddString_StringNull_ThrowsNullReferenceException()
{
using (GraphicsPath gp = new GraphicsPath())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static IEnumerable<object[]> Ctor_Point_TestData()
yield return new object[] { new Point(4, 6), new Point(1, 2), Color.Black, Color.Wheat, new RectangleF(1, 2, 3, 4) };
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[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)
{
Expand Down Expand Up @@ -56,7 +56,7 @@ public void Ctor_PointF_PointF_Color_Color_FloatRanges()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[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)
{
Expand All @@ -75,7 +75,7 @@ public void Ctor_Point_Point_Color_Color(Point point1, Point point2, Color color
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(0, 0)]
[InlineData(1, 1)]
public void Ctor_EqualPoints_ThrowsOutOfMemoryException(int x, int y)
Expand Down Expand Up @@ -279,7 +279,7 @@ public void Clone_Disposed_ThrowsArgumentException()
AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[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))
Expand All @@ -295,7 +295,7 @@ public void Blend_GetWithInterpolationColorsSet_ReturnsNull()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[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 })]
Expand Down Expand Up @@ -562,7 +562,7 @@ public void InterpolationColors_SetBlendTriangularShape_ThrowsArgumentException(
}
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[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)
Expand Down Expand Up @@ -625,7 +625,7 @@ public void LinearColors_GetSetDisposed_ThrowsArgumentException()
AssertExtensions.Throws<ArgumentException>(null, () => brush.LinearColors = new Color[] { Color.Red, Color.Wheat });
}

[ConditionalFact(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalFact(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
public void Rectangle_GetDisposed_ThrowsArgumentException()
{
var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true);
Expand Down Expand Up @@ -741,7 +741,7 @@ public void MultiplyTransform_NoOrder_Success()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(MatrixOrder.Prepend)]
[InlineData(MatrixOrder.Append)]
[InlineData(MatrixOrder.Prepend - 1)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Ctor_Default()
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(float.NaN)]
[InlineData(float.NegativeInfinity)]
[InlineData(float.PositiveInfinity)]
Expand Down Expand Up @@ -253,7 +253,7 @@ public void Invert_Matrix_Success(Matrix matrix, float[] expectedElements)
}
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[InlineData(float.NaN)]
[InlineData(float.PositiveInfinity)]
[InlineData(float.NegativeInfinity)]
Expand Down Expand Up @@ -320,7 +320,7 @@ public static IEnumerable<object[]> Multiply_TestData()
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 } };
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Multiply_TestData))]
public void Multiply_Matrix_Success(Matrix matrix, Matrix multiple, MatrixOrder order, float[] expected)
{
Expand Down Expand Up @@ -575,7 +575,7 @@ public static IEnumerable<object[]> Scale_TestData()
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 } };
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Scale_TestData))]
public void Scale_Matrix_Succss(Matrix matrix, float scaleX, float scaleY, MatrixOrder order, float[] expectedElements)
{
Expand Down Expand Up @@ -651,7 +651,7 @@ public static IEnumerable<object[]> Shear_TestData()
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 } };
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Shear_TestData))]
public void Shear_Matrix_Succss(Matrix matrix, float shearX, float shearY, MatrixOrder order, float[] expectedElements)
{
Expand Down Expand Up @@ -719,7 +719,7 @@ public static IEnumerable<object[]> Translate_TestData()
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 } };
}

[ConditionalTheory(Helpers.IsAtLeastLibgdiplus6)]
[ConditionalTheory(Helpers.IsWindowsOrAtLeastLibgdiplus6)]
[MemberData(nameof(Translate_TestData))]
public void Translate_Matrix_Success(Matrix matrix, float offsetX, float offsetY, MatrixOrder order, float[] expectedElements)
{
Expand Down
Loading