Browse Source

fix some spelling (#962)

pull/964/head
Simon Cropp 7 years ago
committed by James Jackson-South
parent
commit
aac8eae64a
  1. 4
      src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs
  2. 4
      src/ImageSharp/Memory/MemoryOwnerExtensions.cs
  3. 4
      src/ImageSharp/PixelFormats/PixelAlphaCompositionMode.cs
  4. 8
      src/ImageSharp/Primitives/Complex64.cs
  5. 18
      src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs
  6. 6
      src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs
  7. 14
      tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs
  8. 6
      tests/ImageSharp.Benchmarks/Codecs/MultiImageBenchmarkBase.cs
  9. 4
      tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs
  10. 6
      tests/ImageSharp.Benchmarks/General/BasicMath/ClampInt32IntoByte.cs
  11. 22
      tests/ImageSharp.Benchmarks/General/CopyBuffers.cs
  12. 6
      tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs
  13. 6
      tests/ImageSharp.Benchmarks/Samplers/Glow.cs
  14. 4
      tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs
  15. 4
      tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs
  16. 4
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.MetaData.cs
  17. 6
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
  18. 6
      tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs
  19. 4
      tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs
  20. 6
      tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.cs
  21. 10
      tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs
  22. 6
      tests/ImageSharp.Tests/GlobalSuppressions.cs
  23. 18
      tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs
  24. 2
      tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs
  25. 8
      tests/ImageSharp.Tests/Image/ImageTests.Save.cs
  26. 8
      tests/ImageSharp.Tests/ImageOperationTests.cs
  27. 4
      tests/ImageSharp.Tests/MetaData/Profiles/ICC/DataWriter/IccDataWriter.PrimitivesTests.cs
  28. 6
      tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
  29. 8
      tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs
  30. 16
      tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs
  31. 6
      tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs
  32. 6
      tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs
  33. 32
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
  34. 6
      tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs
  35. 10
      tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs
  36. 4
      tests/ImageSharp.Tests/TestFormat.cs
  37. 14
      tests/ImageSharp.Tests/TestUtilities/ArrayHelper.cs
  38. 14
      tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs
  39. 4
      tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs
  40. 10
      tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs
  41. 12
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs
  42. 8
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
  43. 6
      tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs
  44. 12
      tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

4
src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
// Application Data ---- // Application Data ----
buffer[12] = 3; // Application block length (always 3) buffer[12] = 3; // Application block length (always 3)
buffer[13] = 1; // Data sub-block indentity (always 1) buffer[13] = 1; // Data sub-block identity (always 1)
// 0 means loop indefinitely. Count is set as play n + 1 times. // 0 means loop indefinitely. Count is set as play n + 1 times.
BinaryPrimitives.WriteUInt16LittleEndian(buffer.Slice(14, 2), this.RepeatCount); BinaryPrimitives.WriteUInt16LittleEndian(buffer.Slice(14, 2), this.RepeatCount);

4
src/ImageSharp/Memory/MemoryOwnerExtensions.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Memory
=> buffer.GetSpan().Length; => buffer.GetSpan().Length;
/// <summary> /// <summary>
/// Gets a <see cref="Span{T}"/> to an offseted position inside the buffer. /// Gets a <see cref="Span{T}"/> to an offsetted position inside the buffer.
/// </summary> /// </summary>
/// <param name="buffer">The buffer</param> /// <param name="buffer">The buffer</param>
/// <param name="start">The start</param> /// <param name="start">The start</param>
@ -60,4 +60,4 @@ namespace SixLabors.ImageSharp.Memory
where T : struct => where T : struct =>
ref MemoryMarshal.GetReference(buffer.GetSpan()); ref MemoryMarshal.GetReference(buffer.GetSpan());
} }
} }

4
src/ImageSharp/PixelFormats/PixelAlphaCompositionMode.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
namespace SixLabors.ImageSharp.PixelFormats namespace SixLabors.ImageSharp.PixelFormats
@ -39,7 +39,7 @@ namespace SixLabors.ImageSharp.PixelFormats
Dest, Dest,
/// <summary> /// <summary>
/// The source where they don't overlap othersie dest in overlapping parts. /// The source where they don't overlap otherwise dest in overlapping parts.
/// </summary> /// </summary>
DestAtop, DestAtop,

8
src/ImageSharp/Primitives/Complex64.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Primitives
} }
/// <summary> /// <summary>
/// Performs the multiplication operation between a <see cref="Complex64"/> intance and a <see cref="float"/> scalar. /// Performs the multiplication operation between a <see cref="Complex64"/> instance and a <see cref="float"/> scalar.
/// </summary> /// </summary>
/// <param name="value">The <see cref="Complex64"/> value to multiply.</param> /// <param name="value">The <see cref="Complex64"/> value to multiply.</param>
/// <param name="scalar">The <see cref="float"/> scalar to use to multiply the <see cref="Complex64"/> value.</param> /// <param name="scalar">The <see cref="float"/> scalar to use to multiply the <see cref="Complex64"/> value.</param>
@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp.Primitives
public static Complex64 operator *(Complex64 value, float scalar) => new Complex64(value.Real * scalar, value.Imaginary * scalar); public static Complex64 operator *(Complex64 value, float scalar) => new Complex64(value.Real * scalar, value.Imaginary * scalar);
/// <summary> /// <summary>
/// Performs the multiplication operation between a <see cref="Complex64"/> intance and a <see cref="Vector4"/>. /// Performs the multiplication operation between a <see cref="Complex64"/> instance and a <see cref="Vector4"/>.
/// </summary> /// </summary>
/// <param name="value">The <see cref="Complex64"/> value to multiply.</param> /// <param name="value">The <see cref="Complex64"/> value to multiply.</param>
/// <param name="vector">The <see cref="Vector4"/> instance to use to multiply the <see cref="Complex64"/> value.</param> /// <param name="vector">The <see cref="Vector4"/> instance to use to multiply the <see cref="Complex64"/> value.</param>
@ -58,7 +58,7 @@ namespace SixLabors.ImageSharp.Primitives
} }
/// <summary> /// <summary>
/// Performs the multiplication operation between a <see cref="Complex64"/> intance and a <see cref="ComplexVector4"/>. /// Performs the multiplication operation between a <see cref="Complex64"/> instance and a <see cref="ComplexVector4"/>.
/// </summary> /// </summary>
/// <param name="value">The <see cref="Complex64"/> value to multiply.</param> /// <param name="value">The <see cref="Complex64"/> value to multiply.</param>
/// <param name="vector">The <see cref="ComplexVector4"/> instance to use to multiply the <see cref="Complex64"/> value.</param> /// <param name="vector">The <see cref="ComplexVector4"/> instance to use to multiply the <see cref="Complex64"/> value.</param>

18
src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs

