Browse Source

Merge pull request #2341 from SixLabors/js/buildjet-arm64

Add BuildJet ARM64 runners.
pull/2344/head
James Jackson-South 3 years ago
committed by GitHub
parent
commit
bd9fc666c4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      .github/workflows/build-and-test.yml
  2. 2
      ci-test.ps1
  3. 2
      shared-infrastructure
  4. 1
      tests/Directory.Build.props
  5. 4
      tests/Directory.Build.targets
  6. 6
      tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs
  7. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs
  8. 6
      tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
  9. 6
      tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs
  10. 6
      tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
  11. 2
      tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs
  12. 6
      tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs
  13. 63
      tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs
  14. 2
      tests/ImageSharp.Tests/ImageSharp.Tests.csproj
  15. 7
      tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs
  16. 12
      tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs
  17. 4
      tests/ImageSharp.Tests/PixelFormats/A8Tests.cs
  18. 16
      tests/ImageSharp.Tests/TestImages.cs
  19. 28
      tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDifferenceIsOverThresholdException.cs
  20. 4
      tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs
  21. 5
      tests/ImageSharp.Tests/runtimeconfig.template.json
  22. 0
      tests/Images/Input/Bmp/9S.bmp
  23. 0
      tests/Images/Input/Bmp/DIAMOND.bmp
  24. 0
      tests/Images/Input/Bmp/GMARBLE.bmp
  25. 0
      tests/Images/Input/Bmp/PINES.bmp
  26. 0
      tests/Images/Input/Bmp/SKATER.bmp
  27. 0
      tests/Images/Input/Bmp/SPADE.bmp
  28. 0
      tests/Images/Input/Bmp/SUNFLOW.bmp
  29. 0
      tests/Images/Input/Bmp/WARPD.bmp

15
.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: |

2
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
}

2
shared-infrastructure

@ -1 +1 @@
Subproject commit 9a82679e92df9476725fd2a2038604fd412af56c
Subproject commit 6c52486c512357475cbb92bbb7c4c0af4d85b1db

1
tests/Directory.Build.props

@ -18,6 +18,7 @@
<PropertyGroup>
<CodeAnalysisRuleSet>..\ImageSharp.Tests.ruleset</CodeAnalysisRuleSet>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<ItemGroup>

4
tests/Directory.Build.targets

@ -21,7 +21,7 @@
<PackageReference Update="BenchmarkDotNet" Version="0.13.0" />
<PackageReference Update="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.0" Condition="'$(IsWindows)'=='true'" />
<PackageReference Update="Colourful" Version="3.0.0" />
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="11.1.2" />
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="12.2.2" />
<PackageReference Update="Microsoft.DotNet.RemoteExecutor" Version="6.0.0-beta.21311.3" />
<PackageReference Update="Microsoft.DotNet.XUnitExtensions" Version="6.0.0-beta.21311.3" />
<PackageReference Update="Moq" Version="4.14.6" />
@ -32,7 +32,7 @@
<PackageReference Update="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" Condition="'$(IsOSX)'=='true'" />
<PackageReference Update="SharpZipLib" Version="1.3.2" />
<PackageReference Update="SkiaSharp" Version="2.80.2" />
<PackageReference Update="System.Drawing.Common" Version="5.0.2" />
<PackageReference Update="System.Drawing.Common" Version="6.0.0" />
<PackageReference Update="System.IO.Compression" Version="4.3.0" />
</ItemGroup>

6
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);

2
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]

6
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);

6
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);

6
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);

2
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()

6
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);

