diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c033dd133c..1d2a8e6dfc 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -32,6 +32,12 @@ jobs: sdk-preview: true runtime: -x64 codecov: false + - os: buildjet-4vcpu-ubuntu-2204-arm + framework: net7.0 + sdk: 7.0.x + sdk-preview: true + runtime: -x64 + codecov: false - os: ubuntu-latest framework: net6.0 sdk: 6.0.x @@ -47,10 +53,19 @@ jobs: sdk: 6.0.x runtime: -x64 codecov: false + - os: buildjet-4vcpu-ubuntu-2204-arm + framework: net6.0 + sdk: 6.0.x + runtime: -x64 + codecov: false runs-on: ${{matrix.options.os}} steps: + - name: Install libgdi+, which is required for tests running on ubuntu + if: ${{ matrix.options.os == 'buildjet-4vcpu-ubuntu-2204-arm' }} + run: sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev + - name: Git Config shell: bash run: | diff --git a/ci-test.ps1 b/ci-test.ps1 index 3915ae4ccd..d9bb0211a5 100644 --- a/ci-test.ps1 +++ b/ci-test.ps1 @@ -33,5 +33,5 @@ elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) { } else { - dotnet test --no-build -c Release -f $targetFramework + dotnet test --no-build -c Release -f $targetFramework --blame --diag .tests\Images\ActualOutput\diaglog.txt } diff --git a/shared-infrastructure b/shared-infrastructure index 9a82679e92..6c52486c51 160000 --- a/shared-infrastructure +++ b/shared-infrastructure @@ -1 +1 @@ -Subproject commit 9a82679e92df9476725fd2a2038604fd412af56c +Subproject commit 6c52486c512357475cbb92bbb7c4c0af4d85b1db diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index ac5b635962..d696acf0f2 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -18,6 +18,7 @@ ..\ImageSharp.Tests.ruleset + true diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets index 4e1b9503e1..c05384fcce 100644 --- a/tests/Directory.Build.targets +++ b/tests/Directory.Build.targets @@ -21,7 +21,7 @@ - + @@ -32,7 +32,7 @@ - + diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs index 022451668b..b4facfa3fe 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Runtime.InteropServices; using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Gif; @@ -49,8 +50,11 @@ public class GifDecoderTests FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}"; image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); + + // Floating point differences result in minor pixel differences. + // Output have been manually verified. image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(0.0001F), + ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0002F : 0.0001F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs index 61c01b15c4..aed84a7d92 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs @@ -64,7 +64,7 @@ public partial class JpegEncoderTests { { JpegEncodingColor.Luminance, 100, 0.0175f / 100 }, { JpegEncodingColor.Luminance, 80, 0.6730f / 100 }, - { JpegEncodingColor.Luminance, 40, 0.9941f / 100 }, + { JpegEncodingColor.Luminance, 40, 0.9943f / 100 }, }; [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs index 7e6f5138a6..afd33608ce 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Runtime.InteropServices; using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Png; @@ -120,8 +121,11 @@ public partial class PngDecoderTests FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}"; image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); + + // Floating point differences result in minor pixel differences. + // Output have been manually verified. image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(0.0003F), // Magick decoder shows difference on Mac + ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0005F : 0.0003F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs index 3c9a2f8261..0bbe1984f0 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Runtime.InteropServices; using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Tga; @@ -758,8 +759,11 @@ public class TgaDecoderTests FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}"; image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); + + // Floating point differences result in minor pixel differences. + // Output have been manually verified. image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(0.0001F), + ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0016F : 0.0001F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs index 05c1c5a138..75e7d39091 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. // ReSharper disable InconsistentNaming +using System.Runtime.InteropServices; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Tiff; using SixLabors.ImageSharp.Metadata; @@ -765,8 +766,11 @@ public class TiffDecoderTests : TiffDecoderBaseTester FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}"; image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); + + // Floating point differences result in minor pixel differences. + // Output have been manually verified. image.CompareToReferenceOutput( - ImageComparer.Exact, + TestEnvironment.OSArchitecture == Architecture.Arm64 ? ImageComparer.TolerantPercentage(0.0006F) : ImageComparer.Exact, provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs index 1607e907bc..73c034a6be 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs @@ -17,7 +17,7 @@ public class LosslessUtilsTests float actual = LosslessUtils.CombinedShannonEntropy(x, y); - Assert.Equal(expected, actual, 5); + Assert.Equal(expected, actual, precision: 5); } private static void RunSubtractGreenTest() diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs index 003e5ad4c9..010af3fbbe 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Runtime.InteropServices; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Webp; using SixLabors.ImageSharp.PixelFormats; @@ -365,8 +366,11 @@ public class WebpDecoderTests FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}"; image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); + + // Floating point differences result in minor pixel differences. + // Output have been manually verified. image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(0.0007F), + ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0156F : 0.0007F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs index 4eb8b3063d..6c5fa50ff6 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Runtime.InteropServices; using SixLabors.ImageSharp.Formats.Webp; using SixLabors.ImageSharp.Metadata; using SixLabors.ImageSharp.PixelFormats; @@ -23,13 +24,13 @@ public class WebpEncoderTests public void Encode_PreserveRatio(TestImageProvider provider, WebpFileFormatType expectedFormat) where TPixel : unmanaged, IPixel { - var options = new WebpEncoder(); + WebpEncoder options = new(); using Image input = provider.GetImage(); - using var memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new(); input.Save(memoryStream, options); memoryStream.Position = 0; - using var output = Image.Load(memoryStream); + using Image output = Image.Load(memoryStream); ImageMetadata meta = output.Metadata; WebpMetadata webpMetaData = meta.GetWebpMetadata(); @@ -43,7 +44,7 @@ public class WebpEncoderTests public void Encode_Lossless_WithPalette_Works(TestImageProvider provider) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless, Quality = 100, @@ -61,7 +62,7 @@ public class WebpEncoderTests public void Encode_Lossless_WithDifferentQuality_Works(TestImageProvider provider, int quality) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless, Quality = quality @@ -90,7 +91,7 @@ public class WebpEncoderTests public void Encode_Lossless_WithDifferentMethodAndQuality_Works(TestImageProvider provider, WebpEncodingMethod method, int quality) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless, Method = method, @@ -107,14 +108,14 @@ public class WebpEncoderTests public void Encode_Lossless_WithBestQuality_HasExpectedSize(TestImageProvider provider, int expectedBytes) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless, Method = WebpEncodingMethod.BestQuality }; using Image image = provider.GetImage(); - using var memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new(); image.Save(memoryStream, encoder); Assert.Equal(memoryStream.Length, expectedBytes); @@ -130,7 +131,7 @@ public class WebpEncoderTests public void Encode_Lossless_WithNearLosslessFlag_Works(TestImageProvider provider, int nearLosslessQuality) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless, NearLossless = true, @@ -154,7 +155,7 @@ public class WebpEncoderTests public void Encode_Lossless_WithPreserveTransparentColor_Works(TestImageProvider provider, WebpEncodingMethod method) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless, Method = method, @@ -170,9 +171,9 @@ public class WebpEncoderTests public void Encode_Lossless_OneByOnePixel_Works() { // Just make sure, encoding 1 pixel by 1 pixel does not throw an exception. - using var image = new Image(1, 1); - var encoder = new WebpEncoder() { FileFormat = WebpFileFormatType.Lossless }; - using (var memStream = new MemoryStream()) + using Image image = new(1, 1); + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless }; + using (MemoryStream memStream = new()) { image.SaveAsWebp(memStream, encoder); } @@ -185,7 +186,7 @@ public class WebpEncoderTests public void Encode_Lossy_WithDifferentQuality_Works(TestImageProvider provider, int quality) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy, Quality = quality @@ -205,7 +206,7 @@ public class WebpEncoderTests public void Encode_Lossy_WithDifferentFilterStrength_Works(TestImageProvider provider, int filterStrength) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy, FilterStrength = filterStrength @@ -225,7 +226,7 @@ public class WebpEncoderTests public void Encode_Lossy_WithDifferentSpatialNoiseShapingStrength_Works(TestImageProvider provider, int snsStrength) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy, SpatialNoiseShaping = snsStrength @@ -254,7 +255,7 @@ public class WebpEncoderTests public void Encode_Lossy_WithDifferentMethodsAndQuality_Works(TestImageProvider provider, WebpEncodingMethod method, int quality) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy, Method = method, @@ -267,11 +268,15 @@ public class WebpEncoderTests } [Theory] - [WithFile(TestImages.Png.Transparency, PixelTypes.Rgba32, 64020)] - public void Encode_Lossy_WithAlpha_Works(TestImageProvider provider, int expectedFileSize) + [WithFile(TestImages.Png.Transparency, PixelTypes.Rgba32)] + public void Encode_Lossy_WithAlpha_Works(TestImageProvider provider) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + // Floating point differences result in minor pixel differences affecting compression. + // Output have been manually verified. + int expectedFileSize = TestEnvironment.OSArchitecture == Architecture.Arm64 ? 64060 : 64020; + + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy, UseAlphaCompression = false @@ -291,11 +296,15 @@ public class WebpEncoderTests } [Theory] - [WithFile(TestImages.Png.Transparency, PixelTypes.Rgba32, 16200)] - public void Encode_Lossy_WithAlphaUsingCompression_Works(TestImageProvider provider, int expectedFileSize) + [WithFile(TestImages.Png.Transparency, PixelTypes.Rgba32)] + public void Encode_Lossy_WithAlphaUsingCompression_Works(TestImageProvider provider) where TPixel : unmanaged, IPixel { - var encoder = new WebpEncoder() + // Floating point differences result in minor pixel differences affecting compression. + // Output have been manually verified. + int expectedFileSize = TestEnvironment.OSArchitecture == Architecture.Arm64 ? 16240 : 16200; + + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy, UseAlphaCompression = true @@ -322,7 +331,7 @@ public class WebpEncoderTests { using Image image = provider.GetImage(); - var encoder = new WebpEncoder() { FileFormat = WebpFileFormatType.Lossless }; + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossless }; image.VerifyEncoder(provider, "webp", string.Empty, encoder); } @@ -334,16 +343,16 @@ public class WebpEncoderTests { using Image image = provider.GetImage(); - var encoder = new WebpEncoder() { FileFormat = WebpFileFormatType.Lossy }; + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy }; image.VerifyEncoder(provider, "webp", string.Empty, encoder, ImageComparer.Tolerant(0.04f)); } public static void RunEncodeLossy_WithPeakImage() { - var provider = TestImageProvider.File(TestImageLossyFullPath); + TestImageProvider provider = TestImageProvider.File(TestImageLossyFullPath); using Image image = provider.GetImage(); - var encoder = new WebpEncoder() { FileFormat = WebpFileFormatType.Lossy }; + WebpEncoder encoder = new() { FileFormat = WebpFileFormatType.Lossy }; image.VerifyEncoder(provider, "webp", string.Empty, encoder, ImageComparer.Tolerant(0.04f)); } diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj index c6cf347518..a6197b6009 100644 --- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj +++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj @@ -4,7 +4,7 @@ True SixLabors.ImageSharp.Tests - AnyCPU;x64;x86 + AnyCPU;x64;x86;ARM64 SixLabors.ImageSharp.Tests Debug;Release diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs index 2f47e6ff3a..17f04795dc 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Memory.Internals; @@ -66,6 +67,12 @@ public partial class UniformUnmanagedMemoryPoolTests return; } + if (TestEnvironment.OSArchitecture == Architecture.Arm64) + { + // Skip on ARM64: https://github.com/SixLabors/ImageSharp/issues/2342 + return; + } + RemoteExecutor.Invoke(RunTest).Dispose(); static void RunTest() diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs index bd7c4f2bdb..3403e3f17e 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs @@ -261,6 +261,12 @@ public class UniformUnmanagedPoolMemoryAllocatorTests return; } + if (TestEnvironment.OSArchitecture == Architecture.Arm64) + { + // Skip on ARM64: https://github.com/SixLabors/ImageSharp/issues/2342 + return; + } + if (!TestEnvironment.RunsOnCI) { // This may fail in local runs resulting in high memory load. @@ -323,6 +329,12 @@ public class UniformUnmanagedPoolMemoryAllocatorTests return; } + if (TestEnvironment.OSArchitecture == Architecture.Arm64) + { + // Skip on ARM64: https://github.com/SixLabors/ImageSharp/issues/2342 + return; + } + if (!TestEnvironment.RunsOnCI) { // This may fail in local runs resulting in high memory load. diff --git a/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs b/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs index afccdbd05d..95574a4d6c 100644 --- a/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/A8Tests.cs @@ -65,7 +65,7 @@ public class A8Tests Assert.Equal(0, actual.X); Assert.Equal(0, actual.Y); Assert.Equal(0, actual.Z); - Assert.Equal(.5F, actual.W, 2); + Assert.Equal(.5F, actual.W, precision: 2); } [Fact] @@ -81,7 +81,7 @@ public class A8Tests Assert.Equal(0, actual.X); Assert.Equal(0, actual.Y); Assert.Equal(0, actual.Z); - Assert.Equal(.5F, actual.W, 2); + Assert.Equal(.5F, actual.W, precision: 2); } [Fact] diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index c282d81665..7c383d389d 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -377,14 +377,14 @@ public static class TestImages public const string Os2v2Short = "Bmp/pal8os2v2-16.bmp"; public const string Os2v2 = "Bmp/pal8os2v2.bmp"; public const string Os2BitmapArray = "Bmp/ba-bm.bmp"; - public const string Os2BitmapArray9s = "Bmp/9S.BMP"; - public const string Os2BitmapArrayDiamond = "Bmp/DIAMOND.BMP"; - public const string Os2BitmapArrayMarble = "Bmp/GMARBLE.BMP"; - public const string Os2BitmapArraySkater = "Bmp/SKATER.BMP"; - public const string Os2BitmapArraySpade = "Bmp/SPADE.BMP"; - public const string Os2BitmapArraySunflower = "Bmp/SUNFLOW.BMP"; - public const string Os2BitmapArrayWarpd = "Bmp/WARPD.BMP"; - public const string Os2BitmapArrayPines = "Bmp/PINES.BMP"; + public const string Os2BitmapArray9s = "Bmp/9S.bmp"; + public const string Os2BitmapArrayDiamond = "Bmp/DIAMOND.bmp"; + public const string Os2BitmapArrayMarble = "Bmp/GMARBLE.bmp"; + public const string Os2BitmapArraySkater = "Bmp/SKATER.bmp"; + public const string Os2BitmapArraySpade = "Bmp/SPADE.bmp"; + public const string Os2BitmapArraySunflower = "Bmp/SUNFLOW.bmp"; + public const string Os2BitmapArrayWarpd = "Bmp/WARPD.bmp"; + public const string Os2BitmapArrayPines = "Bmp/PINES.bmp"; public const string LessThanFullSizedPalette = "Bmp/pal8os2sp.bmp"; public const string Pal8Offset = "Bmp/pal8offs.bmp"; public const string OversizedPalette = "Bmp/pal8oversizepal.bmp"; diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDifferenceIsOverThresholdException.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDifferenceIsOverThresholdException.cs index 33b7228aed..8d6a1ffc74 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDifferenceIsOverThresholdException.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDifferenceIsOverThresholdException.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Globalization; using System.Text; namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; @@ -11,33 +12,36 @@ public class ImageDifferenceIsOverThresholdException : ImagesSimilarityException public ImageDifferenceIsOverThresholdException(IEnumerable reports) : base("Image difference is over threshold!" + StringifyReports(reports)) - { - this.Reports = reports.ToArray(); - } + => this.Reports = reports.ToArray(); private static string StringifyReports(IEnumerable reports) { - var sb = new StringBuilder(); + StringBuilder sb = new(); + + sb.Append(Environment.NewLine); + sb.AppendFormat(CultureInfo.InvariantCulture, "Test Environment OS : {0}", GetEnvironmentName()); + sb.Append(Environment.NewLine); + sb.AppendFormat(CultureInfo.InvariantCulture, "Test Environment is CI : {0}", TestEnvironment.RunsOnCI); sb.Append(Environment.NewLine); - sb.AppendFormat("Test Environment OS : {0}", GetEnvironmentName()); + sb.AppendFormat(CultureInfo.InvariantCulture, "Test Environment is .NET Core : {0}", !TestEnvironment.IsFramework); sb.Append(Environment.NewLine); - sb.AppendFormat("Test Environment is CI : {0}", TestEnvironment.RunsOnCI); + sb.AppendFormat(CultureInfo.InvariantCulture, "Test Environment is Mono : {0}", TestEnvironment.IsMono); sb.Append(Environment.NewLine); - sb.AppendFormat("Test Environment is .NET Core : {0}", !TestEnvironment.IsFramework); + sb.AppendFormat(CultureInfo.InvariantCulture, "Test Environment OS Architecture : {0}", TestEnvironment.OSArchitecture); sb.Append(Environment.NewLine); - sb.AppendFormat("Test Environment is Mono : {0}", TestEnvironment.IsMono); + sb.AppendFormat(CultureInfo.InvariantCulture, "Test Environment Process Architecture : {0}", TestEnvironment.ProcessArchitecture); sb.Append(Environment.NewLine); foreach (ImageSimilarityReport r in reports) { - sb.AppendFormat("Report ImageFrame {0}: ", r.Index); - sb.Append(r); - sb.Append(Environment.NewLine); + sb.AppendFormat(CultureInfo.InvariantCulture, "Report ImageFrame {0}: ", r.Index) + .Append(r) + .Append(Environment.NewLine); } return sb.ToString(); @@ -50,7 +54,7 @@ public class ImageDifferenceIsOverThresholdException : ImagesSimilarityException return "MacOS"; } - if (TestEnvironment.IsMacOS) + if (TestEnvironment.IsLinux) { return "Linux"; } diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs index 113429ead7..8818830351 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs @@ -117,6 +117,10 @@ public static partial class TestEnvironment internal static bool IsFramework => NetCoreVersion == null; + internal static Architecture OSArchitecture => RuntimeInformation.OSArchitecture; + + internal static Architecture ProcessArchitecture => RuntimeInformation.ProcessArchitecture; + /// /// A dummy operation to enforce the execution of the static constructor. /// diff --git a/tests/ImageSharp.Tests/runtimeconfig.template.json b/tests/ImageSharp.Tests/runtimeconfig.template.json new file mode 100644 index 0000000000..4201c8a4ab --- /dev/null +++ b/tests/ImageSharp.Tests/runtimeconfig.template.json @@ -0,0 +1,5 @@ +{ + "configProperties": { + "System.Drawing.EnableUnixSupport": true + } +} \ No newline at end of file diff --git a/tests/Images/Input/Bmp/9S.BMP b/tests/Images/Input/Bmp/9S.bmp similarity index 100% rename from tests/Images/Input/Bmp/9S.BMP rename to tests/Images/Input/Bmp/9S.bmp diff --git a/tests/Images/Input/Bmp/DIAMOND.BMP b/tests/Images/Input/Bmp/DIAMOND.bmp similarity index 100% rename from tests/Images/Input/Bmp/DIAMOND.BMP rename to tests/Images/Input/Bmp/DIAMOND.bmp diff --git a/tests/Images/Input/Bmp/GMARBLE.BMP b/tests/Images/Input/Bmp/GMARBLE.bmp similarity index 100% rename from tests/Images/Input/Bmp/GMARBLE.BMP rename to tests/Images/Input/Bmp/GMARBLE.bmp diff --git a/tests/Images/Input/Bmp/PINES.BMP b/tests/Images/Input/Bmp/PINES.bmp similarity index 100% rename from tests/Images/Input/Bmp/PINES.BMP rename to tests/Images/Input/Bmp/PINES.bmp diff --git a/tests/Images/Input/Bmp/SKATER.BMP b/tests/Images/Input/Bmp/SKATER.bmp similarity index 100% rename from tests/Images/Input/Bmp/SKATER.BMP rename to tests/Images/Input/Bmp/SKATER.bmp diff --git a/tests/Images/Input/Bmp/SPADE.BMP b/tests/Images/Input/Bmp/SPADE.bmp similarity index 100% rename from tests/Images/Input/Bmp/SPADE.BMP rename to tests/Images/Input/Bmp/SPADE.bmp diff --git a/tests/Images/Input/Bmp/SUNFLOW.BMP b/tests/Images/Input/Bmp/SUNFLOW.bmp similarity index 100% rename from tests/Images/Input/Bmp/SUNFLOW.BMP rename to tests/Images/Input/Bmp/SUNFLOW.bmp diff --git a/tests/Images/Input/Bmp/WARPD.BMP b/tests/Images/Input/Bmp/WARPD.bmp similarity index 100% rename from tests/Images/Input/Bmp/WARPD.BMP rename to tests/Images/Input/Bmp/WARPD.bmp