@ -55,10 +55,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization
var parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism }; var parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism };
int tileWidth = source.Width / this.Tiles; int tileWidth = source.Width / this.Tiles;
int tileHeight = tileWidth; int tileHeight = tileWidth;
int pixeInTile = tileWidth * tileHeight; int pixelInTile = tileWidth * tileHeight;
int halfTileHeight = tileHeight / 2; int halfTileHeight = tileHeight / 2;
int halfTileWidth = halfTileHeight; int halfTileWidth = halfTileHeight;
var slidingWindowInfos = new SlidingWindowInfos(tileWidth, tileHeight, halfTileWidth, halfTileHeight, pixeInTile); var slidingWindowInfos = new SlidingWindowInfos(tileWidth, tileHeight, halfTileWidth, halfTileHeight, pixelInTile);
using (Buffer2D<TPixel> targetPixels = configuration.MemoryAllocator.Allocate2D<TPixel>(source.Width, source.Height)) using (Buffer2D<TPixel> targetPixels = configuration.MemoryAllocator.Allocate2D<TPixel>(source.Width, source.Height))
{ {
@ -149,7 +149,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization
/// <param name="source">The source image.</param> /// <param name="source">The source image.</param>
/// <param name="memoryAllocator">The memory allocator.</param> /// <param name="memoryAllocator">The memory allocator.</param>
/// <param name="targetPixels">The target pixels.</param> /// <param name="targetPixels">The target pixels.</param>
/// <param name="swInfos">Informations about the sliding window dimensions.</param> /// <param name="swInfos"><see cref="SlidingWindowInfos"/> about the sliding window dimensions.</param>
/// <param name="yStart">The y start position.</param> /// <param name="yStart">The y start position.</param>
/// <param name="yEnd">The y end position.</param> /// <param name="yEnd">The y end position.</param>
/// <param name="useFastPath">if set to true the borders of the image will not be checked.</param> /// <param name="useFastPath">if set to true the borders of the image will not be checked.</param>
@ -204,7 +204,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization
{ {
// Clipping the histogram, but doing it on a copy to keep the original un-clipped values for the next iteration. // Clipping the histogram, but doing it on a copy to keep the original un-clipped values for the next iteration.
histogram.CopyTo(histogramCopy); histogram.CopyTo(histogramCopy);
this.ClipHistogram(histogramCopy, this.ClipLimitPercentage, swInfos.PixeInTile); this.ClipHistogram(histogramCopy, this.ClipLimitPercentage, swInfos.PixelInTile);
} }
// Calculate the cumulative distribution function, which will map each input pixel in the current tile to a new value. // Calculate the cumulative distribution function, which will map each input pixel in the current tile to a new value.
@ -212,7 +212,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization
? this.CalculateCdf(ref cdfBase, ref histogramCopyBase, histogram.Length - 1) ? this.CalculateCdf(ref cdfBase, ref histogramCopyBase, histogram.Length - 1)
: this.CalculateCdf(ref cdfBase, ref histogramBase, histogram.Length - 1); : this.CalculateCdf(ref cdfBase, ref histogramBase, histogram.Length - 1);
float numberOfPixelsMinusCdfMin = swInfos.PixeInTile - cdfMin; float numberOfPixelsMinusCdfMin = swInfos.PixelInTile - cdfMin;
// Map the current pixel to the new equalized value. // Map the current pixel to the new equalized value.
int luminance = GetLuminance(source[x, y], this.LuminanceLevels); int luminance = GetLuminance(source[x, y], this.LuminanceLevels);
@ -367,24 +367,24 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization
private class SlidingWindowInfos private class SlidingWindowInfos
{ {
public SlidingWindowInfos(int tileWidth, int tileHeight, int halfTileWidth, int halfTileHeight, int pixeInTile) public SlidingWindowInfos(int tileWidth, int tileHeight, int halfTileWidth, int halfTileHeight, int pixelInTile)
{ {
this.TileWidth = tileWidth; this.TileWidth = tileWidth;
this.TileHeight = tileHeight; this.TileHeight = tileHeight;
this.HalfTileWidth = halfTileWidth; this.HalfTileWidth = halfTileWidth;
this.HalfTileHeight = halfTileHeight; this.HalfTileHeight = halfTileHeight;
this.PixeInTile = pixeInTile; this.PixelInTile = pixelInTile;
} }
public int TileWidth { get; private set; } public int TileWidth { get; private set; }
public int TileHeight { get; private set; } public int TileHeight { get; private set; }
public int PixeInTile { get; private set; } public int PixelInTile { get; private set; }
public int HalfTileWidth { get; private set; } public int HalfTileWidth { get; private set; }
public int HalfTileHeight { get; private set; } public int HalfTileHeight { get; private set; }
} }
} }
} }