63
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<TPixel>(TestImageProvider<TPixel> provider, WebpFileFormatType expectedFormat)
where TPixel : unmanaged, IPixel<TPixel>
{
var options = new WebpEncoder();
WebpEncoder options = new();
using Image<TPixel> input = provider.GetImage();
using var memoryStream = new MemoryStream();
using MemoryStream memoryStream = new();
input.Save(memoryStream, options);
memoryStream.Position = 0;
using var output = Image.Load<Rgba32>(memoryStream);
using Image<Rgba32> output = Image.Load<Rgba32>(memoryStream);
ImageMetadata meta = output.Metadata;
WebpMetadata webpMetaData = meta.GetWebpMetadata();
@ -43,7 +44,7 @@ public class WebpEncoderTests
public void Encode_Lossless_WithPalette_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, int quality)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, WebpEncodingMethod method, int quality)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, int expectedBytes)
where TPixel : unmanaged, IPixel<TPixel>
{
var encoder = new WebpEncoder()
WebpEncoder encoder = new()
{
FileFormat = WebpFileFormatType.Lossless,
Method = WebpEncodingMethod.BestQuality
};
using Image<TPixel> 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<TPixel>(TestImageProvider<TPixel> provider, int nearLosslessQuality)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, WebpEncodingMethod method)
where TPixel : unmanaged, IPixel<TPixel>
{
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<Rgba32>(1, 1);
var encoder = new WebpEncoder() { FileFormat = WebpFileFormatType.Lossless };
using (var memStream = new MemoryStream())
using Image<Rgba32> 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<TPixel>(TestImageProvider<TPixel> provider, int quality)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, int filterStrength)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, int snsStrength)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, WebpEncodingMethod method, int quality)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, int expectedFileSize)
[WithFile(TestImages.Png.Transparency, PixelTypes.Rgba32)]
public void Encode_Lossy_WithAlpha_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel>(TestImageProvider<TPixel> provider, int expectedFileSize)
[WithFile(TestImages.Png.Transparency, PixelTypes.Rgba32)]
public void Encode_Lossy_WithAlphaUsingCompression_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
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<TPixel> 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<TPixel> 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<Rgba32>.File(TestImageLossyFullPath);
TestImageProvider<Rgba32> provider = TestImageProvider<Rgba32>.File(TestImageLossyFullPath);
using Image<Rgba32> 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));
}

2
tests/ImageSharp.Tests/ImageSharp.Tests.csproj

@ -4,7 +4,7 @@
<PropertyGroup>
<DebugSymbols>True</DebugSymbols>
<AssemblyName>SixLabors.ImageSharp.Tests</AssemblyName>
<Platforms>AnyCPU;x64;x86</Platforms>
<Platforms>AnyCPU;x64;x86;ARM64</Platforms>
<RootNamespace>SixLabors.ImageSharp.Tests</RootNamespace>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

7
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()

12
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.

4
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]

16
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";

28
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<ImageSimilarityReport> reports)
: base("Image difference is over threshold!" + StringifyReports(reports))
{
this.Reports = reports.ToArray();
}
=> this.Reports = reports.ToArray();
private static string StringifyReports(IEnumerable<ImageSimilarityReport> 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";
}

4
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;
/// <summary>
/// A dummy operation to enforce the execution of the static constructor.
/// </summary>

5
tests/ImageSharp.Tests/runtimeconfig.template.json

@ -0,0 +1,5 @@
{
"configProperties": {
"System.Drawing.EnableUnixSupport": true
}
}

0
tests/Images/Input/Bmp/9S.BMP → tests/Images/Input/Bmp/9S.bmp

0
tests/Images/Input/Bmp/DIAMOND.BMP → tests/Images/Input/Bmp/DIAMOND.bmp

0
tests/Images/Input/Bmp/GMARBLE.BMP → tests/Images/Input/Bmp/GMARBLE.bmp

0
tests/Images/Input/Bmp/PINES.BMP → tests/Images/Input/Bmp/PINES.bmp

0
tests/Images/Input/Bmp/SKATER.BMP → tests/Images/Input/Bmp/SKATER.bmp

0
tests/Images/Input/Bmp/SPADE.BMP → tests/Images/Input/Bmp/SPADE.bmp

0
tests/Images/Input/Bmp/SUNFLOW.BMP → tests/Images/Input/Bmp/SUNFLOW.bmp

0
tests/Images/Input/Bmp/WARPD.BMP → tests/Images/Input/Bmp/WARPD.bmp

Loading…
Cancel
Save