diff --git a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs index 105c2f4e66..4b1d4222cb 100644 --- a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs +++ b/src/ImageSharp/Advanced/AdvancedImageExtensions.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. using System; @@ -153,42 +153,6 @@ internal static Memory GetPixelRowMemory(this Image sour internal static MemoryAllocator GetMemoryAllocator(this IConfigurable source) => GetConfiguration(source).MemoryAllocator; - /// - /// Gets the span to the backing buffer. - /// - /// The type of the pixel. - /// The source. - /// The span returned from Pixel source - private static Span GetSpan(IPixelSource source) - where TPixel : struct, IPixel - => source.PixelBuffer.GetSpan(); - - /// - /// Gets the span to the backing buffer at the given row. - /// - /// The type of the pixel. - /// The source. - /// The row. - /// - /// The span returned from Pixel source - /// - private static Span GetSpan(IPixelSource source, int row) - where TPixel : struct, IPixel - => GetSpan(source.PixelBuffer, row); - - /// - /// Gets the span to the backing buffer at the given row. - /// - /// The type of the pixel. - /// The source. - /// The row. - /// - /// The span returned from Pixel source. - /// - private static Span GetSpan(Buffer2D source, int row) - where TPixel : struct, IPixel - => source.GetSpan().Slice(row * source.Width, source.Width); - /// /// Gets the configuration. /// diff --git a/src/ImageSharp/Common/Helpers/Guard.cs b/src/ImageSharp/Common/Helpers/Guard.cs index e86da78e30..310765f698 100644 --- a/src/ImageSharp/Common/Helpers/Guard.cs +++ b/src/ImageSharp/Common/Helpers/Guard.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. using System; @@ -51,28 +51,6 @@ public static void NotNullOrWhiteSpace(string value, string parameterName) } } - /// - /// Ensures that the enumeration is not null or empty. - /// - /// The type of objects in the - /// The target enumeration, which should be checked against being null or empty. - /// Name of the parameter. - /// is null. - /// is empty. - [MethodImpl(InliningOptions.ShortMethod)] - public static void NotNullOrEmpty(ICollection value, string parameterName) - { - if (value is null) - { - ThrowArgumentNullException(parameterName); - } - - if (value.Count == 0) - { - ThrowArgumentException("Must not be empty.", parameterName); - } - } - /// /// Ensures that the specified value is less than a maximum value. /// diff --git a/src/ImageSharp/Formats/Png/Filters/SubFilter.cs b/src/ImageSharp/Formats/Png/Filters/SubFilter.cs index 6af5f0b648..e6fc1b6ae6 100644 --- a/src/ImageSharp/Formats/Png/Filters/SubFilter.cs +++ b/src/ImageSharp/Formats/Png/Filters/SubFilter.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. using System; @@ -25,12 +25,8 @@ public static void Decode(Span scanline, int bytesPerPixel) ref byte scanBaseRef = ref MemoryMarshal.GetReference(scanline); // Sub(x) + Raw(x-bpp) - int x = 1; - for (; x <= bytesPerPixel /* Note the <= because x starts at 1 */; ++x) - { - ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); - } - + int x = bytesPerPixel + 1; + Unsafe.Add(ref scanBaseRef, x); for (; x < scanline.Length; ++x) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs index e40e6c26c2..77c1cf2eab 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifReader.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. using System; @@ -419,16 +419,6 @@ private ushort ReadUInt16() : default; } - private string ReadString(int length) - { - if (this.TryReadSpan(length, out ReadOnlySpan span) && span.Length != 0) - { - return this.ConvertToString(span); - } - - return null; - } - private void GetThumbnail(uint offset) { var values = new List(); diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs index 3f330ef729..9069f0c7b7 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.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. using System; @@ -526,9 +526,8 @@ public IccMultiProcessElementsTagDataEntry ReadMultiProcessElementsTagDataEntry( { int start = this.currentIndex - 8; - // TODO: Why are we storing variable - ushort inChannelCount = this.ReadUInt16(); - ushort outChannelCount = this.ReadUInt16(); + this.ReadUInt16(); + this.ReadUInt16(); uint elementCount = this.ReadUInt32(); var positionTable = new IccPositionNumber[elementCount]; @@ -902,4 +901,4 @@ public IccUcrBgTagDataEntry ReadUcrBgTagDataEntry(uint size) return new IccUcrBgTagDataEntry(ucrCurve, bgCurve, description); } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs index bbfe909e01..79542b85fd 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.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. using System; @@ -83,16 +83,5 @@ private bool GetBit(byte value, int position) { return ((value >> (7 - position)) & 1) == 1; } - - /// - /// Gets the bit value at a specified position - /// - /// The value from where the bit will be extracted - /// Position of the bit. Zero based index from left to right. - /// The bit value at specified position - private bool GetBit(ushort value, int position) - { - return ((value >> (15 - position)) & 1) == 1; - } } } diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs index 8b4fa690d0..4f03ed6101 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs @@ -41,7 +41,6 @@ public int WriteOneDimensionalCurve(IccOneDimensionalCurve value) public int WriteResponseCurve(IccResponseCurve value) { int count = this.WriteUInt32((uint)value.CurveType); - int channels = value.XyzValues.Length; foreach (IccResponseNumber[] responseArray in value.ResponseArrays) { diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs index e681f84b85..ce80574ad3 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.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. using System; @@ -37,9 +37,6 @@ public int WriteVersionNumber(in IccVersion value) int minor = value.Minor.Clamp(0, 15); int bugfix = value.Patch.Clamp(0, 15); - // TODO: This is not used? - byte mb = (byte)((minor << 4) | bugfix); - int version = (major << 24) | (minor << 20) | (bugfix << 16); return this.WriteInt32(version); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs index dd12074352..b5bd14d9f1 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.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. using System.Numerics; @@ -15,7 +15,6 @@ namespace SixLabors.ImageSharp.PixelFormats public partial struct Gray16 : IPixel, IPackedVector { private const float Max = ushort.MaxValue; - private const float Average = 1 / 3F; /// /// Initializes a new instance of the struct. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.cs index 09597a949f..ac67c9d170 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Gray8.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. using System.Numerics; @@ -16,12 +16,6 @@ public partial struct Gray8 : IPixel, IPackedVector { private static readonly Vector4 MaxBytes = new Vector4(255F); private static readonly Vector4 Half = new Vector4(0.5F); - private const float Average = 1 / 3F; - - private static readonly Vector4 Min = new Vector4(0, 0, 0, 1f); - private static readonly Vector4 Max = Vector4.One; - - private static readonly Vector4 Accumulator = new Vector4(255f * Average, 255f * Average, 255f * Average, 0.5f); /// /// Initializes a new instance of the struct. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs index 38e75d1836..445f899817 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.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. using System; @@ -193,11 +193,10 @@ public bool Equals(RgbaVector other) => /// public override string ToString() { - var vector = this.ToVector4(); return FormattableString.Invariant($"RgbaVector({this.R:#0.##}, {this.G:#0.##}, {this.B:#0.##}, {this.A:#0.##})"); } /// public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B, this.A); } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs index 7cdc37ee41..7d8ba62083 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs @@ -51,10 +51,9 @@ protected override void OnFrameApply(ImageFrame source, Rectangle source { int sourceWidth = source.Width; int sourceHeight = source.Height; - int numberOfPixels = sourceWidth * sourceHeight; int tileWidth = (int)MathF.Ceiling(sourceWidth / (float)this.Tiles); int tileHeight = (int)MathF.Ceiling(sourceHeight / (float)this.Tiles); - int pixelsInTile = tileWidth * tileHeight; + int tileCount = this.Tiles; int halfTileWidth = tileWidth / 2; int halfTileHeight = tileHeight / 2; int luminanceLevels = this.LuminanceLevels; @@ -103,8 +102,8 @@ protected override void OnFrameApply(ImageFrame source, Rectangle source float luminanceEqualized = InterpolateBetweenFourTiles( pixel, cdfData, - this.Tiles, - this.Tiles, + tileCount, + tileCount, tileX, tileY, cdfX, @@ -467,7 +466,6 @@ public void CalculateLookupTables(ImageFrame source, HistogramEqualizati int tileWidth = this.tileWidth; int tileHeight = this.tileHeight; int luminanceLevels = this.luminanceLevels; - MemoryAllocator memoryAllocator = this.memoryAllocator; Parallel.For( 0, @@ -543,4 +541,4 @@ public void Dispose() } } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs index 947268750c..b9d867a937 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs @@ -49,8 +49,6 @@ public AdaptiveHistogramEqualizationSlidingWindowProcessor(int luminanceLevels, protected override void OnFrameApply(ImageFrame source, Rectangle sourceRectangle, Configuration configuration) { MemoryAllocator memoryAllocator = configuration.MemoryAllocator; - int numberOfPixels = source.Width * source.Height; - Span pixels = source.GetPixelSpan(); var parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism }; int tileWidth = source.Width / this.Tiles; diff --git a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs index b3a1603e6f..a790263fa1 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs @@ -42,7 +42,6 @@ protected override void OnFrameApply(ImageFrame source, Rectangle source { MemoryAllocator memoryAllocator = configuration.MemoryAllocator; int numberOfPixels = source.Width * source.Height; - Span pixels = source.GetPixelSpan(); var workingRect = new Rectangle(0, 0, source.Width, source.Height); using (IMemoryOwner histogramBuffer = memoryAllocator.Allocate(this.LuminanceLevels, AllocationOptions.Clean)) @@ -104,4 +103,4 @@ ref MemoryMarshal.GetReference(histogram), } } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs index 99178b34cc..b68a7f93f7 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs @@ -156,8 +156,6 @@ protected override void OnFrameApply(ImageFrame source, ImageFrame.Count; ref Vector bf = ref Unsafe.As>(ref this.data[0]); - ref Vector bu = ref Unsafe.As, Vector>(ref bf); - var scale = new Vector(1f / 255f); for (int i = 0; i < n; i++) diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs index 5ab7894355..ee95bc743b 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.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. using System.Numerics; @@ -50,7 +50,7 @@ public void CorrectlySetsBrushAndPath() ShapePath region = Assert.IsType(processor.Region); // path is converted to a polygon before filling - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); Assert.Equal(this.pen.StrokeFill, processor.Brush); } @@ -68,7 +68,7 @@ public void CorrectlySetsBrushPathOptions() Assert.Equal(this.noneDefault, processor.Options); ShapePath region = Assert.IsType(processor.Region); - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); Assert.Equal(this.pen.StrokeFill, processor.Brush); } @@ -86,7 +86,7 @@ public void CorrectlySetsColorAndPath() Assert.Equal(GraphicsOptions.Default, processor.Options); ShapePath region = Assert.IsType(processor.Region); - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -105,7 +105,7 @@ public void CorrectlySetsColorPathAndOptions() Assert.Equal(this.noneDefault, processor.Options); ShapePath region = Assert.IsType(processor.Region); - ComplexPolygon polygon = Assert.IsType(region.Shape); + Assert.IsType(region.Shape); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index d65dcd8c64..d12441ac2f 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.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. using System.Numerics; @@ -35,7 +35,7 @@ public void CorrectlySetsBrushAndPath() // path is converted to a polygon before filling Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -50,7 +50,7 @@ public void CorrectlySetsBrushPathOptions() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -65,7 +65,7 @@ public void CorrectlySetsColorAndPath() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -81,7 +81,7 @@ public void CorrectlySetsColorPathAndOptions() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs index 1f8e2d423d..17bb7e6ee5 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.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. using System.Numerics; @@ -51,7 +51,7 @@ public void CorrectlySetsBrushAndPath() // path is converted to a polygon before filling Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -70,7 +70,7 @@ public void CorrectlySetsBrushPathOptions() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -89,7 +89,7 @@ public void CorrectlySetsColorAndPath() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -109,7 +109,7 @@ public void CorrectlySetsColorPathAndOptions() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index 5af14d6088..22b741ec1e 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.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. using System.Numerics; @@ -35,7 +35,7 @@ public void CorrectlySetsBrushAndPath() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -50,7 +50,7 @@ public void CorrectlySetsBrushPathAndOptions() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); Assert.Equal(this.brush, processor.Brush); } @@ -66,7 +66,7 @@ public void CorrectlySetsColorAndPath() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); @@ -82,7 +82,7 @@ public void CorrectlySetsColorPathAndOptions() ShapeRegion region = Assert.IsType(processor.Region); Polygon polygon = Assert.IsType(region.Shape); - LinearLineSegment segment = Assert.IsType(polygon.LineSegments[0]); + Assert.IsType(polygon.LineSegments[0]); SolidBrush brush = Assert.IsType(processor.Brush); Assert.Equal(this.color, brush.Color); diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs index 572a870a4c..181ec9b9d7 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.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. using System.Numerics; @@ -14,14 +14,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Text { public class DrawText : BaseImageOperationsExtensionTest { - Rgba32 color = Color.HotPink; - - SolidBrush brush = Brushes.Solid(Color.HotPink); - - IPath path = new SixLabors.Shapes.Path( - new LinearLineSegment( - new SixLabors.Primitives.PointF[] { new Vector2(10, 10), new Vector2(20, 10), new Vector2(20, 10), new Vector2(30, 10), })); - private readonly FontCollection FontCollection; private readonly Font Font; @@ -103,7 +95,7 @@ public void DrawForEachACharacterWhenPenSetAndNotBrush() Pens.Dash(Color.Red, 1), Vector2.Zero); - var processor = this.Verify(0); + this.Verify(0); } [Fact] @@ -111,7 +103,7 @@ public void DrawForEachACharacterWhenPenSetAndNotBrushDefaultOptions() { this.operations.DrawText("123", this.Font, null, Pens.Dash(Color.Red, 1), Vector2.Zero); - var processor = this.Verify(0); + this.Verify(0); } [Fact] @@ -119,7 +111,7 @@ public void DrawForEachACharacterWhenPenSet() { this.operations.DrawText(new TextGraphicsOptions(true), "123", this.Font, Pens.Dash(Color.Red, 1), Vector2.Zero); - var processor = this.Verify(0); + this.Verify(0); } [Fact] diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs index ebd9cf6448..73a1114d37 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.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. using System; @@ -41,21 +41,17 @@ public void DoesntThrowExceptionWhenOverlappingRightEdge_Issue688(TestIm { Font font = CreateFont("OpenSans-Regular.ttf", 36); Color color = Color.Black; - float padding = 5; var text = "A short piece of text"; using (var img = provider.GetImage()) { - float targetWidth = img.Width - (padding * 2); - float targetHeight = img.Height - (padding * 2); - // measure the text size SizeF size = TextMeasurer.Measure(text, new RendererOptions(font)); //find out how much we need to scale the text to fill the space (up or down) float scalingFactor = Math.Min(img.Width / size.Width, img.Height / size.Height); - //create a new font + //create a new font Font scaledFont = new Font(font, scalingFactor * font.Size); var center = new PointF(img.Width / 2, img.Height / 2); @@ -64,7 +60,7 @@ public void DoesntThrowExceptionWhenOverlappingRightEdge_Issue688(TestIm HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; - + img.Mutate(i => i.DrawText(textGraphicOptions, text, scaledFont, color, center)); } } @@ -241,6 +237,6 @@ private static Font CreateFont(string fontName, int size) return font; } - + } } diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs index a2623ce171..d9fff9ded5 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs @@ -346,7 +346,7 @@ public void BmpDecoder_CanDecodeOversizedPalette(TestImageProvider(TestImageProvider provider) where TPixel : struct, IPixel { - Assert.Throws( () => { using (Image image = provider.GetImage(new BmpDecoder())) { } }); + Assert.Throws( () => { using (provider.GetImage(new BmpDecoder())) { } }); } [Theory] @@ -355,7 +355,7 @@ public void BmpDecoder_ThrowsImageFormatException_OnInvalidPaletteSize(T public void BmpDecoder_ThrowsNotSupportedException_OnUnsupportedBitmaps(TestImageProvider provider) where TPixel : struct, IPixel { - Assert.Throws(() => { using (Image image = provider.GetImage(new BmpDecoder())) { } }); + Assert.Throws(() => { using (provider.GetImage(new BmpDecoder())) { } }); } [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs index 1f49b67131..6c8732b5d8 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs @@ -153,7 +153,7 @@ public void DetectPixelSize(string imagePath, int expectedPixelSize) public void CanDecodeIntermingledImages() { using (var kumin1 = Image.Load(TestFile.Create(TestImages.Gif.Kumin).Bytes)) - using (var icon = Image.Load(TestFile.Create(TestImages.Png.Icon).Bytes)) + using (Image.Load(TestFile.Create(TestImages.Png.Icon).Bytes)) using (var kumin2 = Image.Load(TestFile.Create(TestImages.Gif.Kumin).Bytes)) { for (int i = 0; i < kumin1.Frames.Count; i++) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 36a160e59a..a9cddebc85 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -107,25 +107,6 @@ public void JpegDecoder_IsNotBoundToSinglePixelType(TestImageProvider(Image image, TestImageProvider provider) - where TPixel : struct, IPixel - { - var reportingComparer = ImageComparer.Tolerant(0, 0); - - ImageSimilarityReport report = image.GetReferenceOutputSimilarityReports( - provider, - reportingComparer, - appendPixelTypeToFileName: false - ).SingleOrDefault(); - - if (report?.TotalNormalizedDifference != null) - { - return report.DifferencePercentageString; - } - - return "0%"; - } - // DEBUG ONLY! // The PDF.js output should be saved by "tests\ImageSharp.Tests\Formats\Jpg\pdfjs\jpeg-converter.htm" // into "\tests\Images\ActualOutput\JpegDecoderTests\" diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs index e4c7e2231a..80ab860efe 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs @@ -102,7 +102,7 @@ public void Constructor_FramesMustHaveSameSize() ArgumentException ex = Assert.Throws( () => { - var collection = new ImageFrameCollection( + new ImageFrameCollection( this.Image, new[] { @@ -274,7 +274,6 @@ public void AddFrameFromPixelData() [Fact] public void AddFrame_clones_sourceFrame() { - var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray(); var otherFrame = new ImageFrame(Configuration.Default, 10, 10); var addedFrame = this.Image.Frames.AddFrame(otherFrame); addedFrame.ComparePixelBufferTo(otherFrame.GetPixelSpan()); @@ -284,7 +283,6 @@ public void AddFrame_clones_sourceFrame() [Fact] public void InsertFrame_clones_sourceFrame() { - var pixelData = this.Image.Frames.RootFrame.GetPixelSpan().ToArray(); var otherFrame = new ImageFrame(Configuration.Default, 10, 10); var addedFrame = this.Image.Frames.InsertFrame(0, otherFrame); addedFrame.ComparePixelBufferTo(otherFrame.GetPixelSpan()); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs index 975ed84e0b..96747b0d29 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.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. using System; @@ -25,8 +25,6 @@ public class DetectFormat : ImageLoadTestBase private byte[] ByteArray => this.DataStream.ToArray(); - private ReadOnlySpan ByteSpan => this.ByteArray.AsSpan(); - private IImageFormat LocalImageFormat => this.localImageFormatMock.Object; private static readonly IImageFormat ExpectedGlobalFormat = diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs index 92159f0c9a..58e19c9f70 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_PassLocalConfiguration.cs @@ -24,7 +24,7 @@ public void Configuration_Path_Specific() this.TestFormat.VerifySpecificDecodeCall(this.Marker, this.TopLevelConfiguration); } - + [Fact] public void Configuration_Path_Agnostic() { @@ -35,7 +35,7 @@ public void Configuration_Path_Agnostic() this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration); } - + [Fact] public void Configuration_Path_Decoder_Specific() { @@ -44,7 +44,7 @@ public void Configuration_Path_Decoder_Specific() Assert.NotNull(img); this.localDecoder.Verify(x => x.Decode(this.TopLevelConfiguration, this.DataStream)); } - + [Fact] public void Configuration_Path_Decoder_Agnostic() { @@ -61,10 +61,10 @@ public void Configuration_Path_OutFormat_Specific() Assert.NotNull(img); Assert.Equal(this.TestFormat, format); - + this.TestFormat.VerifySpecificDecodeCall(this.Marker, this.TopLevelConfiguration); } - + [Fact] public void Configuration_Path_OutFormat_Agnostic() { @@ -72,14 +72,14 @@ public void Configuration_Path_OutFormat_Agnostic() Assert.NotNull(img); Assert.Equal(this.TestFormat, format); - + this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration); - } - + } + [Fact] public void WhenFileNotFound_Throws() { - System.IO.FileNotFoundException ex = Assert.Throws( + Assert.Throws( () => { Image.Load(this.TopLevelConfiguration, Guid.NewGuid().ToString()); @@ -89,7 +89,7 @@ public void WhenFileNotFound_Throws() [Fact] public void WhenPathIsNull_Throws() { - ArgumentNullException ex = Assert.Throws( + Assert.Throws( () => { Image.Load(this.TopLevelConfiguration,(string)null); @@ -97,4 +97,4 @@ public void WhenPathIsNull_Throws() } } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs index 19cf7ee647..4d3a229c55 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FileSystemPath_UseDefaultConfiguration.cs @@ -82,7 +82,7 @@ public void Path_OutFormat_Agnostic() [Fact] public void WhenFileNotFound_Throws() { - System.IO.FileNotFoundException ex = Assert.Throws( + Assert.Throws( () => { Image.Load(Guid.NewGuid().ToString()); @@ -92,7 +92,7 @@ public void WhenFileNotFound_Throws() [Fact] public void WhenPathIsNull_Throws() { - ArgumentNullException ex = Assert.Throws( + Assert.Throws( () => { Image.Load((string)null); @@ -100,4 +100,4 @@ public void WhenPathIsNull_Throws() } } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs index 5fe87fedca..ad8dc20e43 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs @@ -18,11 +18,6 @@ public class Load_FromBytes_PassLocalConfiguration : ImageLoadTestBase private ReadOnlySpan ByteSpan => this.ByteArray.AsSpan(); - private byte[] ActualImageBytes => TestFile.Create(TestImages.Bmp.F).Bytes; - - private ReadOnlySpan ActualImageSpan => this.ActualImageBytes.AsSpan(); - - [Theory] [InlineData(false)] [InlineData(true)] @@ -116,4 +111,4 @@ public void Configuration_Bytes_OutFormat_Agnostic(bool useSpan) } } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs index cbca1e000a..171b681cec 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs @@ -24,7 +24,7 @@ public void Image_Load_Throws_UnknownImageFormatException() { Assert.Throws(() => { - using (var img = Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) + using (Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) { } }); @@ -35,7 +35,7 @@ public void Image_Load_T_Throws_UnknownImageFormatException() { Assert.Throws(() => { - using (var img = Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) + using (Image.Load(Configuration.Default, this.Stream, out IImageFormat format)) { } }); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Save.cs b/tests/ImageSharp.Tests/Image/ImageTests.Save.cs index b8eb52d9e7..66b0dd21d9 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Save.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Save.cs @@ -27,7 +27,7 @@ public void DetectedEncoding() image.Save(file); } - using (var img = Image.Load(file, out IImageFormat mime)) + using (Image.Load(file, out IImageFormat mime)) { Assert.Equal("image/png", mime.DefaultMimeType); } @@ -39,7 +39,7 @@ public void WhenExtensionIsUnknown_Throws() string dir = TestEnvironment.CreateOutputDirectory(nameof(ImageTests)); string file = System.IO.Path.Combine(dir, "UnknownExtensionsEncoding_Throws.tmp"); - NotSupportedException ex = Assert.Throws( + Assert.Throws( () => { using (var image = new Image(10, 10)) @@ -60,7 +60,7 @@ public void SetEncoding() image.Save(file, new PngEncoder()); } - using (var img = Image.Load(file, out var mime)) + using (Image.Load(file, out var mime)) { Assert.Equal("image/png", mime.DefaultMimeType); } diff --git a/tests/ImageSharp.Tests/ImageOperationTests.cs b/tests/ImageSharp.Tests/ImageOperationTests.cs index 455e2c5f1b..7f8b133758 100644 --- a/tests/ImageSharp.Tests/ImageOperationTests.cs +++ b/tests/ImageSharp.Tests/ImageOperationTests.cs @@ -83,7 +83,7 @@ public void CloneCallsImageOperationsProvider_ListOfProcessors_WithDuplicateImag [Fact] public void CloneCallsImageOperationsProvider_Func_NotOnOriginal() { - Image returned = this.image.Clone(x => x.ApplyProcessor(this.processorDefinition)); + this.image.Clone(x => x.ApplyProcessor(this.processorDefinition)); Assert.False(this.provider.HasCreated(this.image)); Assert.DoesNotContain( this.processorDefinition, @@ -93,7 +93,7 @@ public void CloneCallsImageOperationsProvider_Func_NotOnOriginal() [Fact] public void CloneCallsImageOperationsProvider_ListOfProcessors_NotOnOriginal() { - Image returned = this.image.Clone(this.processorDefinition); + this.image.Clone(this.processorDefinition); Assert.False(this.provider.HasCreated(this.image)); Assert.DoesNotContain( this.processorDefinition, diff --git a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs index 668e699c5f..6fc5142ee8 100644 --- a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs +++ b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.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. using System; @@ -373,7 +373,6 @@ public void WritingImagePreservesExifProfile(TestImageWriteFormat imageFormat) public void ProfileToByteArray() { // arrange - byte[] exifBytesWithExifCode = ProfileResolver.ExifMarker.Concat(ExifConstants.LittleEndianByteOrderMarker).ToArray(); byte[] exifBytesWithoutExifCode = ExifConstants.LittleEndianByteOrderMarker; ExifProfile expectedProfile = CreateExifProfile(); var expectedProfileTags = expectedProfile.Values.Select(x => x.Tag).ToList(); diff --git a/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs b/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs index a1944669d0..52d88afafc 100644 --- a/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.cs +++ b/tests/ImageSharp.Tests/MetaData/Profiles/ICC/IccProfileTests.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. using System; @@ -25,7 +25,7 @@ public void CalculateHash_WithByteArray_DoesNotModifyData() byte[] copy = new byte[data.Length]; Buffer.BlockCopy(data, 0, copy, 0, data.Length); - IccProfileId result = IccProfile.CalculateHash(data); + IccProfile.CalculateHash(data); Assert.Equal(data, copy); } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs index 1de274f9a9..58242713cc 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.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. using System; @@ -816,7 +816,6 @@ public void FromGray16(int count) for (int i = 0; i < count; i++) { - int i2 = i * 2; expected[i].FromGray16(source[i]); } diff --git a/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs index 1cb7d89980..45f8e25f43 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Short4Tests.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. using System.Numerics; @@ -61,7 +61,6 @@ public void Short4_FromScaledVector4() // act var pixel = default(Short4); pixel.FromScaledVector4(scaled); - ulong actual = pixel.PackedValue; // assert Assert.Equal((ulong)expected, pixel.PackedValue); diff --git a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs index 0af8ae45f9..d684198fa7 100644 --- a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs +++ b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.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. using System; @@ -19,37 +19,25 @@ public class DenseMatrixTests [Fact] public void DenseMatrixThrowsOnNullInitializer() { - Assert.Throws(() => - { - var dense = new DenseMatrix(null); - }); + Assert.Throws(() => new DenseMatrix(null)); } [Fact] public void DenseMatrixThrowsOnEmptyZeroWidth() { - Assert.Throws(() => - { - var dense = new DenseMatrix(0, 10); - }); + Assert.Throws(() => new DenseMatrix(0, 10)); } [Fact] public void DenseMatrixThrowsOnEmptyZeroHeight() { - Assert.Throws(() => - { - var dense = new DenseMatrix(10, 0); - }); + Assert.Throws(() => new DenseMatrix(10, 0)); } [Fact] public void DenseMatrixThrowsOnEmptyInitializer() { - Assert.Throws(() => - { - var dense = new DenseMatrix(new float[0, 0]); - }); + Assert.Throws(() => new DenseMatrix(new float[0, 0])); } [Fact] @@ -131,4 +119,4 @@ public void DenseMatrixCanTranspose() Assert.Equal(3, transposed[2, 0]); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs index 6afcb95189..41e60c84ae 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.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. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ public class BlackWhiteTest : BaseImageOperationsExtensionTest public void BlackWhite_CorrectProcessor() { this.operations.BlackWhite(); - BlackWhiteProcessor p = this.Verify(); + this.Verify(); } [Fact] public void BlackWhite_rect_CorrectProcessor() { this.operations.BlackWhite(this.rect); - BlackWhiteProcessor p = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs index 1cfb88d3ae..e287fb7b5f 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.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. using System.Collections.Generic; @@ -31,7 +31,7 @@ public void ColorBlindness_CorrectProcessor(TestType testType, ColorBlindn where T : IImageProcessor { this.operations.ColorBlindness(colorBlindness); - T p = this.Verify(); + this.Verify(); } [Theory] [MemberData(nameof(TheoryData))] @@ -39,7 +39,7 @@ public void ColorBlindness_rect_CorrectProcessor(TestType testType, ColorB where T : IImageProcessor { this.operations.ColorBlindness(colorBlindness, this.rect); - T p = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs b/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs index c5eec009a1..46fa611686 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/FilterTest.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. using Xunit; @@ -14,14 +14,14 @@ public class FilterTest : BaseImageOperationsExtensionTest public void Filter_CorrectProcessor() { this.operations.Filter(KnownFilterMatrices.AchromatomalyFilter * KnownFilterMatrices.CreateHueFilter(90F)); - FilterProcessor p = this.Verify(); + this.Verify(); } [Fact] public void Filter_rect_CorrectProcessor() { this.operations.Filter(KnownFilterMatrices.AchromatomalyFilter * KnownFilterMatrices.CreateHueFilter(90F), this.rect); - FilterProcessor p = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs index d04a2272d8..08de55d6b1 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.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. using System.Collections.Generic; @@ -24,7 +24,7 @@ public void Grayscale_mode_CorrectProcessor(TestType testType, GrayscaleMo where T : IImageProcessor { this.operations.Grayscale(mode); - var p = this.Verify(); + this.Verify(); } [Theory] @@ -43,4 +43,4 @@ public void Grayscale_rect_CorrectProcessor() this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs b/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs index 888ee4bcb3..7e8b76458b 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/InvertTest.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. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ public class InvertTest : BaseImageOperationsExtensionTest public void Invert_InvertProcessorDefaultsSet() { this.operations.Invert(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Pixelate_rect_PixelateProcessorDefaultsSet() { this.operations.Invert(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs b/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs index 1b9e1689da..c171a12431 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.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. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ public class KodachromeTest : BaseImageOperationsExtensionTest public void Kodachrome_amount_KodachromeProcessorDefaultsSet() { this.operations.Kodachrome(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Kodachrome_amount_rect_KodachromeProcessorDefaultsSet() { this.operations.Kodachrome(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs index c785d1d255..a9aecaa9ca 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.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. using Xunit; @@ -14,14 +14,14 @@ public class LomographTest : BaseImageOperationsExtensionTest public void Lomograph_amount_LomographProcessorDefaultsSet() { this.operations.Lomograph(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Lomograph_amount_rect_LomographProcessorDefaultsSet() { this.operations.Lomograph(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs index d7ed7d1ff4..c3e2c3c502 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.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. using SixLabors.ImageSharp.Processing; @@ -14,14 +14,14 @@ public class PolaroidTest : BaseImageOperationsExtensionTest public void Polaroid_amount_PolaroidProcessorDefaultsSet() { this.operations.Polaroid(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Polaroid_amount_rect_PolaroidProcessorDefaultsSet() { this.operations.Polaroid(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs b/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs index 7ed4f5244c..02e5f42763 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.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. using SixLabors.ImageSharp.Processing; @@ -13,14 +13,14 @@ public class SepiaTest : BaseImageOperationsExtensionTest public void Sepia_amount_SepiaProcessorDefaultsSet() { this.operations.Sepia(); - var processor = this.Verify(); + this.Verify(); } [Fact] public void Sepia_amount_rect_SepiaProcessorDefaultsSet() { this.operations.Sepia(this.rect); - var processor = this.Verify(this.rect); + this.Verify(this.rect); } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs index dc169df816..91b011ed6a 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.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. using System; @@ -131,7 +131,7 @@ private void VerifyKernelMapContentIsCorrect(string resamplerName, int srcSize, var referenceMap = ReferenceKernelMap.Calculate(resampler, destSize, srcSize); var kernelMap = ResizeKernelMap.Calculate(resampler, destSize, srcSize, Configuration.Default.MemoryAllocator); - + #if DEBUG this.Output.WriteLine(kernelMap.Info); @@ -239,4 +239,4 @@ private static TheoryData GenerateImageResizeData() return result; } } -} \ No newline at end of file +} diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs index f19029f8cc..44af423479 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.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. using System; @@ -249,11 +249,6 @@ private static byte[] CreateNamedColor(int devCoordCount, byte name, byte PCS, b LocalizedString_Rand1, LocalizedString_Rand2, }; - private static readonly IccLocalizedString[] LocalizedString_RandArr2 = new IccLocalizedString[] - { - LocalizedString_Rand2, - LocalizedString_Rand1, - }; private static readonly IccMultiLocalizedUnicodeTagDataEntry MultiLocalizedUnicode_Val = new IccMultiLocalizedUnicodeTagDataEntry(LocalizedString_RandArr1); private static readonly byte[] MultiLocalizedUnicode_Arr = ArrayHelper.Concat diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 1a33efd34c..63de4c96f4 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -166,7 +166,6 @@ protected TestImageProvider Init(MethodInfo testMethod, PixelTypes pixel public override string ToString() { - string provName = this.GetType().Name.Replace("Provider", ""); return $"{this.SourceFileOrDescription}[{this.PixelType}]"; } } diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index b49baa5c41..f589db6976 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.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. using System; @@ -20,17 +20,16 @@ namespace SixLabors.ImageSharp.Tests public class TestImageProviderTests { public static readonly TheoryData BasicData = new TheoryData() - { - TestImageProvider.Blank(10, 20), - TestImageProvider.Blank(10, 20), - }; + { + TestImageProvider.Blank(10, 20), + TestImageProvider.Blank(10, 20), + }; public static readonly TheoryData FileData = new TheoryData() - { - TestImageProvider.File(TestImages.Bmp.Car), - TestImageProvider.File( - TestImages.Bmp.F) - }; + { + TestImageProvider.File(TestImages.Bmp.Car), + TestImageProvider.File(TestImages.Bmp.F) + }; public static string[] AllBmpFiles = { TestImages.Bmp.F, TestImages.Bmp.Bit8 }; @@ -320,7 +319,7 @@ public void Use_WithTestPatternImages(TestImageProvider provider img.DebugSave(provider); } } - + [Theory] [WithTestPatternImages(20, 20, PixelTypes.Rgba32)] public void Use_WithTestPatternImages_CustomConfiguration(TestImageProvider provider) @@ -332,13 +331,13 @@ public void Use_WithTestPatternImages_CustomConfiguration(TestImageProvi private static void EnsureCustomConfigurationIsApplied(TestImageProvider provider) where TPixel : struct, IPixel { - using (var image1 = provider.GetImage()) + using (provider.GetImage()) { var customConfiguration = Configuration.CreateDefaultInstance(); provider.Configuration = customConfiguration; - using (var image2 = provider.GetImage()) - using (var image3 = provider.GetImage()) + using (Image image2 = provider.GetImage()) + using (Image image3 = provider.GetImage()) { Assert.Same(customConfiguration, image2.GetConfiguration()); Assert.Same(customConfiguration, image3.GetConfiguration()); @@ -379,7 +378,7 @@ internal void InitCaller(string name) this.callerName = name; invocationCounts[name] = 0; } - + public Image Decode(Configuration configuration, Stream stream) => this.Decode(configuration, stream); } @@ -418,8 +417,8 @@ internal void InitCaller(string name) this.callerName = name; invocationCounts[name] = 0; } - + public Image Decode(Configuration configuration, Stream stream) => this.Decode(configuration, stream); } } -} \ No newline at end of file +}