Browse Source

Adjust percentages for ARM (visually checked)

pull/2341/head
James Jackson-South 3 years ago
parent
commit
cf7f808a0e
  1. 3
      tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs
  2. 3
      tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs
  3. 3
      tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
  4. 3
      tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs
  5. 26
      tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDifferenceIsOverThresholdException.cs

3
tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System.Runtime.InteropServices;
using Microsoft.DotNet.RemoteExecutor; using Microsoft.DotNet.RemoteExecutor;
using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Gif; using SixLabors.ImageSharp.Formats.Gif;
@ -50,7 +51,7 @@ public class GifDecoderTests
image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false);
image.CompareToReferenceOutput( image.CompareToReferenceOutput(
ImageComparer.TolerantPercentage(0.0001F), ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0002F : 0.0001F),
provider, provider,
testOutputDetails: details, testOutputDetails: details,
appendPixelTypeToFileName: false); appendPixelTypeToFileName: false);

3
tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System.Runtime.InteropServices;
using Microsoft.DotNet.RemoteExecutor; using Microsoft.DotNet.RemoteExecutor;
using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Tga; using SixLabors.ImageSharp.Formats.Tga;
@ -759,7 +760,7 @@ public class TgaDecoderTests
image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false);
image.CompareToReferenceOutput( image.CompareToReferenceOutput(
ImageComparer.TolerantPercentage(0.0001F), ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.00017F : 0.0001F),
provider, provider,
testOutputDetails: details, testOutputDetails: details,
appendPixelTypeToFileName: false); appendPixelTypeToFileName: false);

3
tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Tiff; using SixLabors.ImageSharp.Formats.Tiff;
using SixLabors.ImageSharp.Metadata; using SixLabors.ImageSharp.Metadata;
@ -766,7 +767,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester
image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false);
image.CompareToReferenceOutput( image.CompareToReferenceOutput(
ImageComparer.Exact, TestEnvironment.OSArchitecture == Architecture.Arm64 ? ImageComparer.TolerantPercentage(0.0006F) : ImageComparer.Exact,
provider, provider,
testOutputDetails: details, testOutputDetails: details,
appendPixelTypeToFileName: false); appendPixelTypeToFileName: false);

3
tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Webp; using SixLabors.ImageSharp.Formats.Webp;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
@ -366,7 +367,7 @@ public class WebpDecoderTests
image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false);
image.CompareToReferenceOutput( image.CompareToReferenceOutput(
ImageComparer.TolerantPercentage(0.0007F), ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0156F : 0.0007F),
provider, provider,
testOutputDetails: details, testOutputDetails: details,
appendPixelTypeToFileName: false); appendPixelTypeToFileName: false);

26
tests/ImageSharp.Tests/TestUtilities/ImageComparison/Exceptions/ImageDifferenceIsOverThresholdException.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System.Globalization;
using System.Text; using System.Text;
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
@ -11,33 +12,36 @@ public class ImageDifferenceIsOverThresholdException : ImagesSimilarityException
public ImageDifferenceIsOverThresholdException(IEnumerable<ImageSimilarityReport> reports) public ImageDifferenceIsOverThresholdException(IEnumerable<ImageSimilarityReport> reports)
: base("Image difference is over threshold!" + StringifyReports(reports)) : base("Image difference is over threshold!" + StringifyReports(reports))
{ => this.Reports = reports.ToArray();
this.Reports = reports.ToArray();
}
private static string StringifyReports(IEnumerable<ImageSimilarityReport> reports) 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.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.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.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.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); sb.Append(Environment.NewLine);
foreach (ImageSimilarityReport r in reports) foreach (ImageSimilarityReport r in reports)
{ {
sb.AppendFormat("Report ImageFrame {0}: ", r.Index); sb.AppendFormat(CultureInfo.InvariantCulture, "Report ImageFrame {0}: ", r.Index)
sb.Append(r); .Append(r)
sb.Append(Environment.NewLine); .Append(Environment.NewLine);
} }
return sb.ToString(); return sb.ToString();

Loading…
Cancel
Save