Skip to content

Commit e64ed4d

Browse files
committed
Disable Tests which need libgdiplus
This disables all tests which need libgdiplus for macs with arm. The hosted runners do not have libgdiplus installed
1 parent 16f0840 commit e64ed4d

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ public void BmpDecoder_CanDecode_Inverted<TPixel>(TestImageProvider<TPixel> prov
111111
public void BmpDecoder_CanDecode_1Bit<TPixel>(TestImageProvider<TPixel> provider)
112112
where TPixel : unmanaged, IPixel<TPixel>
113113
{
114+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
115+
{
116+
return;
117+
}
118+
114119
using Image<TPixel> image = provider.GetImage(BmpDecoder.Instance);
115120
image.DebugSave(provider);
116121
image.CompareToOriginal(provider, new SystemDrawingReferenceDecoder(BmpFormat.Instance));
@@ -144,6 +149,11 @@ public void BmpDecoder_CanDecode_4Bit<TPixel>(TestImageProvider<TPixel> provider
144149
public void BmpDecoder_CanDecode_8Bit<TPixel>(TestImageProvider<TPixel> provider)
145150
where TPixel : unmanaged, IPixel<TPixel>
146151
{
152+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
153+
{
154+
return;
155+
}
156+
147157
using Image<TPixel> image = provider.GetImage(BmpDecoder.Instance);
148158
image.DebugSave(provider);
149159
image.CompareToOriginal(provider);

tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ internal static string GetReferenceOutputFileName(string actualOutputFileName) =
114114

115115
internal static bool Is64BitProcess => IntPtr.Size == 8;
116116

117+
internal static bool IsArm64Process => RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
118+
117119
internal static bool IsFramework => NetCoreVersion == null;
118120

119121
internal static Architecture OSArchitecture => RuntimeInformation.OSArchitecture;

tests/ImageSharp.Tests/TestUtilities/Tests/MagickReferenceCodecTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public class MagickReferenceCodecTests
2929
public void MagickDecode_8BitDepthImage_IsEquivalentTo_SystemDrawingResult<TPixel>(TestImageProvider<TPixel> dummyProvider, string testImage)
3030
where TPixel : unmanaged, IPixel<TPixel>
3131
{
32+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
33+
{
34+
return;
35+
}
36+
3237
string path = TestFile.GetInputFileFullPath(testImage);
3338

3439
MagickReferenceDecoder magickDecoder = MagickReferenceDecoder.Png;
@@ -61,6 +66,11 @@ public void MagickDecode_8BitDepthImage_IsEquivalentTo_SystemDrawingResult<TPixe
6166
public void MagickDecode_16BitDepthImage_IsApproximatelyEquivalentTo_SystemDrawingResult<TPixel>(TestImageProvider<TPixel> dummyProvider, string testImage)
6267
where TPixel : unmanaged, IPixel<TPixel>
6368
{
69+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
70+
{
71+
return;
72+
}
73+
6474
string path = TestFile.GetInputFileFullPath(testImage);
6575

6676
MagickReferenceDecoder magickDecoder = MagickReferenceDecoder.Png;

tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public class SystemDrawingReferenceCodecTests
2323
public void To32bppArgbSystemDrawingBitmap<TPixel>(TestImageProvider<TPixel> provider)
2424
where TPixel : unmanaged, IPixel<TPixel>
2525
{
26+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
27+
{
28+
return;
29+
}
30+
2631
using Image<TPixel> image = provider.GetImage();
2732
using System.Drawing.Bitmap sdBitmap = SystemDrawingBridge.To32bppArgbSystemDrawingBitmap(image);
2833
string fileName = provider.Utility.GetTestOutputFileName("png");
@@ -34,6 +39,11 @@ public void To32bppArgbSystemDrawingBitmap<TPixel>(TestImageProvider<TPixel> pro
3439
public void From32bppArgbSystemDrawingBitmap<TPixel>(TestImageProvider<TPixel> dummyProvider)
3540
where TPixel : unmanaged, IPixel<TPixel>
3641
{
42+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
43+
{
44+
return;
45+
}
46+
3747
string path = TestFile.GetInputFileFullPath(TestImages.Png.Splash);
3848

3949
using Bitmap sdBitmap = new(path);
@@ -59,7 +69,7 @@ private static string SavePng<TPixel>(TestImageProvider<TPixel> provider, PngCol
5969
public void From32bppArgbSystemDrawingBitmap2<TPixel>(TestImageProvider<TPixel> provider)
6070
where TPixel : unmanaged, IPixel<TPixel>
6171
{
62-
if (TestEnvironment.IsLinux)
72+
if (TestEnvironment.IsLinux || (TestEnvironment.IsArm64Process && TestEnvironment.IsMacOS))
6373
{
6474
return;
6575
}
@@ -78,6 +88,11 @@ public void From32bppArgbSystemDrawingBitmap2<TPixel>(TestImageProvider<TPixel>
7888
public void From24bppRgbSystemDrawingBitmap<TPixel>(TestImageProvider<TPixel> provider)
7989
where TPixel : unmanaged, IPixel<TPixel>
8090
{
91+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
92+
{
93+
return;
94+
}
95+
8196
string path = SavePng(provider, PngColorType.Rgb);
8297

8398
using Image<TPixel> original = provider.GetImage();
@@ -92,6 +107,11 @@ public void From24bppRgbSystemDrawingBitmap<TPixel>(TestImageProvider<TPixel> pr
92107
public void OpenWithReferenceDecoder<TPixel>(TestImageProvider<TPixel> dummyProvider)
93108
where TPixel : unmanaged, IPixel<TPixel>
94109
{
110+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
111+
{
112+
return;
113+
}
114+
95115
string path = TestFile.GetInputFileFullPath(TestImages.Png.Splash);
96116
using FileStream stream = File.OpenRead(path);
97117
using Image<TPixel> image = SystemDrawingReferenceDecoder.Png.Decode<TPixel>(DecoderOptions.Default, stream);
@@ -103,6 +123,11 @@ public void OpenWithReferenceDecoder<TPixel>(TestImageProvider<TPixel> dummyProv
103123
public void SaveWithReferenceEncoder<TPixel>(TestImageProvider<TPixel> provider)
104124
where TPixel : unmanaged, IPixel<TPixel>
105125
{
126+
if (TestEnvironment.IsMacOS && TestEnvironment.IsArm64Process)
127+
{
128+
return;
129+
}
130+
106131
using Image<TPixel> image = provider.GetImage();
107132
provider.Utility.SaveTestOutputFile(image, "png", SystemDrawingReferenceEncoder.Png);
108133
}

0 commit comments

Comments
 (0)