6
src/ImageSharp/Processing/Processors/Transforms/TransformUtils.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -111,7 +111,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
Matrix4x4 matrix = Matrix4x4.Identity; Matrix4x4 matrix = Matrix4x4.Identity;
/* /*
* SkMatrix is layed out in the following manner: * SkMatrix is laid out in the following manner:
* *
* [ ScaleX SkewY Persp0 ] * [ ScaleX SkewY Persp0 ]
* [ SkewX ScaleY Persp1 ] * [ SkewX ScaleY Persp1 ]
@ -329,7 +329,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
int width = rectangle.Left < 0 ? rectangle.Right : Math.Max(rectangle.Width, rectangle.Right); int width = rectangle.Left < 0 ? rectangle.Right : Math.Max(rectangle.Width, rectangle.Right);
// If location in either direction is translated to a negative value equal to or exceeding the // If location in either direction is translated to a negative value equal to or exceeding the
// dimensions in eith direction we need to reassign the dimension. // dimensions in either direction we need to reassign the dimension.
if (height <= 0) if (height <= 0)
{ {
height = rectangle.Height; height = rectangle.Height;

14
tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Numerics; using System.Numerics;
@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations
private static readonly Vector4 Half = new Vector4(0.5f); private static readonly Vector4 Half = new Vector4(0.5f);
private Block8x8F inputDividend; private Block8x8F inputDividend;
private Block8x8F inputDivisior; private Block8x8F inputDivisor;
[GlobalSetup] [GlobalSetup]
public void Setup() public void Setup()
@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations
for (int i = 0; i < Block8x8F.Size; i++) for (int i = 0; i < Block8x8F.Size; i++)
{ {
this.inputDividend[i] = i*44.8f; this.inputDividend[i] = i*44.8f;
this.inputDivisior[i] = 100 - i; this.inputDivisor[i] = 100 - i;
} }
} }
@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations
int sum = 0; int sum = 0;
Block8x8F b1 = this.inputDividend; Block8x8F b1 = this.inputDividend;
Block8x8F b2 = this.inputDivisior; Block8x8F b2 = this.inputDivisor;
float* pDividend = (float*)&b1; float* pDividend = (float*)&b1;
float* pDivisor = (float*)&b2; float* pDivisor = (float*)&b2;
@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations
int sum = 0; int sum = 0;
Block8x8F b1 = this.inputDividend; Block8x8F b1 = this.inputDividend;
Block8x8F b2 = this.inputDivisior; Block8x8F b2 = this.inputDivisor;
float* pDividend = (float*)&b1; float* pDividend = (float*)&b1;
float* pDivisor = (float*)&b2; float* pDivisor = (float*)&b2;
@ -99,7 +99,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations
int sum = 0; int sum = 0;
Block8x8F bDividend = this.inputDividend; Block8x8F bDividend = this.inputDividend;
Block8x8F bDivisor = this.inputDivisior; Block8x8F bDivisor = this.inputDivisor;
float* pDividend = (float*)&bDividend; float* pDividend = (float*)&bDividend;
for (int cnt = 0; cnt < ExecutionCount; cnt++) for (int cnt = 0; cnt < ExecutionCount; cnt++)
@ -155,4 +155,4 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations
return -((-dividend + (divisor >> 1)) / divisor); return -((-dividend + (divisor >> 1)) / divisor);
} }
} }
} }

6
tests/ImageSharp.Benchmarks/Codecs/MultiImageBenchmarkBase.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using BenchmarkDotNet.Configs; using BenchmarkDotNet.Configs;
@ -143,7 +143,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
} }
/// <summary> /// <summary>
/// Execute code for each image stream. If the returned object of the opearation <see cref="Func{T, TResult}"/> is <see cref="IDisposable"/> it will be disposed. /// Execute code for each image stream. If the returned object of the operation <see cref="Func{T, TResult}"/> is <see cref="IDisposable"/> it will be disposed.
/// </summary> /// </summary>
/// <param name="operation">The operation to execute. If the returned object is &lt;see cref="IDisposable"/&gt; it will be disposed </param> /// <param name="operation">The operation to execute. If the returned object is &lt;see cref="IDisposable"/&gt; it will be disposed </param>
protected void ForEachStream(Func<MemoryStream, object> operation) protected void ForEachStream(Func<MemoryStream, object> operation)
@ -271,4 +271,4 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
} }
} }
} }
} }

4
tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Numerics; using System.Numerics;
@ -228,7 +228,7 @@ namespace SixLabors.ImageSharp.Benchmarks
} }
/// <summary> /// <summary>
/// This should perform better. Coreclr emmitted Vector.Dot() code lacks the vectorization even with IsHardwareAccelerated == true. /// This should perform better. Coreclr emitted Vector.Dot() code lacks the vectorization even with IsHardwareAccelerated == true.
/// Kept this benchmark because maybe it will be improved in a future CLR release. /// Kept this benchmark because maybe it will be improved in a future CLR release.
/// <see> /// <see>
/// <cref>https://www.gamedev.net/topic/673396-c-systemnumericsvectors-slow/</cref> /// <cref>https://www.gamedev.net/topic/673396-c-systemnumericsvectors-slow/</cref>

6
tests/ImageSharp.Benchmarks/General/BasicMath/ClampInt32IntoByte.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -76,8 +76,8 @@ namespace SixLabors.ImageSharp.Benchmarks.General.BasicMath
public byte ClampBitwise() public byte ClampBitwise()
{ {
int x = this.Value; int x = this.Value;
int absmax = byte.MaxValue - x; int absMax = byte.MaxValue - x;
x = (x + byte.MaxValue - AbsBitwiseVer(ref absmax)) >> 1; x = (x + byte.MaxValue - AbsBitwiseVer(ref absMax)) >> 1;
x = (x + byte.MinValue + AbsBitwiseVer(ref x)) >> 1; x = (x + byte.MinValue + AbsBitwiseVer(ref x)) >> 1;
return (byte)x; return (byte)x;

22
tests/ImageSharp.Benchmarks/General/CopyBuffers.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -33,8 +33,8 @@ namespace SixLabors.ImageSharp.Benchmarks.General
[Params(10, 50, 100, 1000, 10000)] [Params(10, 50, 100, 1000, 10000)]
public int Count { get; set; } public int Count { get; set; }
[GlobalSetup] [GlobalSetup]
public void Setup() public void Setup()
{ {
@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Benchmarks.General
{ {
Unsafe.CopyBlock(ref this.destArray[0], ref this.sourceArray[0], (uint)this.Count); Unsafe.CopyBlock(ref this.destArray[0], ref this.sourceArray[0], (uint)this.Count);
} }
[Benchmark(Description = "Unsafe.CopyBlock(ptr)")] [Benchmark(Description = "Unsafe.CopyBlock(ptr)")]
public unsafe void UnsafeCopyBlockPointers() public unsafe void UnsafeCopyBlockPointers()
{ {
@ -101,13 +101,13 @@ namespace SixLabors.ImageSharp.Benchmarks.General
void* pinnedSource = this.sourceHandle.Pointer; void* pinnedSource = this.sourceHandle.Pointer;
Unsafe.CopyBlock(pinnedDestination, pinnedSource, (uint)this.Count); Unsafe.CopyBlock(pinnedDestination, pinnedSource, (uint)this.Count);
} }
[Benchmark(Description = "Unsafe.CopyBlockUnaligned(ref)")] [Benchmark(Description = "Unsafe.CopyBlockUnaligned(ref)")]
public unsafe void UnsafeCopyBlockUnalignedReferences() public unsafe void UnsafeCopyBlockUnalignedReferences()
{ {
Unsafe.CopyBlockUnaligned(ref this.destArray[0], ref this.sourceArray[0], (uint)this.Count); Unsafe.CopyBlockUnaligned(ref this.destArray[0], ref this.sourceArray[0], (uint)this.Count);
} }
[Benchmark(Description = "Unsafe.CopyBlockUnaligned(ptr)")] [Benchmark(Description = "Unsafe.CopyBlockUnaligned(ptr)")]
public unsafe void UnsafeCopyBlockUnalignedPointers() public unsafe void UnsafeCopyBlockUnalignedPointers()
{ {
@ -115,7 +115,7 @@ namespace SixLabors.ImageSharp.Benchmarks.General
void* pinnedSource = this.sourceHandle.Pointer; void* pinnedSource = this.sourceHandle.Pointer;
Unsafe.CopyBlockUnaligned(pinnedDestination, pinnedSource, (uint)this.Count); Unsafe.CopyBlockUnaligned(pinnedDestination, pinnedSource, (uint)this.Count);
} }
// BenchmarkDotNet=v0.11.3, OS=Windows 10.0.17134.706 (1803/April2018Update/Redstone4) // BenchmarkDotNet=v0.11.3, OS=Windows 10.0.17134.706 (1803/April2018Update/Redstone4)
// Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores // Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
// Frequency=2742189 Hz, Resolution=364.6722 ns, Timer=TSC // Frequency=2742189 Hz, Resolution=364.6722 ns, Timer=TSC
@ -123,9 +123,9 @@ namespace SixLabors.ImageSharp.Benchmarks.General
// [Host] : .NET Core 2.1.9 (CoreCLR 4.6.27414.06, CoreFX 4.6.27415.01), 64bit RyuJIT // [Host] : .NET Core 2.1.9 (CoreCLR 4.6.27414.06, CoreFX 4.6.27415.01), 64bit RyuJIT
// Clr : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.3394.0 // Clr : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.3394.0
// Core : .NET Core 2.1.9 (CoreCLR 4.6.27414.06, CoreFX 4.6.27415.01), 64bit RyuJIT // Core : .NET Core 2.1.9 (CoreCLR 4.6.27414.06, CoreFX 4.6.27415.01), 64bit RyuJIT
// //
// IterationCount=3 LaunchCount=1 WarmupCount=3 // IterationCount=3 LaunchCount=1 WarmupCount=3
// //
// | Method | Job | Runtime | Count | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated | // | Method | Job | Runtime | Count | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
// |------------------------------- |----- |-------- |------ |-----------:|-----------:|----------:|------:|--------:|------:|------:|------:|----------:| // |------------------------------- |----- |-------- |------ |-----------:|-----------:|----------:|------:|--------:|------:|------:|------:|----------:|
// | Array.Copy() | Clr | Clr | 10 | 23.636 ns | 2.5299 ns | 0.1387 ns | 1.00 | 0.00 | - | - | - | - | // | Array.Copy() | Clr | Clr | 10 | 23.636 ns | 2.5299 ns | 0.1387 ns | 1.00 | 0.00 | - | - | - | - |
@ -228,4 +228,4 @@ namespace SixLabors.ImageSharp.Benchmarks.General
// | Unsafe.CopyBlockUnaligned(ref) | Core | Core | 10000 | 187.489 ns | 13.1527 ns | 0.7209 ns | 0.92 | 0.00 | - | - | - | - | // | Unsafe.CopyBlockUnaligned(ref) | Core | Core | 10000 | 187.489 ns | 13.1527 ns | 0.7209 ns | 0.92 | 0.00 | - | - | - | - |
// | Unsafe.CopyBlockUnaligned(ptr) | Core | Core | 10000 | 186.586 ns | 4.6274 ns | 0.2536 ns | 0.91 | 0.00 | - | - | - | - | // | Unsafe.CopyBlockUnaligned(ptr) | Core | Core | 10000 | 186.586 ns | 4.6274 ns | 0.2536 ns | 0.91 | 0.00 | - | - | - | - |
} }
} }

6
tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs

@ -1,4 +1,4 @@
using System.Numerics; using System.Numerics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes;
@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
var bVec = new Vector<float>(256.0f / 255.0f); var bVec = new Vector<float>(256.0f / 255.0f);
var magicFloat = new Vector<float>(32768.0f); var magicFloat = new Vector<float>(32768.0f);
var magicInt = new Vector<uint>(1191182336); // reinterpreded value of 32768.0f var magicInt = new Vector<uint>(1191182336); // reinterpreted value of 32768.0f
var mask = new Vector<uint>(255); var mask = new Vector<uint>(255);
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
@ -110,4 +110,4 @@ namespace SixLabors.ImageSharp.Benchmarks.General.Vectorization
} }
} }
} }
} }

6
tests/ImageSharp.Benchmarks/Samplers/Glow.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -144,7 +144,7 @@ namespace SixLabors.ImageSharp.Benchmarks
{ {
amount = amount.Clamp(0, 1); amount = amount.Clamp(0, 1);
// Santize on zero alpha // Sanitize on zero alpha
if (Math.Abs(backdrop.W) < Constants.Epsilon) if (Math.Abs(backdrop.W) < Constants.Epsilon)
{ {
source.W *= amount; source.W *= amount;
@ -173,4 +173,4 @@ namespace SixLabors.ImageSharp.Benchmarks
} }
} }
} }
} }

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

@ -283,8 +283,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
// seems to be wrong. This bitmap has an alpha channel of two bits. In many cases this alpha channel has a value of 3, // seems to be wrong. This bitmap has an alpha channel of two bits. In many cases this alpha channel has a value of 3,
// which should be remapped to 255 for RGBA32, but the magick decoder has a value of 191 set. // which should be remapped to 255 for RGBA32, but the magick decoder has a value of 191 set.
// The total difference without the alpha channel is still: 0.0204% // The total difference without the alpha channel is still: 0.0204%
// Exporting the image as PNG with GIMP yields to the same result as the imagesharp implementation. // Exporting the image as PNG with GIMP yields to the same result as the ImageSharp implementation.
image.CompareToOriginal(provider, ImageComparer.TolerantPercentage(6.1f), new MagickReferenceDecoder()); image.CompareToOriginal(provider, ImageComparer.TolerantPercentage(6.1f), new MagickReferenceDecoder());
} }
} }

4
tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -42,7 +42,7 @@ namespace SixLabors.ImageSharp.Tests
} }
[Fact] [Fact]
public void AddImageFormatDetectorNullthrows() public void AddImageFormatDetectorNullThrows()
{ {
Assert.Throws<ArgumentNullException>(() => Assert.Throws<ArgumentNullException>(() =>
{ {

4
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.MetaData.cs

@ -19,7 +19,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public partial class JpegDecoderTests public partial class JpegDecoderTests
{ {
// TODO: A JPEGsnoop & metadata expert should review if the Exif/Icc expectations are correct. // TODO: A JPEGsnoop & metadata expert should review if the Exif/Icc expectations are correct.
// I'm seeing several entries with Exif-related names in images where we do not decode an exif profile. (- Anton) // I'm seeing several entries with Exif-related names in images where we do not decode an exif profile. (- Anton)
public static readonly TheoryData<bool, string, int, bool, bool> MetaDataTestData = public static readonly TheoryData<bool, string, int, bool, bool> MetaDataTestData =
new TheoryData<bool, string, int, bool, bool> new TheoryData<bool, string, int, bool, bool>
@ -257,4 +257,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
}); });
} }
} }
} }

6
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs

@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
return; return;
} }
// For 32 bit test enviroments: // For 32 bit test environments:
provider.Configuration.MemoryAllocator = ArrayPoolMemoryAllocator.CreateWithModeratePooling(); provider.Configuration.MemoryAllocator = ArrayPoolMemoryAllocator.CreateWithModeratePooling();
using (Image<TPixel> image = provider.GetImage(JpegDecoder)) using (Image<TPixel> image = provider.GetImage(JpegDecoder))
@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
return "0%"; return "0%";
} }
// DEBUG ONLY! // DEBUG ONLY!
// The PDF.js output should be saved by "tests\ImageSharp.Tests\Formats\Jpg\pdfjs\jpeg-converter.htm" // The PDF.js output should be saved by "tests\ImageSharp.Tests\Formats\Jpg\pdfjs\jpeg-converter.htm"
// into "\tests\Images\ActualOutput\JpegDecoderTests\" // into "\tests\Images\ActualOutput\JpegDecoderTests\"
@ -158,4 +158,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
} }
} }
} }
} }

6
tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs

@ -30,11 +30,11 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[InlineData(TestImages.Jpeg.Baseline.Cmyk, JpegColorSpace.Cmyk)] [InlineData(TestImages.Jpeg.Baseline.Cmyk, JpegColorSpace.Cmyk)]
public void ColorSpace_IsDeducedCorrectly(string imageFile, object expectedColorSpaceValue) public void ColorSpace_IsDeducedCorrectly(string imageFile, object expectedColorSpaceValue)
{ {
var expecteColorSpace = (JpegColorSpace)expectedColorSpaceValue; var expectedColorSpace = (JpegColorSpace)expectedColorSpaceValue;
using (JpegDecoderCore decoder = JpegFixture.ParseJpegStream(imageFile)) using (JpegDecoderCore decoder = JpegFixture.ParseJpegStream(imageFile))
{ {
Assert.Equal(expecteColorSpace, decoder.ColorSpace); Assert.Equal(expectedColorSpace, decoder.ColorSpace);
} }
} }
@ -131,4 +131,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
} }
} }
} }
} }

4
tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs

@ -131,7 +131,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
/// <summary> /// <summary>
/// Original: https://github.com/norishigefukushima/dct_simd/blob/master/dct/dct8x8_simd.cpp#L239 /// Original: https://github.com/norishigefukushima/dct_simd/blob/master/dct/dct8x8_simd.cpp#L239
/// Applyies IDCT transformation on "s" copying transformed values to "d", using temporary block "temp" /// Applies IDCT transformation on "s" copying transformed values to "d", using temporary block "temp"
/// </summary> /// </summary>
/// <param name="s"></param> /// <param name="s"></param>
/// <param name="d"></param> /// <param name="d"></param>
@ -554,4 +554,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
} }
} }
} }
} }

6
tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
@ -11,7 +11,7 @@ using SixLabors.ImageSharp.Formats.Jpeg.Components;
namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
{ {
/// <summary> /// <summary>
/// This class contains simplified (unefficient) reference implementations to produce verification data for unit tests /// This class contains simplified (inefficient) reference implementations to produce verification data for unit tests
/// Floating point DCT code Ported from https://github.com/norishigefukushima/dct_simd /// Floating point DCT code Ported from https://github.com/norishigefukushima/dct_simd
/// </summary> /// </summary>
internal static partial class ReferenceImplementations internal static partial class ReferenceImplementations
@ -144,4 +144,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
return -((-dividend + (divisor >> 1)) / divisor); return -((-dividend + (divisor >> 1)) / divisor);
} }
} }
} }

10
tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.IO; using System.IO;
@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
public void GeneralTest<TPixel>(TestImageProvider<TPixel> provider) public void GeneralTest<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
// does saving a file then repoening mean both files are identical??? // does saving a file then reopening mean both files are identical???
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
{ {
@ -41,7 +41,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
//public void CanSaveIndexedPng<TPixel>(TestImageProvider<TPixel> provider) //public void CanSaveIndexedPng<TPixel>(TestImageProvider<TPixel> provider)
// where TPixel : struct, IPixel<TPixel> // where TPixel : struct, IPixel<TPixel>
//{ //{
// // does saving a file then repoening mean both files are identical??? // // does saving a file then reopening mean both files are identical???
// using (Image<TPixel> image = provider.GetImage()) // using (Image<TPixel> image = provider.GetImage())
// using (MemoryStream ms = new MemoryStream()) // using (MemoryStream ms = new MemoryStream())
// { // {
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
//public void CanSaveIndexedPngTwice<TPixel>(TestImageProvider<TPixel> provider) //public void CanSaveIndexedPngTwice<TPixel>(TestImageProvider<TPixel> provider)
// where TPixel : struct, IPixel<TPixel> // where TPixel : struct, IPixel<TPixel>
//{ //{
// // does saving a file then repoening mean both files are identical??? // // does saving a file then reopening mean both files are identical???
// using (Image<TPixel> source = provider.GetImage()) // using (Image<TPixel> source = provider.GetImage())
// using (MemoryStream ms = new MemoryStream()) // using (MemoryStream ms = new MemoryStream())
// { // {
@ -103,7 +103,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
public void Resize<TPixel>(TestImageProvider<TPixel> provider) public void Resize<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
// does saving a file then repoening mean both files are identical??? // does saving a file then reopening mean both files are identical???
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
{ {

6
tests/ImageSharp.Tests/GlobalSuppressions.cs

@ -1,7 +1,7 @@

// This file is used by Code Analysis to maintain SuppressMessage // This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project. // attributes that are applied to this project.
// Project-level suppressions either have no target or are given // Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc. // a specific target and scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "xUnit1026:Theory methods should use all of their parameters")]

18
tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs

@ -275,24 +275,24 @@ namespace SixLabors.ImageSharp.Tests
public void AddFrame_clones_sourceFrame() public void AddFrame_clones_sourceFrame()
{ {
var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray(); var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray();
var otherFRame = new ImageFrame<Rgba32>(Configuration.Default, 10, 10); var otherFrame = new ImageFrame<Rgba32>(Configuration.Default, 10, 10);
var addedFrame = this.Image.Frames.AddFrame(otherFRame); var addedFrame = this.Image.Frames.AddFrame(otherFrame);
addedFrame.ComparePixelBufferTo(otherFRame.GetPixelSpan()); addedFrame.ComparePixelBufferTo(otherFrame.GetPixelSpan());
Assert.NotEqual(otherFRame, addedFrame); Assert.NotEqual(otherFrame, addedFrame);
} }
[Fact] [Fact]
public void InsertFrame_clones_sourceFrame() public void InsertFrame_clones_sourceFrame()
{ {
var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray(); var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray();
var otherFRame = new ImageFrame<Rgba32>(Configuration.Default, 10, 10); var otherFrame = new ImageFrame<Rgba32>(Configuration.Default, 10, 10);
var addedFrame = this.Image.Frames.InsertFrame(0, otherFRame); var addedFrame = this.Image.Frames.InsertFrame(0, otherFrame);
addedFrame.ComparePixelBufferTo(otherFRame.GetPixelSpan()); addedFrame.ComparePixelBufferTo(otherFrame.GetPixelSpan());
Assert.NotEqual(otherFRame, addedFrame); Assert.NotEqual(otherFrame, addedFrame);
} }
[Fact] [Fact]
public void MoveFrame_LeavesFrmaeInCorrectLocation() public void MoveFrame_LeavesFrameInCorrectLocation()
{ {
for (var i = 0; i < 9; i++) for (var i = 0; i < 9; i++)
{ {

2
tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs

@ -214,7 +214,7 @@ namespace SixLabors.ImageSharp.Tests
} }
[Fact] [Fact]
public void MoveFrame_LeavesFrmaeInCorrectLocation() public void MoveFrame_LeavesFrameInCorrectLocation()
{ {
for (var i = 0; i < 9; i++) for (var i = 0; i < 9; i++)
{ {

8
tests/ImageSharp.Tests/Image/ImageTests.Save.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
@ -17,10 +17,10 @@ namespace SixLabors.ImageSharp.Tests
public class Save public class Save
{ {
[Fact] [Fact]
public void DetecedEncoding() public void DetectedEncoding()
{ {
string dir = TestEnvironment.CreateOutputDirectory(nameof(ImageTests)); string dir = TestEnvironment.CreateOutputDirectory(nameof(ImageTests));
string file = System.IO.Path.Combine(dir, "DetecedEncoding.png"); string file = System.IO.Path.Combine(dir, "DetectedEncoding.png");
using (var image = new Image<Rgba32>(10, 10)) using (var image = new Image<Rgba32>(10, 10))
{ {
@ -67,4 +67,4 @@ namespace SixLabors.ImageSharp.Tests
} }
} }
} }
} }

8
tests/ImageSharp.Tests/ImageOperationTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.Tests
} }
[Fact] [Fact]
public void CloneCallsImageOperationsProvider_Func_NotOnOrigional() public void CloneCallsImageOperationsProvider_Func_NotOnOriginal()
{ {
Image<Rgba32> returned = this.image.Clone(x => x.ApplyProcessor(this.processorDefinition)); Image<Rgba32> returned = this.image.Clone(x => x.ApplyProcessor(this.processorDefinition));
Assert.False(this.provider.HasCreated(this.image)); Assert.False(this.provider.HasCreated(this.image));
@ -91,7 +91,7 @@ namespace SixLabors.ImageSharp.Tests
} }
[Fact] [Fact]
public void CloneCallsImageOperationsProvider_ListOfProcessors_NotOnOrigional() public void CloneCallsImageOperationsProvider_ListOfProcessors_NotOnOriginal()
{ {
Image<Rgba32> returned = this.image.Clone(this.processorDefinition); Image<Rgba32> returned = this.image.Clone(this.processorDefinition);
Assert.False(this.provider.HasCreated(this.image)); Assert.False(this.provider.HasCreated(this.image));
@ -110,4 +110,4 @@ namespace SixLabors.ImageSharp.Tests
public void Dispose() => this.image.Dispose(); public void Dispose() => this.image.Dispose();
} }
} }

4
tests/ImageSharp.Tests/MetaData/Profiles/ICC/DataWriter/IccDataWriter.PrimitivesTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp.Tests.Icc
} }
[Fact] [Fact]
public void WriteAsciiStringWithNegativeLenghtThrowsArgumentException() public void WriteAsciiStringWithNegativeLengthThrowsArgumentException()
{ {
IccDataWriter writer = CreateWriter(); IccDataWriter writer = CreateWriter();

6
tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Primitives; using SixLabors.ImageSharp.Primitives;
@ -98,7 +98,7 @@ namespace SixLabors.ImageSharp.Tests
} }
[Fact] [Fact]
public void ToStringRepresention() public void ToStringRepresentation()
{ {
var rational = new SignedRational(0, 0); var rational = new SignedRational(0, 0);
Assert.Equal("[ Indeterminate ]", rational.ToString()); Assert.Equal("[ Indeterminate ]", rational.ToString());
@ -119,4 +119,4 @@ namespace SixLabors.ImageSharp.Tests
Assert.Equal("1/2", rational.ToString()); Assert.Equal("1/2", rational.ToString());
} }
} }
} }

8
tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Numerics; using System.Numerics;
@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
VectorAssert.Equal(expected, actual, 5); VectorAssert.Equal(expected, actual, 5);
} }
public static TheoryData<TestVector4, TestVector4, float, TestVector4> SubstractFunctionData = new TheoryData<TestVector4, TestVector4, float, TestVector4>() { public static TheoryData<TestVector4, TestVector4, float, TestVector4> SubtractFunctionData = new TheoryData<TestVector4, TestVector4, float, TestVector4>() {
{ new TestVector4(1,1,1,1), new TestVector4(1,1,1,1), 1, new TestVector4(0,0,0,1) }, { new TestVector4(1,1,1,1), new TestVector4(1,1,1,1), 1, new TestVector4(0,0,0,1) },
{ new TestVector4(1,1,1,1), new TestVector4(0,0,0,.8f), .5f, new TestVector4(1,1,1, 1f) }, { new TestVector4(1,1,1,1), new TestVector4(0,0,0,.8f), .5f, new TestVector4(1,1,1, 1f) },
{ {
@ -73,8 +73,8 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
}; };
[Theory] [Theory]
[MemberData(nameof(SubstractFunctionData))] [MemberData(nameof(SubtractFunctionData))]
public void SubstractFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected) public void SubtractFunction(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
{ {
Vector4 actual = PorterDuffFunctions.SubtractSrcOver((Vector4)back, source, amount); Vector4 actual = PorterDuffFunctions.SubtractSrcOver((Vector4)back, source, amount);
VectorAssert.Equal(expected, actual, 5); VectorAssert.Equal(expected, actual, 5);

16
tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTests_TPixel.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -130,7 +130,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
VectorAssert.Equal(expected, dest[0], 2); VectorAssert.Equal(expected, dest[0], 2);
} }
public static TheoryData<object, object, float, object> SubstractFunctionData = new TheoryData<object, object, float, object>() { public static TheoryData<object, object, float, object> SubtractFunctionData = new TheoryData<object, object, float, object>() {
{ new TestPixel<Rgba32>(1,1,1,1), new TestPixel<Rgba32>(1,1,1,1), 1, new TestPixel<Rgba32>(0,0,0,1) }, { new TestPixel<Rgba32>(1,1,1,1), new TestPixel<Rgba32>(1,1,1,1), 1, new TestPixel<Rgba32>(0,0,0,1) },
{ new TestPixel<Rgba32>(1,1,1,1), new TestPixel<Rgba32>(0,0,0,.8f), .5f, new TestPixel<Rgba32>(1,1,1, 1f) }, { new TestPixel<Rgba32>(1,1,1,1), new TestPixel<Rgba32>(0,0,0,.8f), .5f, new TestPixel<Rgba32>(1,1,1, 1f) },
{ {
@ -142,8 +142,8 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
}; };
[Theory] [Theory]
[MemberData(nameof(SubstractFunctionData))] [MemberData(nameof(SubtractFunctionData))]
public void SubstractFunction<TPixel>(TestPixel<TPixel> back, TestPixel<TPixel> source, float amount, TestPixel<TPixel> expected) public void SubtractFunction<TPixel>(TestPixel<TPixel> back, TestPixel<TPixel> source, float amount, TestPixel<TPixel> expected)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
TPixel actual = PorterDuffFunctions.SubtractSrcOver((TPixel)back, source, amount); TPixel actual = PorterDuffFunctions.SubtractSrcOver((TPixel)back, source, amount);
@ -151,8 +151,8 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
} }
[Theory] [Theory]
[MemberData(nameof(SubstractFunctionData))] [MemberData(nameof(SubtractFunctionData))]
public void SubstractFunctionBlender<TPixel>(TestPixel<TPixel> back, TestPixel<TPixel> source, float amount, TestPixel<TPixel> expected) public void SubtractFunctionBlender<TPixel>(TestPixel<TPixel> back, TestPixel<TPixel> source, float amount, TestPixel<TPixel> expected)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
TPixel actual = new DefaultPixelBlenders<TPixel>.SubtractSrcOver().Blend(back, source, amount); TPixel actual = new DefaultPixelBlenders<TPixel>.SubtractSrcOver().Blend(back, source, amount);
@ -160,8 +160,8 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders
} }
[Theory] [Theory]
[MemberData(nameof(SubstractFunctionData))] [MemberData(nameof(SubtractFunctionData))]
public void SubstractFunctionBlenderBulk<TPixel>(TestPixel<TPixel> back, TestPixel<TPixel> source, float amount, TestPixel<TPixel> expected) public void SubtractFunctionBlenderBulk<TPixel>(TestPixel<TPixel> back, TestPixel<TPixel> source, float amount, TestPixel<TPixel> expected)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
var dest = new Span<TPixel>(new TPixel[1]); var dest = new Span<TPixel>(new TPixel[1]);

6
tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -107,7 +107,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
} }
/// <summary> /// <summary>
/// Tests that the individual byte elements are layed out in RGBA order. /// Tests that the individual byte elements are laid out in RGBA order.
/// </summary> /// </summary>
[Fact] [Fact]
public unsafe void ByteLayout() public unsafe void ByteLayout()
@ -290,4 +290,4 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
Assert.Equal(expected, rgb.PackedValue); Assert.Equal(expected, rgb.PackedValue);
} }
} }
} }

6
tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Numerics; using System.Numerics;
@ -99,7 +99,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
} }
/// <summary> /// <summary>
/// Tests that the individual float elements are layed out in RGBA order. /// Tests that the individual float elements are laid out in RGBA order.
/// </summary> /// </summary>
[Fact] [Fact]
public void FloatLayout() public void FloatLayout()
@ -189,4 +189,4 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats
Assert.Equal(expected, rgba.ToScaledVector4()); Assert.Equal(expected, rgba.ToScaledVector4());
} }
} }
} }

32
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -33,8 +33,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
public static readonly string[] SmokeTestResamplerNames = public static readonly string[] SmokeTestResamplerNames =
{ {
nameof(KnownResamplers.NearestNeighbor), nameof(KnownResamplers.NearestNeighbor),
nameof(KnownResamplers.Bicubic), nameof(KnownResamplers.Bicubic),
nameof(KnownResamplers.Box), nameof(KnownResamplers.Box),
nameof(KnownResamplers.Lanczos5), nameof(KnownResamplers.Lanczos5),
}; };
@ -46,18 +46,18 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
public void Resize_PixelAgnostic() public void Resize_PixelAgnostic()
{ {
var filePath = TestFile.GetInputFileFullPath(TestImages.Jpeg.Baseline.Calliphora); var filePath = TestFile.GetInputFileFullPath(TestImages.Jpeg.Baseline.Calliphora);
using (Image image = Image.Load(filePath)) using (Image image = Image.Load(filePath))
{ {
image.Mutate(x => x.Resize(image.Size() / 2)); image.Mutate(x => x.Resize(image.Size() / 2));
string path = System.IO.Path.Combine( string path = System.IO.Path.Combine(
TestEnvironment.CreateOutputDirectory(nameof(ResizeTests)), TestEnvironment.CreateOutputDirectory(nameof(ResizeTests)),
nameof(this.Resize_PixelAgnostic) + ".png"); nameof(this.Resize_PixelAgnostic) + ".png");
image.Save(path); image.Save(path);
} }
} }
[Theory( [Theory(
Skip = "Debug only, enable manually" Skip = "Debug only, enable manually"
)] )]
@ -80,7 +80,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
image.DebugSave(provider, appendPixelTypeToFileName: false); image.DebugSave(provider, appendPixelTypeToFileName: false);
} }
} }
[Theory] [Theory]
[WithBasicTestPatternImages(15, 12, PixelTypes.Rgba32, 2, 3, 1, 2)] [WithBasicTestPatternImages(15, 12, PixelTypes.Rgba32, 2, 3, 1, 2)]
[WithBasicTestPatternImages(2, 256, PixelTypes.Rgba32, 1, 1, 1, 8)] [WithBasicTestPatternImages(2, 256, PixelTypes.Rgba32, 1, 1, 1, 8)]
@ -92,7 +92,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
// [WithBasicTestPatternImages(15, 12, PixelTypes.Rgba32, 2, 3, 1, 2)] means: // [WithBasicTestPatternImages(15, 12, PixelTypes.Rgba32, 2, 3, 1, 2)] means:
// resizing: (15, 12) -> (10, 6) // resizing: (15, 12) -> (10, 6)
// kernel dimensions: (3, 4) // kernel dimensions: (3, 4)
using (Image<TPixel> image = provider.GetImage()) using (Image<TPixel> image = provider.GetImage())
{ {
@ -122,9 +122,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
using (Image<TPixel> image0 = provider.GetImage()) using (Image<TPixel> image0 = provider.GetImage())
{ {
Size destSize = image0.Size() / 4; Size destSize = image0.Size() / 4;
Configuration configuration = Configuration.CreateDefaultInstance(); Configuration configuration = Configuration.CreateDefaultInstance();
int workingBufferSizeHintInBytes = workingBufferLimitInRows * destSize.Width * SizeOfVector4; int workingBufferSizeHintInBytes = workingBufferLimitInRows * destSize.Width * SizeOfVector4;
TestMemoryAllocator allocator = new TestMemoryAllocator(); TestMemoryAllocator allocator = new TestMemoryAllocator();
configuration.MemoryAllocator = allocator; configuration.MemoryAllocator = allocator;
@ -137,7 +137,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
Configuration.Default.MemoryAllocator); Configuration.Default.MemoryAllocator);
int minimumWorkerAllocationInBytes = verticalKernelMap.MaxDiameter * 2 * destSize.Width * SizeOfVector4; int minimumWorkerAllocationInBytes = verticalKernelMap.MaxDiameter * 2 * destSize.Width * SizeOfVector4;
verticalKernelMap.Dispose(); verticalKernelMap.Dispose();
using (Image<TPixel> image = image0.Clone(configuration)) using (Image<TPixel> image = image0.Clone(configuration))
{ {
image.Mutate(x => x.Resize(destSize, KnownResamplers.Bicubic, false)); image.Mutate(x => x.Resize(destSize, KnownResamplers.Bicubic, false));
@ -151,12 +151,12 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
provider, provider,
testOutputDetails: workingBufferLimitInRows, testOutputDetails: workingBufferLimitInRows,
appendPixelTypeToFileName: false); appendPixelTypeToFileName: false);
Assert.NotEmpty(allocator.AllocationLog); Assert.NotEmpty(allocator.AllocationLog);
int maxAllocationSize = allocator.AllocationLog.Where( int maxAllocationSize = allocator.AllocationLog.Where(
e => e.ElementType == typeof(Vector4)).Max(e => e.LengthInBytes); e => e.ElementType == typeof(Vector4)).Max(e => e.LengthInBytes);
Assert.True(maxAllocationSize <= Math.Max(workingBufferSizeHintInBytes, minimumWorkerAllocationInBytes)); Assert.True(maxAllocationSize <= Math.Max(workingBufferSizeHintInBytes, minimumWorkerAllocationInBytes));
} }
} }
@ -284,7 +284,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
{ {
IResampler sampler = TestUtils.GetResampler(samplerName); IResampler sampler = TestUtils.GetResampler(samplerName);
// NeirestNeighbourResampler is producing slightly different results With classic .NET framework on 32bit // NearestNeighbourResampler is producing slightly different results With classic .NET framework on 32bit
// most likely because of differences in numeric behavior. // most likely because of differences in numeric behavior.
// The difference is well visible when comparing output for // The difference is well visible when comparing output for
// Resize_WorksWithAllResamplers_TestPattern301x1180_NearestNeighbor-300x480.png // Resize_WorksWithAllResamplers_TestPattern301x1180_NearestNeighbor-300x480.png
@ -297,7 +297,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
// Let's make the working buffer size non-default: // Let's make the working buffer size non-default:
provider.Configuration.WorkingBufferSizeHintInBytes = 16 * 1024 * SizeOfVector4; provider.Configuration.WorkingBufferSizeHintInBytes = 16 * 1024 * SizeOfVector4;
provider.RunValidatingProcessorTest( provider.RunValidatingProcessorTest(
ctx => ctx =>
{ {
@ -538,4 +538,4 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms
} }
} }
} }
} }

6
tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -103,7 +103,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
public void RawTransformMatchesDocumentedExample<TPixel>(TestImageProvider<TPixel> provider) public void RawTransformMatchesDocumentedExample<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
// Printing some extra output to help investigating roundoff errors: // Printing some extra output to help investigating rounding errors:
this.Output.WriteLine($"Vector.IsHardwareAccelerated: {Vector.IsHardwareAccelerated}"); this.Output.WriteLine($"Vector.IsHardwareAccelerated: {Vector.IsHardwareAccelerated}");
// This test matches the output described in the example at // This test matches the output described in the example at
@ -160,4 +160,4 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms
return (IResampler)property.GetValue(null); return (IResampler)property.GetValue(null);
} }
} }
} }

10
tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -18,17 +18,17 @@ namespace SixLabors.ImageSharp.Tests
public void QuantizersDitherByDefault() public void QuantizersDitherByDefault()
{ {
var werner = new WernerPaletteQuantizer(); var werner = new WernerPaletteQuantizer();
var websafe = new WebSafePaletteQuantizer(); var webSafe = new WebSafePaletteQuantizer();
var octree = new OctreeQuantizer(); var octree = new OctreeQuantizer();
var wu = new WuQuantizer(); var wu = new WuQuantizer();
Assert.NotNull(werner.Diffuser); Assert.NotNull(werner.Diffuser);
Assert.NotNull(websafe.Diffuser); Assert.NotNull(webSafe.Diffuser);
Assert.NotNull(octree.Diffuser); Assert.NotNull(octree.Diffuser);
Assert.NotNull(wu.Diffuser); Assert.NotNull(wu.Diffuser);
Assert.True(werner.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither); Assert.True(werner.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither);
Assert.True(websafe.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither); Assert.True(webSafe.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither);
Assert.True(octree.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither); Assert.True(octree.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither);
Assert.True(wu.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither); Assert.True(wu.CreateFrameQuantizer<Rgba32>(this.Configuration).Dither);
} }
@ -101,4 +101,4 @@ namespace SixLabors.ImageSharp.Tests
return index; return index;
} }
} }
} }

4
tests/ImageSharp.Tests/TestFormat.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -212,7 +212,7 @@ namespace SixLabors.ImageSharp.Tests
pixelType = typeof(TPixel) pixelType = typeof(TPixel)
}); });
// TODO record this happend so we can verify it. // TODO record this happened so we can verify it.
return this.testFormat.Sample<TPixel>(); return this.testFormat.Sample<TPixel>();
} }

14
tests/ImageSharp.Tests/TestUtilities/ArrayHelper.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Linq; using System.Linq;
@ -11,16 +11,16 @@ namespace SixLabors.ImageSharp.Tests
/// Concatenates multiple arrays of the same type into one. /// Concatenates multiple arrays of the same type into one.
/// </summary> /// </summary>
/// <typeparam name="T">The array type</typeparam> /// <typeparam name="T">The array type</typeparam>
/// <param name="arrs">The arrays to concatenate. The order is kept</param> /// <param name="arrays">The arrays to concatenate. The order is kept</param>
/// <returns>The concatenated array</returns> /// <returns>The concatenated array</returns>
public static T[] Concat<T>(params T[][] arrs) public static T[] Concat<T>(params T[][] arrays)
{ {
var result = new T[arrs.Sum(t => t.Length)]; var result = new T[arrays.Sum(t => t.Length)];
int offset = 0; int offset = 0;
for (int i = 0; i < arrs.Length; i++) for (int i = 0; i < arrays.Length; i++)
{ {
arrs[i].CopyTo(result, offset); arrays[i].CopyTo(result, offset);
offset += arrs[i].Length; offset += arrays[i].Length;
} }
return result; return result;
} }

14
tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -72,8 +72,8 @@ namespace SixLabors.ImageSharp.Tests
addedRows = new[] { new object[0] }; addedRows = new[] { new object[0] };
} }
bool firstIsprovider = this.FirstIsProvider(testMethod); bool firstIsProvider = this.FirstIsProvider(testMethod);
if (firstIsprovider) if (firstIsProvider)
{ {
return this.InnerGetData(testMethod, addedRows); return this.InnerGetData(testMethod, addedRows);
} }
@ -98,12 +98,12 @@ namespace SixLabors.ImageSharp.Tests
{ {
Type factoryType = typeof(TestImageProvider<>).MakeGenericType(kv.Value); Type factoryType = typeof(TestImageProvider<>).MakeGenericType(kv.Value);
foreach (object[] originalFacoryMethodArgs in this.GetAllFactoryMethodArgs(testMethod, factoryType)) foreach (object[] originalFactoryMethodArgs in this.GetAllFactoryMethodArgs(testMethod, factoryType))
{ {
foreach (object[] row in memberData) foreach (object[] row in memberData)
{ {
object[] actualFactoryMethodArgs = new object[originalFacoryMethodArgs.Length + 2]; object[] actualFactoryMethodArgs = new object[originalFactoryMethodArgs.Length + 2];
Array.Copy(originalFacoryMethodArgs, actualFactoryMethodArgs, originalFacoryMethodArgs.Length); Array.Copy(originalFactoryMethodArgs, actualFactoryMethodArgs, originalFactoryMethodArgs.Length);
actualFactoryMethodArgs[actualFactoryMethodArgs.Length - 2] = testMethod; actualFactoryMethodArgs[actualFactoryMethodArgs.Length - 2] = testMethod;
actualFactoryMethodArgs[actualFactoryMethodArgs.Length - 1] = kv.Key; actualFactoryMethodArgs[actualFactoryMethodArgs.Length - 1] = kv.Key;
@ -192,4 +192,4 @@ namespace SixLabors.ImageSharp.Tests
return () => propInfo.GetValue(null, null); return () => propInfo.GetValue(null, null);
} }
} }
} }

4
tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
int width = actual.Width; int width = actual.Width;
// TODO: Comparing through Rgba64 may not be robust enough because of the existance of super high precision pixel types. // TODO: Comparing through Rgba64 may not be robust enough because of the existence of super high precision pixel types.
var aBuffer = new Rgba64[width]; var aBuffer = new Rgba64[width];
var bBuffer = new Rgba64[width]; var bBuffer = new Rgba64[width];
@ -54,4 +54,4 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
return new ImageSimilarityReport<TPixelA, TPixelB>(expected, actual, differences); return new ImageSimilarityReport<TPixelA, TPixelB>(expected, actual, differences);
} }
} }
} }

10
tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -19,7 +19,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
/// Individual manhattan pixel difference is only added to total image difference when the individual difference is over 'perPixelManhattanThreshold'. /// Individual manhattan pixel difference is only added to total image difference when the individual difference is over 'perPixelManhattanThreshold'.
/// </summary> /// </summary>
/// <param name="imageThreshold">The maximal tolerated difference represented by a value between 0.0 and 1.0 scaled to 0 and 65535.</param> /// <param name="imageThreshold">The maximal tolerated difference represented by a value between 0.0 and 1.0 scaled to 0 and 65535.</param>
/// <param name="perPixelManhattanThreshold">Gets the threshold of the individual pixels before they acumulate towards the overall difference.</param> /// <param name="perPixelManhattanThreshold">Gets the threshold of the individual pixels before they accumulate towards the overall difference.</param>
public TolerantImageComparer(float imageThreshold, int perPixelManhattanThreshold = 0) public TolerantImageComparer(float imageThreshold, int perPixelManhattanThreshold = 0)
{ {
Guard.MustBeGreaterThanOrEqualTo(imageThreshold, 0, nameof(imageThreshold)); Guard.MustBeGreaterThanOrEqualTo(imageThreshold, 0, nameof(imageThreshold));
@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
public float ImageThreshold { get; } public float ImageThreshold { get; }
/// <summary> /// <summary>
/// Gets the threshold of the individual pixels before they acumulate towards the overall difference. /// Gets the threshold of the individual pixels before they accumulate towards the overall difference.
/// For an individual <see cref="Rgba64"/> pixel pair the value is the Manhattan distance of pixels: /// For an individual <see cref="Rgba64"/> pixel pair the value is the Manhattan distance of pixels:
/// <see> /// <see>
/// <cref>https://en.wikipedia.org/wiki/Taxicab_geometry</cref> /// <cref>https://en.wikipedia.org/wiki/Taxicab_geometry</cref>
@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
int width = actual.Width; int width = actual.Width;
// TODO: Comparing through Rgba64 may not robust enough because of the existance of super high precision pixel types. // TODO: Comparing through Rgba64 may not robust enough because of the existence of super high precision pixel types.
var aBuffer = new Rgba64[width]; var aBuffer = new Rgba64[width];
var bBuffer = new Rgba64[width]; var bBuffer = new Rgba64[width];
@ -120,4 +120,4 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int Diff(ushort a, ushort b) => Math.Abs(a - b); private static int Diff(ushort a, ushort b) => Math.Abs(a - b);
} }
} }

12
tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.Tests
public Configuration Configuration { get; set; } = Configuration.CreateDefaultInstance(); public Configuration Configuration { get; set; } = Configuration.CreateDefaultInstance();
/// <summary> /// <summary>
/// Utility instance to provide informations about the test image & manage input/output /// Utility instance to provide information about the test image & manage input/output
/// </summary> /// </summary>
public ImagingTestCaseUtility Utility { get; private set; } public ImagingTestCaseUtility Utility { get; private set; }
@ -132,7 +132,7 @@ namespace SixLabors.ImageSharp.Tests
protected TestImageProvider<TPixel> Init( protected TestImageProvider<TPixel> Init(
string typeName, string typeName,
string methodName, string methodName,
string outputSubfolerName, string outputSubfolderName,
PixelTypes pixelTypeOverride) PixelTypes pixelTypeOverride)
{ {
if (pixelTypeOverride != PixelTypes.Undefined) if (pixelTypeOverride != PixelTypes.Undefined)
@ -141,7 +141,7 @@ namespace SixLabors.ImageSharp.Tests
} }
this.TypeName = typeName; this.TypeName = typeName;
this.MethodName = methodName; this.MethodName = methodName;
this.OutputSubfolderName = outputSubfolerName; this.OutputSubfolderName = outputSubfolderName;
this.Utility = new ImagingTestCaseUtility this.Utility = new ImagingTestCaseUtility
{ {
@ -151,7 +151,7 @@ namespace SixLabors.ImageSharp.Tests
if (methodName != null) if (methodName != null)
{ {
this.Utility.Init(typeName, methodName, outputSubfolerName); this.Utility.Init(typeName, methodName, outputSubfolderName);
} }
return this; return this;
@ -170,4 +170,4 @@ namespace SixLabors.ImageSharp.Tests
return $"{this.SourceFileOrDescription}[{this.PixelType}]"; return $"{this.SourceFileOrDescription}[{this.PixelType}]";
} }
} }
} }

8
tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -140,7 +140,7 @@ namespace SixLabors.ImageSharp.Tests
} }
/// <summary> /// <summary>
/// Fills the bottom left quadrent with 3 horizental bars in Red, Green and Blue with a alpha gradient from left (transparent) to right (solid). /// Fills the bottom left quadrant with 3 horizontal bars in Red, Green and Blue with a alpha gradient from left (transparent) to right (solid).
/// </summary> /// </summary>
/// <param name="pixels"></param> /// <param name="pixels"></param>
private static void TransparentGradients(Buffer2D<TPixel> pixels) private static void TransparentGradients(Buffer2D<TPixel> pixels)
@ -184,7 +184,7 @@ namespace SixLabors.ImageSharp.Tests
} }
/// <summary> /// <summary>
/// Fills the bottom right quadrant with all the colors producable by converting itterating over a uint and unpacking it. /// Fills the bottom right quadrant with all the colors producible by converting iterating over a uint and unpacking it.
/// A better algorithm could be used but it works /// A better algorithm could be used but it works
/// </summary> /// </summary>
/// <param name="pixels"></param> /// <param name="pixels"></param>
@ -214,4 +214,4 @@ namespace SixLabors.ImageSharp.Tests
} }
} }
} }
} }

6
tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -14,7 +14,7 @@ namespace SixLabors.ImageSharp.Tests
public class MeasureFixture public class MeasureFixture
{ {
/// <summary> /// <summary>
/// Value indicating whether priniting is enabled. /// Value indicating whether printing is enabled.
/// </summary> /// </summary>
protected bool EnablePrinting = true; protected bool EnablePrinting = true;
@ -79,4 +79,4 @@ namespace SixLabors.ImageSharp.Tests
this.Output.WriteLine($"{this.operation} completed in {this.stopwatch.ElapsedMilliseconds}ms"); this.Output.WriteLine($"{this.operation} completed in {this.stopwatch.ElapsedMilliseconds}ms");
} }
} }
} }

12
tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors. // Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System; using System;
@ -537,7 +537,7 @@ namespace SixLabors.ImageSharp.Tests
/// Utility method for doing the following in one step: /// Utility method for doing the following in one step:
/// 1. Executing an operation (taken as a delegate) /// 1. Executing an operation (taken as a delegate)
/// 2. Executing DebugSave() /// 2. Executing DebugSave()
/// 3. Executing CopareToReferenceOutput() /// 3. Executing CompareToReferenceOutput()
/// </summary> /// </summary>
internal static void VerifyOperation<TPixel>( internal static void VerifyOperation<TPixel>(
this TestImageProvider<TPixel> provider, this TestImageProvider<TPixel> provider,
@ -570,7 +570,7 @@ namespace SixLabors.ImageSharp.Tests
/// Utility method for doing the following in one step: /// Utility method for doing the following in one step:
/// 1. Executing an operation (taken as a delegate) /// 1. Executing an operation (taken as a delegate)
/// 2. Executing DebugSave() /// 2. Executing DebugSave()
/// 3. Executing CopareToReferenceOutput() /// 3. Executing CompareToReferenceOutput()
/// </summary> /// </summary>
internal static void VerifyOperation<TPixel>( internal static void VerifyOperation<TPixel>(
this TestImageProvider<TPixel> provider, this TestImageProvider<TPixel> provider,
@ -592,7 +592,7 @@ namespace SixLabors.ImageSharp.Tests
/// Utility method for doing the following in one step: /// Utility method for doing the following in one step:
/// 1. Executing an operation (taken as a delegate) /// 1. Executing an operation (taken as a delegate)
/// 2. Executing DebugSave() /// 2. Executing DebugSave()
/// 3. Executing CopareToReferenceOutput() /// 3. Executing CompareToReferenceOutput()
/// </summary> /// </summary>
internal static void VerifyOperation<TPixel>( internal static void VerifyOperation<TPixel>(
this TestImageProvider<TPixel> provider, this TestImageProvider<TPixel> provider,
@ -614,7 +614,7 @@ namespace SixLabors.ImageSharp.Tests
/// Utility method for doing the following in one step: /// Utility method for doing the following in one step:
/// 1. Executing an operation (taken as a delegate) /// 1. Executing an operation (taken as a delegate)
/// 2. Executing DebugSave() /// 2. Executing DebugSave()
/// 3. Executing CopareToReferenceOutput() /// 3. Executing CompareToReferenceOutput()
/// </summary> /// </summary>
internal static void VerifyOperation<TPixel>( internal static void VerifyOperation<TPixel>(
this TestImageProvider<TPixel> provider, this TestImageProvider<TPixel> provider,
@ -709,4 +709,4 @@ namespace SixLabors.ImageSharp.Tests
} }
} }
} }
} }

Loading…
Cancel
Save