diff --git a/.editorconfig b/.editorconfig index af1e5b44c..f579ff5d3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -161,6 +161,9 @@ csharp_style_deconstructed_variable_declaration = true:warning csharp_style_prefer_index_operator = true:warning csharp_style_prefer_range_operator = true:warning csharp_style_implicit_object_creation_when_type_is_apparent = true:error +# ReSharper inspection severities +resharper_arrange_object_creation_when_type_evident_highlighting = error +resharper_arrange_object_creation_when_type_not_evident_highlighting = error # "Null" checking preferences csharp_style_throw_expression = true:warning csharp_style_conditional_delegate_call = true:warning @@ -174,6 +177,9 @@ csharp_using_directive_placement = outside_namespace:warning csharp_prefer_static_local_function = true:warning # Primary constructor preferences csharp_style_prefer_primary_constructors = false:none +# Collection preferences +dotnet_style_prefer_collection_expression = true:error +resharper_use_collection_expression_highlighting =true:error ########################################## # Unnecessary Code Rules diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index cb90793e0..ff3d5c7b0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -11,35 +11,79 @@ on: branches: - main - release/* - types: [ labeled, opened, synchronize, reopened ] + types: [ opened, synchronize, reopened ] + jobs: + # Prime a single LFS cache and expose the exact key for the matrix + WarmLFS: + runs-on: ubuntu-latest + outputs: + lfs_key: ${{ steps.expose-key.outputs.lfs_key }} + steps: + - name: Git Config + shell: bash + run: | + git config --global core.autocrlf false + git config --global core.longpaths true + + - name: Git Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + # Deterministic list of LFS object IDs, then compute a portable key: + # - `git lfs ls-files -l` lists all tracked LFS objects with their SHA-256 + # - `awk '{print $1}'` extracts just the SHA field + # - `sort` sorts in byte order (hex hashes sort the same everywhere) + # This ensures the file content is identical regardless of OS or locale + - name: Git Create LFS id list + shell: bash + run: git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id + + - name: Git Expose LFS cache key + id: expose-key + shell: bash + env: + LFS_KEY: lfs-${{ hashFiles('.lfs-assets-id') }}-v1 + run: echo "lfs_key=$LFS_KEY" >> "$GITHUB_OUTPUT" + + - name: Git Setup LFS Cache + uses: actions/cache@v4 + with: + path: .git/lfs + key: ${{ steps.expose-key.outputs.lfs_key }} + + - name: Git Pull LFS + shell: bash + run: git lfs pull + Build: + needs: WarmLFS strategy: matrix: - isARM: - - ${{ contains(github.event.pull_request.labels.*.name, 'arch:arm32') || contains(github.event.pull_request.labels.*.name, 'arch:arm64') }} options: - os: ubuntu-latest - framework: net9.0 - sdk: 9.0.x + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false - - os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable - framework: net9.0 - sdk: 9.0.x + - os: macos-26 + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false - os: windows-latest - framework: net9.0 - sdk: 9.0.x + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false - - os: buildjet-4vcpu-ubuntu-2204-arm - framework: net9.0 - sdk: 9.0.x + - os: ubuntu-22.04-arm + framework: net10.0 + sdk: 10.0.x sdk-preview: true runtime: -x64 codecov: false @@ -49,7 +93,7 @@ jobs: sdk: 8.0.x runtime: -x64 codecov: false - - os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable + - os: macos-26 framework: net8.0 sdk: 8.0.x runtime: -x64 @@ -59,24 +103,32 @@ jobs: sdk: 8.0.x runtime: -x64 codecov: false - - os: buildjet-4vcpu-ubuntu-2204-arm + - os: ubuntu-22.04-arm framework: net8.0 sdk: 8.0.x runtime: -x64 codecov: false - exclude: - - isARM: false - options: - os: buildjet-4vcpu-ubuntu-2204-arm - runs-on: ${{matrix.options.os}} + runs-on: ${{ matrix.options.os }} steps: - name: Install libgdi+, which is required for tests running on ubuntu if: ${{ contains(matrix.options.os, 'ubuntu') }} run: | - sudo apt-get update - sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev + sudo apt-get update + sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev + + - name: Install libgdi+, which is required for tests running on macos + if: ${{ contains(matrix.options.os, 'macos-26') }} + run: | + brew update + brew install mono-libgdiplus + # Create symlinks to make libgdiplus discoverable + sudo mkdir -p /usr/local/lib + sudo ln -sf $(brew --prefix)/lib/libgdiplus.dylib /usr/local/lib/libgdiplus.dylib + # Verify installation + ls -la $(brew --prefix)/lib/libgdiplus* || echo "libgdiplus not found in brew prefix" + ls -la /usr/local/lib/libgdiplus* || echo "libgdiplus not found in /usr/local/lib" - name: Git Config shell: bash @@ -90,18 +142,15 @@ jobs: fetch-depth: 0 submodules: recursive - # See https://github.com/actions/checkout/issues/165#issuecomment-657673315 - - name: Git Create LFS FileList - run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id - + # Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here. - name: Git Setup LFS Cache uses: actions/cache@v4 - id: lfs-cache with: path: .git/lfs - key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1 + key: ${{ needs.WarmLFS.outputs.lfs_key }} - name: Git Pull LFS + shell: bash run: git lfs pull - name: NuGet Install @@ -127,7 +176,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 9.0.x + 10.0.x - name: DotNet Build if: ${{ matrix.options.sdk-preview != true }} @@ -168,11 +217,8 @@ jobs: Publish: needs: [Build] - runs-on: ubuntu-latest - if: (github.event_name == 'push') - steps: - name: Git Config shell: bash @@ -213,4 +259,3 @@ jobs: run: | dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate - diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index b4965795c..07ce0408f 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -4,6 +4,7 @@ on: schedule: # 2AM every Tuesday/Thursday - cron: "0 2 * * 2,4" + jobs: Build: strategy: @@ -14,15 +15,14 @@ jobs: runtime: -x64 codecov: true - runs-on: ${{matrix.options.os}} + runs-on: ${{ matrix.options.os }} steps: - - name: Install libgdi+, which is required for tests running on ubuntu if: ${{ contains(matrix.options.os, 'ubuntu') }} run: | - sudo apt-get update - sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev + sudo apt-get update + sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev - name: Git Config shell: bash @@ -36,16 +36,21 @@ jobs: fetch-depth: 0 submodules: recursive - # See https://github.com/actions/checkout/issues/165#issuecomment-657673315 - - name: Git Create LFS FileList - run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id + # Deterministic list of LFS object IDs, then compute a portable key: + # - `git lfs ls-files -l` lists all tracked LFS objects with their SHA-256 + # - `awk '{print $1}'` extracts just the SHA field + # - `sort` sorts in byte order (hex hashes sort the same everywhere) + # This ensures the file content is identical regardless of OS or locale + - name: Git Create LFS id list + shell: bash + run: git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id - name: Git Setup LFS Cache uses: actions/cache@v4 id: lfs-cache with: path: .git/lfs - key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1 + key: lfs-${{ hashFiles('.lfs-assets-id') }}-v1 - name: Git Pull LFS run: git lfs pull @@ -69,13 +74,13 @@ jobs: - name: DotNet Build shell: pwsh - run: ./ci-build.ps1 "${{matrix.options.framework}}" + run: ./ci-build.ps1 "${{ matrix.options.framework }}" env: SIXLABORS_TESTING: True - name: DotNet Test shell: pwsh - run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}" + run: ./ci-test.ps1 "${{ matrix.options.os }}" "${{ matrix.options.framework }}" "${{ matrix.options.runtime }}" "${{ matrix.options.codecov }}" env: SIXLABORS_TESTING: True XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit @@ -88,7 +93,8 @@ jobs: path: tests/Images/ActualOutput/ - name: Codecov Update - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors') with: flags: unittests + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Directory.Build.props b/Directory.Build.props index 755cbe3b3..9bda76f88 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,10 +21,14 @@ - + 12.0 + + 14.0 + + - + diff --git a/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs b/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs index 53c26a57e..80b096344 100644 --- a/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs +++ b/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs @@ -73,7 +73,8 @@ public class FromVector4Rgba32 : FromVector4 SimdUtils.HwIntrinsics.NormalizedFloatToByteSaturate(sBytes, dFloats); } - private static ReadOnlySpan PermuteMaskDeinterleave8x32 => new byte[] { 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0 }; + private static ReadOnlySpan PermuteMaskDeinterleave8x32 => [0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0 + ]; [Benchmark] public void UseAvx2_Grouped() diff --git a/tests/ImageSharp.Benchmarks/Codecs/Bmp/EncodeBmpMultiple.cs b/tests/ImageSharp.Benchmarks/Codecs/Bmp/EncodeBmpMultiple.cs index fdef1b2bf..ce54c133b 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Bmp/EncodeBmpMultiple.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Bmp/EncodeBmpMultiple.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs; [Config(typeof(Config.Short))] public class EncodeBmpMultiple : MultiImageBenchmarkBase.WithImagesPreloaded { - protected override IEnumerable InputImageSubfoldersOrFiles => new[] { "Bmp/", "Jpg/baseline" }; + protected override IEnumerable InputImageSubfoldersOrFiles => ["Bmp/", "Jpg/baseline"]; [Benchmark(Description = "EncodeBmpMultiple - ImageSharp")] public void EncodeBmpImageSharp() diff --git a/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs b/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs index 303272837..1eca07ec7 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Gif/EncodeGifMultiple.cs @@ -15,7 +15,7 @@ public class EncodeGifMultiple : MultiImageBenchmarkBase.WithImagesPreloaded [Params(InputImageCategory.AllImages)] public override InputImageCategory InputCategory { get; set; } - protected override IEnumerable InputImageSubfoldersOrFiles => new[] { "Gif/" }; + protected override IEnumerable InputImageSubfoldersOrFiles => ["Gif/"]; [Benchmark(Description = "EncodeGifMultiple - ImageSharp")] public void EncodeGifImageSharp() diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs index 72b6bb72e..4ea0a92f1 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs @@ -185,15 +185,15 @@ public class Block8x8F_CopyTo2x2 ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); ref Vector2 dBottomRight = ref Unsafe.Add(ref dBottomLeft, 4); - var xLeft = new Vector2(sLeft.X); - var yLeft = new Vector2(sLeft.Y); - var zLeft = new Vector2(sLeft.Z); - var wLeft = new Vector2(sLeft.W); + Vector2 xLeft = new(sLeft.X); + Vector2 yLeft = new(sLeft.Y); + Vector2 zLeft = new(sLeft.Z); + Vector2 wLeft = new(sLeft.W); - var xRight = new Vector2(sRight.X); - var yRight = new Vector2(sRight.Y); - var zRight = new Vector2(sRight.Z); - var wRight = new Vector2(sRight.W); + Vector2 xRight = new(sRight.X); + Vector2 yRight = new(sRight.Y); + Vector2 zRight = new(sRight.Z); + Vector2 wRight = new(sRight.W); dTopLeft = xLeft; Unsafe.Add(ref dTopLeft, 1) = yLeft; @@ -245,15 +245,15 @@ public class Block8x8F_CopyTo2x2 ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); ref Vector2 dBottomRight = ref Unsafe.Add(ref dBottomLeft, 4); - var xLeft = new Vector4(sLeft.X); - var yLeft = new Vector4(sLeft.Y); - var zLeft = new Vector4(sLeft.Z); - var wLeft = new Vector4(sLeft.W); + Vector4 xLeft = new(sLeft.X); + Vector4 yLeft = new(sLeft.Y); + Vector4 zLeft = new(sLeft.Z); + Vector4 wLeft = new(sLeft.W); - var xRight = new Vector4(sRight.X); - var yRight = new Vector4(sRight.Y); - var zRight = new Vector4(sRight.Z); - var wRight = new Vector4(sRight.W); + Vector4 xRight = new(sRight.X); + Vector4 yRight = new(sRight.Y); + Vector4 zRight = new(sRight.Z); + Vector4 wRight = new(sRight.W); Unsafe.As(ref dTopLeft) = xLeft; Unsafe.As(ref Unsafe.Add(ref dTopLeft, 1)) = yLeft; @@ -303,15 +303,15 @@ public class Block8x8F_CopyTo2x2 ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, (uint)(2 * row * destStride)); ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); - var xLeft = new Vector4(sLeft.X); - var yLeft = new Vector4(sLeft.Y); - var zLeft = new Vector4(sLeft.Z); - var wLeft = new Vector4(sLeft.W); + Vector4 xLeft = new(sLeft.X); + Vector4 yLeft = new(sLeft.Y); + Vector4 zLeft = new(sLeft.Z); + Vector4 wLeft = new(sLeft.W); - var xRight = new Vector4(sRight.X); - var yRight = new Vector4(sRight.Y); - var zRight = new Vector4(sRight.Z); - var wRight = new Vector2(sRight.W); + Vector4 xRight = new(sRight.X); + Vector4 yRight = new(sRight.Y); + Vector4 zRight = new(sRight.Z); + Vector2 wRight = new(sRight.W); Unsafe.As(ref dTopLeft) = xLeft; Unsafe.As(ref Unsafe.Add(ref dTopLeft, 1)) = yLeft; @@ -362,25 +362,25 @@ public class Block8x8F_CopyTo2x2 ref Vector4 dTopLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, (uint)offset)); ref Vector4 dBottomLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, (uint)(offset + destStride))); - var xyLeft = new Vector4(sLeft.X) + Vector4 xyLeft = new(sLeft.X) { Z = sLeft.Y, W = sLeft.Y }; - var zwLeft = new Vector4(sLeft.Z) + Vector4 zwLeft = new(sLeft.Z) { Z = sLeft.W, W = sLeft.W }; - var xyRight = new Vector4(sRight.X) + Vector4 xyRight = new(sRight.X) { Z = sRight.Y, W = sRight.Y }; - var zwRight = new Vector4(sRight.Z) + Vector4 zwRight = new(sRight.Z) { Z = sRight.W, W = sRight.W diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs index efc347586..45c6f63b9 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_DivideRound.cs @@ -19,8 +19,8 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations; public unsafe class Block8x8F_DivideRound { private const int ExecutionCount = 5; // Added this to reduce the effect of copying the blocks - private static readonly Vector4 MinusOne = new Vector4(-1); - private static readonly Vector4 Half = new Vector4(0.5f); + private static readonly Vector4 MinusOne = new(-1); + private static readonly Vector4 Half = new(0.5f); private Block8x8F inputDividend; private Block8x8F inputDivisor; @@ -140,7 +140,7 @@ public unsafe class Block8x8F_DivideRound [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Vector4 DivideRound(Vector4 dividend, Vector4 divisor) { - var sign = Vector4.Min(dividend, Vector4.One); + Vector4 sign = Vector4.Min(dividend, Vector4.One); sign = Vector4.Max(sign, MinusOne); return (dividend / divisor) + (sign * Half); diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_MultiplyInPlaceBlock.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_MultiplyInPlaceBlock.cs index 722b09587..3c03f3e05 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_MultiplyInPlaceBlock.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_MultiplyInPlaceBlock.cs @@ -20,7 +20,7 @@ public class Block8x8F_MultiplyInPlaceBlock private static Block8x8F Create8x8FloatData() { - var result = new float[64]; + float[] result = new float[64]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs index 8964667b7..436aa9bcd 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/ColorConversion/ColorConversionBenchmark.cs @@ -38,11 +38,11 @@ public abstract class ColorConversionBenchmark float minVal = 0f, float maxVal = 255f) { - var rnd = new Random(42); - var buffers = new Buffer2D[componentCount]; + Random rnd = new(42); + Buffer2D[] buffers = new Buffer2D[componentCount]; for (int i = 0; i < componentCount; i++) { - var values = new float[inputBufferLength]; + float[] values = new float[inputBufferLength]; for (int j = 0; j < inputBufferLength; j++) { diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs index 91ee82136..e7b66576d 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using BenchmarkDotNet.Attributes; +using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Jpeg; using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.IO; @@ -38,7 +39,7 @@ public class DecodeJpegParseStreamOnly { using MemoryStream memoryStream = new(this.jpegBytes); using BufferedReadStream bufferedStream = new(Configuration.Default, memoryStream); - JpegDecoderOptions options = new() { GeneralOptions = new() { SkipMetadata = true } }; + JpegDecoderOptions options = new() { GeneralOptions = new DecoderOptions { SkipMetadata = true } }; using JpegDecoderCore decoder = new(options); NoopSpectralConverter spectralConverter = new(); diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs index 257e44cc4..9a4ee3967 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpeg_ImageSpecific.cs @@ -49,7 +49,7 @@ public class DecodeJpeg_ImageSpecific public Size ImageSharp() { using MemoryStream memoryStream = new(this.jpegBytes); - using Image image = Image.Load(new DecoderOptions() { SkipMetadata = true }, memoryStream); + using Image image = Image.Load(new DecoderOptions { SkipMetadata = true }, memoryStream); return new Size(image.Width, image.Height); } diff --git a/tests/ImageSharp.Benchmarks/Config.cs b/tests/ImageSharp.Benchmarks/Config.cs index 190c245c9..9231fc8b4 100644 --- a/tests/ImageSharp.Benchmarks/Config.cs +++ b/tests/ImageSharp.Benchmarks/Config.cs @@ -10,6 +10,7 @@ using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Environments; using BenchmarkDotNet.Jobs; using BenchmarkDotNet.Reports; +using BenchmarkDotNet.Toolchains.InProcess.Emit; namespace SixLabors.ImageSharp.Benchmarks; @@ -45,6 +46,15 @@ public partial class Config : ManualConfig .WithArguments([new MsBuildArgument("/p:DebugType=portable")])); } + public class StandardInProcess : Config + { + public StandardInProcess() => this.AddJob( + Job.Default + .WithRuntime(CoreRuntime.Core80) + .WithToolchain(InProcessEmitToolchain.Instance) + .WithArguments([new MsBuildArgument("/p:DebugType=portable")])); + } + #if OS_WINDOWS private bool IsElevated => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); #endif diff --git a/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs b/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs index 30023feca..64a8092c6 100644 --- a/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs +++ b/tests/ImageSharp.Benchmarks/General/Adler32Benchmark.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Benchmarks.General; public class Adler32Benchmark { private byte[] data; - private readonly SharpAdler32 adler = new SharpAdler32(); + private readonly SharpAdler32 adler = new(); [Params(1024, 2048, 4096)] public int Count { get; set; } diff --git a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampFloat.cs b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampFloat.cs index dd0bc2878..317295144 100644 --- a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampFloat.cs +++ b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampFloat.cs @@ -10,7 +10,7 @@ public class ClampFloat { private readonly float min = -1.5f; private readonly float max = 2.5f; - private static readonly float[] Values = { -10, -5, -3, -1.5f, -0.5f, 0f, 1f, 1.5f, 2.5f, 3, 10 }; + private static readonly float[] Values = [-10, -5, -3, -1.5f, -0.5f, 0f, 1f, 1.5f, 2.5f, 3, 10]; [Benchmark(Baseline = true)] public float UsingMathF() diff --git a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs index d47fcb687..b61ba27ff 100644 --- a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs +++ b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampSpan.cs @@ -12,7 +12,7 @@ public class ClampSpan public void Setup() { - var r = new Random(); + Random r = new(); for (int i = 0; i < A.Length; i++) { diff --git a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs index 186f88bb7..4969c3ef7 100644 --- a/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs +++ b/tests/ImageSharp.Benchmarks/General/BasicMath/ClampVector4.cs @@ -11,7 +11,7 @@ public class ClampVector4 { private readonly float min = -1.5f; private readonly float max = 2.5f; - private static readonly float[] Values = { -10, -5, -3, -1.5f, -0.5f, 0f, 1f, 1.5f, 2.5f, 3, 10 }; + private static readonly float[] Values = [-10, -5, -3, -1.5f, -0.5f, 0f, 1f, 1.5f, 2.5f, 3, 10]; [Benchmark(Baseline = true)] public Vector4 UsingVectorClamp() diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs index a42c6c253..226dcc777 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs @@ -209,7 +209,7 @@ public unsafe class PixelConversion_PackFromRgbPlanes Vector256 vcontrol = SimdUtils.HwIntrinsics.PermuteMaskEvenOdd8x32().AsInt32(); - var va = Vector256.Create(1F); + Vector256 va = Vector256.Create(1F); for (nuint i = 0; i < count; i++) { diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs index f4fb9e420..232d8b3e2 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs @@ -252,8 +252,8 @@ public class PixelConversion_Rgba32_To_Bgra32 private static void BitopsSimdImpl(ref Octet s, ref Octet d) { Vector sVec = Unsafe.As, Vector>(ref s); - var aMask = new Vector(0xFF00FF00); - var bMask = new Vector(0x00FF00FF); + Vector aMask = new(0xFF00FF00); + Vector bMask = new(0x00FF00FF); Vector aa = sVec & aMask; Vector bb = sVec & bMask; diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs index 21bef5a15..8698f8223 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs @@ -103,6 +103,6 @@ public struct TestArgb : ITestPixel vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new TestArgb(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } } diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs index 1499fb7d3..751cd68b4 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/TestRgba.cs @@ -79,6 +79,6 @@ public struct TestRgba : ITestPixel vector = Numerics.Clamp(vector, Vector4.Zero, MaxBytes); Vector128 result = Vector128.ConvertToInt32(vector.AsVector128()).AsByte(); - return new(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); + return new TestRgba(result.GetElement(0), result.GetElement(4), result.GetElement(8), result.GetElement(12)); } } diff --git a/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs b/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs index 2cd6a5a52..5919137bf 100644 --- a/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs +++ b/tests/ImageSharp.Benchmarks/General/Vector4Constants.cs @@ -12,10 +12,10 @@ namespace SixLabors.ImageSharp.Benchmarks.General; /// public class Vector4Constants { - private static readonly Vector4 A = new Vector4(1.2f); - private static readonly Vector4 B = new Vector4(3.4f); - private static readonly Vector4 C = new Vector4(5.6f); - private static readonly Vector4 D = new Vector4(7.8f); + private static readonly Vector4 A = new(1.2f); + private static readonly Vector4 B = new(3.4f); + private static readonly Vector4 C = new(5.6f); + private static readonly Vector4 D = new(7.8f); private Random random; @@ -39,8 +39,8 @@ public class Vector4Constants Vector4 x = (p * A / B) + (p * C / D); Vector4 y = (p / A * B) + (p / C * D); - var z = Vector4.Min(p, A); - var w = Vector4.Max(p, B); + Vector4 z = Vector4.Min(p, A); + Vector4 w = Vector4.Max(p, B); return x + y + z + w; } @@ -51,8 +51,8 @@ public class Vector4Constants Vector4 x = (p * new Vector4(1.2f) / new Vector4(2.3f)) + (p * new Vector4(4.5f) / new Vector4(6.7f)); Vector4 y = (p / new Vector4(1.2f) * new Vector4(2.3f)) + (p / new Vector4(4.5f) * new Vector4(6.7f)); - var z = Vector4.Min(p, new Vector4(1.2f)); - var w = Vector4.Max(p, new Vector4(2.3f)); + Vector4 z = Vector4.Min(p, new Vector4(1.2f)); + Vector4 w = Vector4.Max(p, new Vector4(2.3f)); return x + y + z + w; } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs index 4d8d9b1ed..2f9b02b59 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/BitwiseOrUint32.cs @@ -43,11 +43,11 @@ public class BitwiseOrUInt32 [Benchmark] public void Simd() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - var a = new Vector(this.input, i); + Vector a = new(this.input, i); a = Vector.BitwiseOr(a, v); a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs index 1b2c56ab9..fd243638b 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/DivFloat.cs @@ -43,11 +43,11 @@ public class DivFloat [Benchmark] public void Simd() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - var a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a / v; a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs index d102164e2..0d2923b61 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/DivUInt32.cs @@ -44,11 +44,11 @@ public class DivUInt32 [Benchmark] public void Simd() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - var a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a / v; a.CopyTo(this.result, i); diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs index 5277897bb..61ff9466e 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/Divide.cs @@ -57,7 +57,7 @@ public class DivInt16 : SIMDBenchmarkBase.Divide { protected override short GetTestValue() => 42; - protected override Vector GetTestVector() => new Vector(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); + protected override Vector GetTestVector() => new(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); [Benchmark(Baseline = true)] public void Standard() diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs index a2eb8d417..801b0e161 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/MulFloat.cs @@ -43,11 +43,11 @@ public class MulFloat [Benchmark] public void SimdMultiplyByVector() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - var a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a * v; a.CopyTo(this.result, i); } @@ -60,7 +60,7 @@ public class MulFloat for (int i = 0; i < this.input.Length; i += Vector.Count) { - var a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a * v; a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs index a234970a5..db64486ad 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/MulUInt32.cs @@ -43,11 +43,11 @@ public class MulUInt32 [Benchmark] public void Simd() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.input.Length; i += Vector.Count) { - var a = new Vector(this.input, i); + Vector a = new(this.input, i); a = a * v; a.CopyTo(this.result, i); } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs index 7e890cb92..d9542bc3f 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/Multiply.cs @@ -40,7 +40,7 @@ public class MulInt16 : SIMDBenchmarkBase.Multiply { protected override short GetTestValue() => 42; - protected override Vector GetTestVector() => new Vector(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); + protected override Vector GetTestVector() => new(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }); [Benchmark(Baseline = true)] public void Standard() diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs index 29b90accc..f99b141b4 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/Premultiply.cs @@ -12,14 +12,14 @@ public class Premultiply [Benchmark(Baseline = true)] public Vector4 PremultiplyByVal() { - var input = new Vector4(.5F); + Vector4 input = new(.5F); return Vector4Utils.Premultiply(input); } [Benchmark] public Vector4 PremultiplyByRef() { - var input = new Vector4(.5F); + Vector4 input = new(.5F); Vector4Utils.PremultiplyRef(ref input); return input; } @@ -27,7 +27,7 @@ public class Premultiply [Benchmark] public Vector4 PremultiplyRefWithPropertyAssign() { - var input = new Vector4(.5F); + Vector4 input = new(.5F); Vector4Utils.PremultiplyRefWithPropertyAssign(ref input); return input; } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs index 7d626d785..557d8ff38 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/ReinterpretUInt32AsFloat.cs @@ -53,8 +53,8 @@ public class ReinterpretUInt32AsFloat { for (int i = 0; i < this.input.Length; i += Vector.Count) { - var a = new Vector(this.input, i); - var b = Vector.AsVectorSingle(a); + Vector a = new(this.input, i); + Vector b = Vector.AsVectorSingle(a); b.CopyTo(this.result, i); } } diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs index 5f1f5666d..4048bc210 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/UInt32ToSingle.cs @@ -27,20 +27,20 @@ public class UInt32ToSingle nuint n = Count / (uint)Vector.Count; - var bVec = new Vector(256.0f / 255.0f); - var magicFloat = new Vector(32768.0f); - var magicInt = new Vector(1191182336); // reinterpreted value of 32768.0f - var mask = new Vector(255); + Vector bVec = new(256.0f / 255.0f); + Vector magicFloat = new(32768.0f); + Vector magicInt = new(1191182336); // reinterpreted value of 32768.0f + Vector mask = new(255); for (nuint i = 0; i < n; i++) { ref Vector df = ref Unsafe.Add(ref b, i); - var vi = Vector.AsVectorUInt32(df); + Vector vi = Vector.AsVectorUInt32(df); vi &= mask; vi |= magicInt; - var vf = Vector.AsVectorSingle(vi); + Vector vf = Vector.AsVectorSingle(vi); vf = (vf - magicFloat) * bVec; df = vf; @@ -55,7 +55,7 @@ public class UInt32ToSingle 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); + Vector scale = new(1f / 255f); for (nuint i = 0; i < n; i++) { @@ -74,7 +74,7 @@ public class UInt32ToSingle 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); + Vector scale = new(1f / 255f); for (nuint i = 0; i < n; i++) { @@ -91,7 +91,7 @@ public class UInt32ToSingle nuint n = Count / (uint)Vector.Count; ref Vector bf = ref Unsafe.As>(ref this.data[0]); - var scale = new Vector(1f / 255f); + Vector scale = new(1f / 255f); for (nuint i = 0; i < n; i++) { diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs index 5d20f29d1..9c7fd5b6c 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/VectorFetching.cs @@ -47,11 +47,11 @@ public class VectorFetching [Benchmark] public void FetchWithVectorConstructor() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); for (int i = 0; i < this.data.Length; i += Vector.Count) { - var a = new Vector(this.data, i); + Vector a = new(this.data, i); a = a * v; a.CopyTo(this.data, i); } @@ -60,7 +60,7 @@ public class VectorFetching [Benchmark] public void FetchWithUnsafeCast() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); ref Vector start = ref Unsafe.As>(ref this.data[0]); nuint n = (uint)this.InputSize / (uint)Vector.Count; @@ -79,7 +79,7 @@ public class VectorFetching [Benchmark] public void FetchWithUnsafeCastNoTempVector() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); ref Vector start = ref Unsafe.As>(ref this.data[0]); nuint n = (uint)this.InputSize / (uint)Vector.Count; @@ -94,9 +94,9 @@ public class VectorFetching [Benchmark] public void FetchWithUnsafeCastFromReference() { - var v = new Vector(this.testValue); + Vector v = new(this.testValue); - var span = new Span(this.data); + Span span = new(this.data); ref Vector start = ref Unsafe.As>(ref MemoryMarshal.GetReference(span)); diff --git a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj index c92bb6a6b..fa5fdd816 100644 --- a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj +++ b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj @@ -19,7 +19,7 @@ BenchmarkDotNet requires a certain structure to the code, as such, some of these rules cannot be implemented. --> - + @@ -39,7 +39,7 @@ - net8.0;net9.0 + net8.0;net10.0 @@ -57,8 +57,9 @@ - - + + + diff --git a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs index 04621695c..0731c7c00 100644 --- a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs +++ b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressBenchmarks.cs @@ -18,7 +18,7 @@ public class LoadResizeSaveStressBenchmarks [GlobalSetup] public void Setup() { - this.runner = new LoadResizeSaveStressRunner() + this.runner = new LoadResizeSaveStressRunner { ImageCount = Environment.ProcessorCount, Filter = Filter @@ -34,12 +34,12 @@ public class LoadResizeSaveStressBenchmarks } public int[] ParallelismValues { get; } = - { + [ // Environment.ProcessorCount, // Environment.ProcessorCount / 2, // Environment.ProcessorCount / 4, 1 - }; + ]; [Benchmark] [ArgumentsSource(nameof(ParallelismValues))] diff --git a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs index 44c248dc9..f8bf19d57 100644 --- a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs +++ b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs @@ -53,7 +53,7 @@ public class LoadResizeSaveStressRunner public int ThumbnailSize { get; set; } = 150; private static readonly string[] ProgressiveFiles = - { + [ "ancyloscelis-apiformis-m-paraguay-face_2014-08-08-095255-zs-pmax_15046500892_o.jpg", "acanthopus-excellens-f-face-brasil_2014-08-06-132105-zs-pmax_14792513890_o.jpg", "bee-ceratina-monster-f-ukraine-face_2014-08-09-123342-zs-pmax_15068816101_o.jpg", @@ -84,8 +84,8 @@ public class LoadResizeSaveStressRunner "triepeolus-simplex-m-face-md-kent-county_2014-07-22-100937-zs-pmax_14805405233_o.jpg", "washed-megachile-f-face-chile_2014-08-06-103414-zs-pmax_14977843152_o.jpg", "xylocopa-balck-violetwing-f-kyrgystan-angle_2014-08-09-182433-zs-pmax_15123416061_o.jpg", - "xylocopa-india-yellow-m-india-face_2014-08-10-111701-zs-pmax_15166559172_o.jpg", - }; + "xylocopa-india-yellow-m-india-face_2014-08-10-111701-zs-pmax_15166559172_o.jpg" + ]; public void Init() { @@ -148,7 +148,7 @@ public class LoadResizeSaveStressRunner private void LogImageProcessed(int width, int height) { - this.LastProcessedImageSize = new Size(width, height); + this.LastProcessedImageSize = new ImageSharpSize(width, height); double pixels = width * (double)height; this.TotalProcessedMegapixels += pixels / 1_000_000.0; } diff --git a/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs b/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs index 135145a31..93ac9fc0e 100644 --- a/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs +++ b/tests/ImageSharp.Benchmarks/Processing/HistogramEqualization.cs @@ -33,7 +33,7 @@ public class HistogramEqualization [Benchmark(Description = "Global Histogram Equalization")] public void GlobalHistogramEqualization() => this.image.Mutate(img => img.HistogramEqualization( - new HistogramEqualizationOptions() + new HistogramEqualizationOptions { LuminanceLevels = 256, Method = HistogramEqualizationMethod.Global @@ -42,7 +42,7 @@ public class HistogramEqualization [Benchmark(Description = "AdaptiveHistogramEqualization (Tile interpolation)")] public void AdaptiveHistogramEqualization() => this.image.Mutate(img => img.HistogramEqualization( - new HistogramEqualizationOptions() + new HistogramEqualizationOptions { LuminanceLevels = 256, Method = HistogramEqualizationMethod.AdaptiveTileInterpolation diff --git a/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs b/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs index e3e413fe4..707748499 100644 --- a/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs +++ b/tests/ImageSharp.Benchmarks/Processing/OilPaint.cs @@ -13,7 +13,7 @@ public class OilPaint [Benchmark] public void DoOilPaint() { - using Image image = new Image(1920, 1200, new(127, 191, 255)); + using Image image = new(1920, 1200, new RgbaVector(127, 191, 255)); image.Mutate(ctx => ctx.OilPaint()); } } diff --git a/tests/ImageSharp.Benchmarks/Processing/Resize.cs b/tests/ImageSharp.Benchmarks/Processing/Resize.cs index 09673cb96..3cc10afb7 100644 --- a/tests/ImageSharp.Benchmarks/Processing/Resize.cs +++ b/tests/ImageSharp.Benchmarks/Processing/Resize.cs @@ -12,7 +12,7 @@ using SDImage = System.Drawing.Image; namespace SixLabors.ImageSharp.Benchmarks; -[Config(typeof(Config.Standard))] +[Config(typeof(Config.StandardInProcess))] public abstract class Resize where TPixel : unmanaged, IPixel { @@ -22,7 +22,7 @@ public abstract class Resize private SDImage sourceBitmap; - protected Configuration Configuration { get; } = new Configuration(new JpegConfigurationModule()); + protected Configuration Configuration { get; } = new(new JpegConfigurationModule()); protected int DestSize { get; private set; } diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj index 832f3d171..bc52610d2 100644 --- a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj +++ b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj @@ -19,7 +19,7 @@ - net8.0;net9.0 + net8.0;net10.0 diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs b/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs index 248912b14..6850756df 100644 --- a/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs +++ b/tests/ImageSharp.Tests.ProfilingSandbox/LoadResizeSaveParallelMemoryStress.cs @@ -17,7 +17,7 @@ internal class LoadResizeSaveParallelMemoryStress { private LoadResizeSaveParallelMemoryStress() { - this.Benchmarks = new LoadResizeSaveStressRunner() + this.Benchmarks = new LoadResizeSaveStressRunner { Filter = JpegKind.Baseline, }; @@ -38,7 +38,7 @@ internal class LoadResizeSaveParallelMemoryStress Console.WriteLine($"64 bit: {Environment.Is64BitProcess}"); CommandLineOptions options = args.Length > 0 ? CommandLineOptions.Parse(args) : null; - var lrs = new LoadResizeSaveParallelMemoryStress(); + LoadResizeSaveParallelMemoryStress lrs = new(); if (options != null) { lrs.Benchmarks.MaxDegreeOfParallelism = options.MaxDegreeOfParallelism; @@ -108,7 +108,7 @@ internal class LoadResizeSaveParallelMemoryStress } } - var stats = new Stats(timer, lrs.Benchmarks.TotalProcessedMegapixels); + Stats stats = new(timer, lrs.Benchmarks.TotalProcessedMegapixels); Console.WriteLine($"Total Megapixels: {stats.TotalMegapixels}, TotalOomRetries: {UnmanagedMemoryHandle.TotalOomRetries}, TotalOutstandingHandles: {UnmanagedMemoryHandle.TotalOutstandingHandles}, Total Gen2 GC count: {GC.CollectionCount(2)}"); Console.WriteLine(stats.GetMarkdown()); if (options?.FileOutput != null) @@ -203,7 +203,7 @@ internal class LoadResizeSaveParallelMemoryStress public string GetMarkdown() { - var bld = new StringBuilder(); + StringBuilder bld = new(); bld.AppendLine($"| {nameof(this.TotalSeconds)} | {nameof(this.MegapixelsPerSec)} | {nameof(this.MegapixelsPerSecPerCpu)} |"); bld.AppendLine( $"| {L(nameof(this.TotalSeconds))} | {L(nameof(this.MegapixelsPerSec))} | {L(nameof(this.MegapixelsPerSecPerCpu))} |"); diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs b/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs index b5c8b70cd..8ba862560 100644 --- a/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs +++ b/tests/ImageSharp.Tests.ProfilingSandbox/Program.cs @@ -52,7 +52,7 @@ public class Program { Assembly assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; Console.WriteLine(assembly.Location); - string[] assemblyPath = assembly.Location.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); + string[] assemblyPath = assembly.Location.Split(['/', '\\'], StringSplitOptions.RemoveEmptyEntries); int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2) { @@ -64,13 +64,13 @@ public class Program private static void RunResizeProfilingTest() { - var test = new ResizeProfilingBenchmarks(new ConsoleOutput()); + ResizeProfilingBenchmarks test = new(new ConsoleOutput()); test.ResizeBicubic(4000, 4000); } private static void RunToVector4ProfilingTest() { - var tests = new PixelOperationsTests.Rgba32_OperationsTests(new ConsoleOutput()); + PixelOperationsTests.Rgba32_OperationsTests tests = new(new ConsoleOutput()); tests.Benchmark_ToVector4(); } } diff --git a/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs b/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs index 4247345c7..2e2f0d07d 100644 --- a/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs +++ b/tests/ImageSharp.Tests/Color/ColorTests.CastTo.cs @@ -13,10 +13,10 @@ public partial class ColorTests [Fact] public void Rgba64() { - var source = new Rgba64(100, 2222, 3333, 4444); + Rgba64 source = new(100, 2222, 3333, 4444); // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: Rgba64 data = color.ToPixel(); @@ -26,10 +26,10 @@ public partial class ColorTests [Fact] public void Rgba32() { - var source = new Rgba32(1, 22, 33, 231); + Rgba32 source = new(1, 22, 33, 231); // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: Rgba32 data = color.ToPixel(); @@ -39,10 +39,10 @@ public partial class ColorTests [Fact] public void Argb32() { - var source = new Argb32(1, 22, 33, 231); + Argb32 source = new(1, 22, 33, 231); // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: Argb32 data = color.ToPixel(); @@ -52,10 +52,10 @@ public partial class ColorTests [Fact] public void Bgra32() { - var source = new Bgra32(1, 22, 33, 231); + Bgra32 source = new(1, 22, 33, 231); // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: Bgra32 data = color.ToPixel(); @@ -65,10 +65,10 @@ public partial class ColorTests [Fact] public void Abgr32() { - var source = new Abgr32(1, 22, 33, 231); + Abgr32 source = new(1, 22, 33, 231); // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: Abgr32 data = color.ToPixel(); @@ -78,10 +78,10 @@ public partial class ColorTests [Fact] public void Rgb24() { - var source = new Rgb24(1, 22, 231); + Rgb24 source = new(1, 22, 231); // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: Rgb24 data = color.ToPixel(); @@ -91,10 +91,10 @@ public partial class ColorTests [Fact] public void Bgr24() { - var source = new Bgr24(1, 22, 231); + Bgr24 source = new(1, 22, 231); // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: Bgr24 data = color.ToPixel(); @@ -129,7 +129,7 @@ public partial class ColorTests where TPixel : unmanaged, IPixel { // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: TPixel actual = color.ToPixel(); @@ -150,7 +150,7 @@ public partial class ColorTests where TPixel2 : unmanaged, IPixel { // Act: - var color = Color.FromPixel(source); + Color color = Color.FromPixel(source); // Assert: TPixel2 actual = color.ToPixel(); diff --git a/tests/ImageSharp.Tests/Color/ColorTests.cs b/tests/ImageSharp.Tests/Color/ColorTests.cs index d430df5b4..c482fc998 100644 --- a/tests/ImageSharp.Tests/Color/ColorTests.cs +++ b/tests/ImageSharp.Tests/Color/ColorTests.cs @@ -67,9 +67,9 @@ public partial class ColorTests [Theory] [InlineData(false)] [InlineData(true)] - public void ToHex(bool highPrecision) + public void ToHexRgba(bool highPrecision) { - string expected = "ABCD1234"; + const string expected = "AABBCCDD"; Color color = Color.ParseHex(expected); if (highPrecision) @@ -81,10 +81,27 @@ public partial class ColorTests Assert.Equal(expected, actual); } + [Theory] + [InlineData(false)] + [InlineData(true)] + public void ToHexArgb(bool highPrecision) + { + const string expected = "AABBCCDD"; + Color color = Color.ParseHex(expected, ColorHexFormat.Argb); + + if (highPrecision) + { + color = Color.FromPixel(color.ToPixel()); + } + + string actual = color.ToHex(ColorHexFormat.Argb); + Assert.Equal(expected, actual); + } + [Fact] public void WebSafePalette_IsCorrect() { - Rgba32[] actualPalette = Color.WebSafePalette.ToArray().Select(c => c.ToPixel()).ToArray(); + Rgba32[] actualPalette = [.. Color.WebSafePalette.ToArray().Select(c => c.ToPixel())]; for (int i = 0; i < ReferencePalette.WebSafeColors.Length; i++) { @@ -95,7 +112,7 @@ public partial class ColorTests [Fact] public void WernerPalette_IsCorrect() { - Rgba32[] actualPalette = Color.WernerPalette.ToArray().Select(c => c.ToPixel()).ToArray(); + Rgba32[] actualPalette = [.. Color.WernerPalette.ToArray().Select(c => c.ToPixel())]; for (int i = 0; i < ReferencePalette.WernerColors.Length; i++) { @@ -103,7 +120,7 @@ public partial class ColorTests } } - public class FromHex + public class FromHexRgba { [Fact] public void ShortHex() @@ -126,6 +143,23 @@ public partial class ColorTests Assert.Equal(new Rgba32(0, 0, 0, 255), actual.ToPixel()); } + [Fact] + public void LongHex() + { + Assert.Equal(new Rgba32(255, 255, 255, 0), Color.ParseHex("#FFFFFF00").ToPixel()); + Assert.Equal(new Rgba32(255, 255, 255, 128), Color.ParseHex("#FFFFFF80").ToPixel()); + } + + [Fact] + public void TryLongHex() + { + Assert.True(Color.TryParseHex("#FFFFFF00", out Color actual)); + Assert.Equal(new Rgba32(255, 255, 255, 0), actual.ToPixel()); + + Assert.True(Color.TryParseHex("#FFFFFF80", out actual)); + Assert.Equal(new Rgba32(255, 255, 255, 128), actual.ToPixel()); + } + [Fact] public void LeadingPoundIsOptional() { @@ -152,6 +186,72 @@ public partial class ColorTests public void FalseOnNull() => Assert.False(Color.TryParseHex(null, out Color _)); } + public class FromHexArgb + { + [Fact] + public void ShortHex() + { + Assert.Equal(new Rgb24(255, 255, 255), Color.ParseHex("#fff", ColorHexFormat.Argb).ToPixel()); + Assert.Equal(new Rgb24(255, 255, 255), Color.ParseHex("fff", ColorHexFormat.Argb).ToPixel()); + Assert.Equal(new Argb32(0, 0, 255, 0), Color.ParseHex("000f", ColorHexFormat.Argb).ToPixel()); + } + + [Fact] + public void TryShortHex() + { + Assert.True(Color.TryParseHex("#fff", out Color actual, ColorHexFormat.Argb)); + Assert.Equal(new Rgb24(255, 255, 255), actual.ToPixel()); + + Assert.True(Color.TryParseHex("fff", out actual, ColorHexFormat.Argb)); + Assert.Equal(new Rgb24(255, 255, 255), actual.ToPixel()); + + Assert.True(Color.TryParseHex("000f", out actual, ColorHexFormat.Argb)); + Assert.Equal(new Argb32(0, 0, 255, 0), actual.ToPixel()); + } + + [Fact] + public void LongHex() + { + Assert.Equal(new Argb32(255, 255, 255, 0), Color.ParseHex("#00FFFFFF", ColorHexFormat.Argb).ToPixel()); + Assert.Equal(new Argb32(255, 255, 255, 128), Color.ParseHex("#80FFFFFF", ColorHexFormat.Argb).ToPixel()); + } + + [Fact] + public void TryLongHex() + { + Assert.True(Color.TryParseHex("#00FFFFFF", out Color actual, ColorHexFormat.Argb)); + Assert.Equal(new Argb32(255, 255, 255, 0), actual.ToPixel()); + + Assert.True(Color.TryParseHex("#80FFFFFF", out actual, ColorHexFormat.Argb)); + Assert.Equal(new Argb32(255, 255, 255, 128), actual.ToPixel()); + } + + [Fact] + public void LeadingPoundIsOptional() + { + Assert.Equal(new Rgb24(0, 128, 128), Color.ParseHex("#008080", ColorHexFormat.Argb).ToPixel()); + Assert.Equal(new Rgb24(0, 128, 128), Color.ParseHex("008080", ColorHexFormat.Argb).ToPixel()); + } + + [Fact] + public void ThrowsOnEmpty() => Assert.Throws(() => Color.ParseHex(string.Empty, ColorHexFormat.Argb)); + + [Fact] + public void ThrowsOnInvalid() => Assert.Throws(() => Color.ParseHex("!", ColorHexFormat.Argb)); + + [Fact] + public void ThrowsOnNull() => Assert.Throws(() => Color.ParseHex(null, ColorHexFormat.Argb)); + + [Fact] + public void FalseOnEmpty() => Assert.False(Color.TryParseHex(string.Empty, out Color _, ColorHexFormat.Argb)); + + [Fact] + public void FalseOnInvalid() => Assert.False(Color.TryParseHex("!", out Color _, ColorHexFormat.Argb)); + + [Fact] + public void FalseOnNull() => Assert.False(Color.TryParseHex(null, out Color _, ColorHexFormat.Argb)); + } + public class FromString { [Fact] diff --git a/tests/ImageSharp.Tests/Color/ReferencePalette.cs b/tests/ImageSharp.Tests/Color/ReferencePalette.cs index 8e2696109..88787afd4 100644 --- a/tests/ImageSharp.Tests/Color/ReferencePalette.cs +++ b/tests/ImageSharp.Tests/Color/ReferencePalette.cs @@ -9,7 +9,7 @@ internal static class ReferencePalette /// Gets a collection of named, web safe, colors as defined in the CSS Color Module Level 4. /// public static readonly Color[] WebSafeColors = - { + [ Color.AliceBlue, Color.AntiqueWhite, Color.Aqua, @@ -152,14 +152,14 @@ internal static class ReferencePalette Color.WhiteSmoke, Color.Yellow, Color.YellowGreen - }; + ]; /// /// Gets a collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821. /// The hex codes were collected and defined by Nicholas Rougeux /// public static readonly Color[] WernerColors = - { + [ Color.ParseHex("#f1e9cd"), Color.ParseHex("#f2e7cf"), Color.ParseHex("#ece6d0"), @@ -270,10 +270,10 @@ internal static class ReferencePalette Color.ParseHex("#9b856b"), Color.ParseHex("#766051"), Color.ParseHex("#453b32") - }; + ]; public static readonly Dictionary ColorNames = - new Dictionary(StringComparer.OrdinalIgnoreCase) + new(StringComparer.OrdinalIgnoreCase) { { nameof(Color.AliceBlue), Color.AliceBlue }, { nameof(Color.AntiqueWhite), Color.AntiqueWhite }, diff --git a/tests/ImageSharp.Tests/Color/RgbaDouble.cs b/tests/ImageSharp.Tests/Color/RgbaDouble.cs index 9a751e879..76fdf365c 100644 --- a/tests/ImageSharp.Tests/Color/RgbaDouble.cs +++ b/tests/ImageSharp.Tests/Color/RgbaDouble.cs @@ -115,7 +115,7 @@ public struct RgbaDouble : IPixel public static RgbaDouble FromVector4(Vector4 source) { source = Numerics.Clamp(source, Vector4.Zero, Vector4.One); - return new(source.X, source.Y, source.Z, source.W); + return new RgbaDouble(source.X, source.Y, source.Z, source.W); } /// diff --git a/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs b/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs index 6c56dc682..cb349af96 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/Icc/ColorProfileConverterTests.Icc.cs @@ -42,7 +42,7 @@ public class ColorProfileConverterTests(ITestOutputHelper testOutputHelper) [InlineData(TestIccProfiles.RommRgb, TestIccProfiles.StandardRgbV4)] // CMYK -> LAB -> CMYK (different bit depth v2 LUTs, 16-bit vs 8-bit) [InlineData(TestIccProfiles.Fogra39, TestIccProfiles.StandardRgbV2, 0.0005)] // CMYK -> LAB -> XYZ -> RGB (different LUT tags, A2B vs TRC) --- tolerance slightly higher due to difference in inverse curve implementation [InlineData(TestIccProfiles.StandardRgbV2, TestIccProfiles.Fogra39)] // RGB -> XYZ -> LAB -> CMYK (different LUT tags, TRC vs A2B) - public void CanConvertIccProfiles(string sourceProfile, string targetProfile, double tolerance = 0.00005) + public void CanConvertIccProfiles(string sourceProfile, string targetProfile, double tolerance = 0.000005) { List actual = Inputs.ConvertAll(input => GetActualTargetValues(input, sourceProfile, targetProfile)); AssertConversion(sourceProfile, targetProfile, actual, tolerance, testOutputHelper); @@ -63,7 +63,7 @@ public class ColorProfileConverterTests(ITestOutputHelper testOutputHelper) [InlineData(TestIccProfiles.Fogra39, TestIccProfiles.StandardRgbV2, 0.0005)] // CMYK -> LAB -> XYZ -> RGB (different LUT tags, A2B vs TRC) --- tolerance slightly higher due to difference in inverse curve implementation [InlineData(TestIccProfiles.StandardRgbV2, TestIccProfiles.Fogra39)] // RGB -> XYZ -> LAB -> CMYK (different LUT tags, TRC vs A2B) [InlineData(TestIccProfiles.Issue129, TestIccProfiles.StandardRgbV4)] // CMYK -> LAB -> -> XYZ -> RGB - public void CanBulkConvertIccProfiles(string sourceProfile, string targetProfile, double tolerance = 0.00005) + public void CanBulkConvertIccProfiles(string sourceProfile, string targetProfile, double tolerance = 0.000005) { List actual = GetBulkActualTargetValues(Inputs, sourceProfile, targetProfile); AssertConversion(sourceProfile, targetProfile, actual, tolerance, testOutputHelper); diff --git a/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs b/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs index 3e3bb4d49..eec27fcd7 100644 --- a/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs +++ b/tests/ImageSharp.Tests/ColorProfiles/Icc/TestIccProfiles.cs @@ -3,6 +3,7 @@ using System.Collections.Concurrent; using SixLabors.ImageSharp.Metadata.Profiles.Icc; +using Wacton.Unicolour; using Wacton.Unicolour.Icc; namespace SixLabors.ImageSharp.Tests.ColorProfiles.Icc; @@ -63,7 +64,7 @@ internal static class TestIccProfiles public static Wacton.Unicolour.Configuration GetUnicolourConfiguration(string file) => UnicolourConfigurationCache.GetOrAdd( file, - f => new Wacton.Unicolour.Configuration(iccConfig: new(GetFullPath(f), Intent.Unspecified, f))); + f => new Wacton.Unicolour.Configuration(iccConfig: new IccConfiguration(GetFullPath(f), Intent.Unspecified, f))); public static bool HasUnicolourConfiguration(string file) => UnicolourConfigurationCache.ContainsKey(file); diff --git a/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs b/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs index 190bfe1dc..8421c1fd7 100644 --- a/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs +++ b/tests/ImageSharp.Tests/Common/EncoderExtensionsTests.cs @@ -10,7 +10,7 @@ public class EncoderExtensionsTests [Fact] public void GetString_EmptyBuffer_ReturnsEmptyString() { - var buffer = default(ReadOnlySpan); + ReadOnlySpan buffer = default(ReadOnlySpan); string result = Encoding.UTF8.GetString(buffer); @@ -20,7 +20,7 @@ public class EncoderExtensionsTests [Fact] public void GetString_Buffer_ReturnsString() { - var buffer = new ReadOnlySpan(new byte[] { 73, 109, 97, 103, 101, 83, 104, 97, 114, 112 }); + ReadOnlySpan buffer = new(new byte[] { 73, 109, 97, 103, 101, 83, 104, 97, 114, 112 }); string result = Encoding.UTF8.GetString(buffer); diff --git a/tests/ImageSharp.Tests/Common/NumericsTests.cs b/tests/ImageSharp.Tests/Common/NumericsTests.cs index 2b9276943..ebee57060 100644 --- a/tests/ImageSharp.Tests/Common/NumericsTests.cs +++ b/tests/ImageSharp.Tests/Common/NumericsTests.cs @@ -28,7 +28,7 @@ public class NumericsTests [InlineData(1, 100)] public void DivideCeil_RandomValues(int seed, int count) { - var rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < count; i++) { uint value = (uint)rng.Next(); diff --git a/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs b/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs index ba37ee166..81daac3e0 100644 --- a/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs +++ b/tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs @@ -292,7 +292,7 @@ public partial class SimdUtilsTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } [Theory] @@ -352,7 +352,7 @@ public partial class SimdUtilsTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); } [Theory] @@ -394,7 +394,7 @@ public partial class SimdUtilsTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); } [Theory] @@ -436,7 +436,7 @@ public partial class SimdUtilsTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); } [Theory] @@ -478,7 +478,7 @@ public partial class SimdUtilsTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } private static void TestShuffleFloat4Channel( diff --git a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs index 36b301264..e39f9456f 100644 --- a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs +++ b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs @@ -133,7 +133,7 @@ public partial class SimdUtilsTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE41); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2); } [Theory] @@ -171,7 +171,7 @@ public partial class SimdUtilsTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, count, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512BW | HwIntrinsics.DisableAVX2); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2); } [Theory] diff --git a/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs b/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs index 193110944..5ea7afaf8 100644 --- a/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs +++ b/tests/ImageSharp.Tests/Common/StreamExtensionsTests.cs @@ -10,7 +10,7 @@ public class StreamExtensionsTests [InlineData(-1)] public void Skip_CountZeroOrLower_PositionNotChanged(int count) { - using (var memStream = new MemoryStream(5)) + using (MemoryStream memStream = new(5)) { memStream.Position = 4; memStream.Skip(count); @@ -22,7 +22,7 @@ public class StreamExtensionsTests [Fact] public void Skip_SeekableStream_SeekIsCalled() { - using (var seekableStream = new SeekableStream(4)) + using (SeekableStream seekableStream = new(4)) { seekableStream.Skip(4); @@ -34,7 +34,7 @@ public class StreamExtensionsTests [Fact] public void Skip_NonSeekableStream_BytesAreRead() { - using (var nonSeekableStream = new NonSeekableStream()) + using (NonSeekableStream nonSeekableStream = new()) { nonSeekableStream.Skip(5); @@ -49,7 +49,7 @@ public class StreamExtensionsTests [Fact] public void Skip_EofStream_NoExceptionIsThrown() { - using (var eofStream = new EofStream(7)) + using (EofStream eofStream = new(7)) { eofStream.Skip(7); @@ -79,7 +79,7 @@ public class StreamExtensionsTests { public override bool CanSeek => false; - public List Counts = new List(); + public List Counts = new(); public NonSeekableStream() : base(4) diff --git a/tests/ImageSharp.Tests/ConfigurationTests.cs b/tests/ImageSharp.Tests/ConfigurationTests.cs index c8e6cd265..3c6c759f8 100644 --- a/tests/ImageSharp.Tests/ConfigurationTests.cs +++ b/tests/ImageSharp.Tests/ConfigurationTests.cs @@ -58,7 +58,7 @@ public class ConfigurationTests { Assert.True(this.DefaultConfiguration.MaxDegreeOfParallelism == Environment.ProcessorCount); - var cfg = new Configuration(); + Configuration cfg = new(); Assert.True(cfg.MaxDegreeOfParallelism == Environment.ProcessorCount); } @@ -71,7 +71,7 @@ public class ConfigurationTests [InlineData(5, false)] public void MaxDegreeOfParallelism_CompatibleWith_ParallelOptions(int maxDegreeOfParallelism, bool throws) { - var cfg = new Configuration(); + Configuration cfg = new(); if (throws) { Assert.Throws( @@ -87,8 +87,8 @@ public class ConfigurationTests [Fact] public void ConstructorCallConfigureOnFormatProvider() { - var provider = new Mock(); - var config = new Configuration(provider.Object); + Mock provider = new(); + Configuration config = new(provider.Object); provider.Verify(x => x.Configure(config)); } @@ -96,8 +96,8 @@ public class ConfigurationTests [Fact] public void AddFormatCallsConfig() { - var provider = new Mock(); - var config = new Configuration(); + Mock provider = new(); + Configuration config = new(); config.Configure(provider.Object); provider.Verify(x => x.Configure(config)); @@ -118,7 +118,7 @@ public class ConfigurationTests [Fact] public void DefaultConfigurationHasCorrectFormatCount() { - var config = Configuration.CreateDefaultInstance(); + Configuration config = Configuration.CreateDefaultInstance(); Assert.Equal(this.expectedDefaultConfigurationCount, config.ImageFormats.Count()); } @@ -140,7 +140,7 @@ public class ConfigurationTests [Fact] public void StreamBufferSize_CannotGoBelowMinimum() { - var config = new Configuration(); + Configuration config = new(); Assert.Throws( () => config.StreamProcessingBufferSize = 0); @@ -150,14 +150,14 @@ public class ConfigurationTests public void MemoryAllocator_Setter_Roundtrips() { MemoryAllocator customAllocator = new SimpleGcMemoryAllocator(); - var config = new Configuration() { MemoryAllocator = customAllocator }; + Configuration config = new() { MemoryAllocator = customAllocator }; Assert.Same(customAllocator, config.MemoryAllocator); } [Fact] public void MemoryAllocator_SetNull_ThrowsArgumentNullException() { - var config = new Configuration(); + Configuration config = new(); Assert.Throws(() => config.MemoryAllocator = null); } @@ -168,9 +168,9 @@ public class ConfigurationTests static void RunTest() { - var c1 = new Configuration(); - var c2 = new Configuration(new MockConfigurationModule()); - var c3 = Configuration.CreateDefaultInstance(); + Configuration c1 = new(); + Configuration c2 = new(new MockConfigurationModule()); + Configuration c3 = Configuration.CreateDefaultInstance(); Assert.Same(MemoryAllocator.Default, Configuration.Default.MemoryAllocator); Assert.Same(MemoryAllocator.Default, c1.MemoryAllocator); diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs index 88f4cde7a..7f87111e8 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawImageTests.cs @@ -77,11 +77,11 @@ public class DrawImageTests PngEncoder encoder; if (provider.PixelType == PixelTypes.Rgba64) { - encoder = new() { BitDepth = PngBitDepth.Bit16 }; + encoder = new PngEncoder { BitDepth = PngBitDepth.Bit16 }; } else { - encoder = new(); + encoder = new PngEncoder(); } image.DebugSave(provider, testInfo, encoder: encoder); @@ -293,4 +293,21 @@ public class DrawImageTests appendPixelTypeToFileName: false, appendSourceFileOrDescription: false); } + + [Theory] + [WithFile(TestImages.Gif.Giphy, PixelTypes.Rgba32)] + public void DrawImageAnimatedForegroundRepeatCount(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image background = provider.GetImage(); + using Image foreground = Image.Load(TestFile.Create(TestImages.Gif.Giphy).Bytes); + + Size size = new(foreground.Width / 4, foreground.Height / 4); + foreground.Mutate(x => x.Resize(size.Width, size.Height, KnownResamplers.Bicubic)); + + background.Mutate(x => x.DrawImage(foreground, Point.Empty, 1F, 0)); + + background.DebugSaveMultiFrame(provider); + background.CompareToReferenceOutputMultiFrame(provider, ImageComparer.TolerantPercentage(0.01f)); + } } diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs index 09ef49a61..5ebcc8bb9 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs @@ -332,7 +332,7 @@ public class BmpEncoderTests public void Encode_PreservesColorProfile(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image input = provider.GetImage(BmpDecoder.Instance, new()); + using Image input = provider.GetImage(BmpDecoder.Instance, new BmpDecoderOptions()); ImageSharp.Metadata.Profiles.Icc.IccProfile expectedProfile = input.Metadata.IccProfile; byte[] expectedProfileBytes = expectedProfile.ToByteArray(); diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs index d8ec7c900..00a19466a 100644 --- a/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpFileHeaderTests.cs @@ -11,9 +11,9 @@ public class BmpFileHeaderTests [Fact] public void TestWrite() { - var header = new BmpFileHeader(1, 2, 3, 4); + BmpFileHeader header = new(1, 2, 3, 4); - var buffer = new byte[14]; + byte[] buffer = new byte[14]; header.WriteTo(buffer); diff --git a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs index 27511f7be..072b04fa0 100644 --- a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs +++ b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs @@ -16,24 +16,23 @@ public class GeneralFormatTests /// A collection made up of one file for each image format. /// public static readonly IEnumerable DefaultFiles = - new[] - { - TestImages.Bmp.Car, + [ + TestImages.Bmp.Car, TestImages.Jpeg.Baseline.Calliphora, TestImages.Png.Splash, TestImages.Gif.Trans - }; + ]; /// /// The collection of image files to test against. /// - protected static readonly List Files = new() - { + protected static readonly List Files = + [ TestFile.Create(TestImages.Jpeg.Baseline.Calliphora), TestFile.Create(TestImages.Bmp.Car), TestFile.Create(TestImages.Png.Splash), - TestFile.Create(TestImages.Gif.Rings), - }; + TestFile.Create(TestImages.Gif.Rings) + ]; [Theory] [WithFileCollection(nameof(DefaultFiles), PixelTypes.Rgba32)] @@ -151,7 +150,7 @@ public class GeneralFormatTests private static IQuantizer GetQuantizer(string name) { PropertyInfo property = typeof(KnownQuantizers).GetTypeInfo().GetProperty(name); - return (IQuantizer)property.GetMethod.Invoke(null, Array.Empty()); + return (IQuantizer)property.GetMethod.Invoke(null, []); } [Fact] diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs index 6593b8df7..febc65da3 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs @@ -20,9 +20,9 @@ public class GifDecoderTests private const PixelTypes TestPixelTypes = PixelTypes.Rgba32 | PixelTypes.RgbaVector | PixelTypes.Argb32; public static readonly string[] MultiFrameTestFiles = - { + [ TestImages.Gif.Giphy, TestImages.Gif.Kumin - }; + ]; [Theory] [WithFileCollection(nameof(MultiFrameTestFiles), PixelTypes.Rgba32)] @@ -90,7 +90,7 @@ public class GifDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 }, + TargetSize = new Size { Width = 150, Height = 150 }, MaxFrames = 1 }; @@ -257,7 +257,7 @@ public class GifDecoderTests public void Issue405_BadApplicationExtensionBlockLength(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); @@ -269,7 +269,7 @@ public class GifDecoderTests public void Issue1668_InvalidColorIndex(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); @@ -318,7 +318,7 @@ public class GifDecoderTests public void Issue1962(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); @@ -330,7 +330,7 @@ public class GifDecoderTests public void Issue2012EmptyXmp(TestImageProvider provider) where TPixel : unmanaged, IPixel { - using Image image = provider.GetImage(GifDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(GifDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); image.DebugSave(provider); image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); @@ -381,4 +381,31 @@ public class GifDecoderTests image.DebugSaveMultiFrame(provider); image.CompareToReferenceOutputMultiFrame(provider, ImageComparer.Exact); } + + // https://github.com/SixLabors/ImageSharp/issues/2953 + [Theory] + [WithFile(TestImages.Gif.Issues.Issue2953, PixelTypes.Rgba32)] + public void Issue2953(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + // We should throw a InvalidImageContentException when trying to identify or load an invalid GIF file. + TestFile testFile = TestFile.Create(provider.SourceFileOrDescription); + + Assert.Throws(() => Image.Identify(testFile.FullPath)); + Assert.Throws(() => Image.Load(testFile.FullPath)); + + DecoderOptions options = new() { SkipMetadata = true }; + Assert.Throws(() => Image.Identify(options, testFile.FullPath)); + Assert.Throws(() => Image.Load(options, testFile.FullPath)); + } + + [Theory] + [WithFile(TestImages.Gif.Issues.Issue2980, PixelTypes.Rgba32)] + public void Issue2980(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + image.DebugSaveMultiFrame(provider); + image.CompareToReferenceOutputMultiFrame(provider, ImageComparer.Exact); + } } diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs index 44ed5e38d..370106ca3 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs @@ -121,7 +121,7 @@ public class GifEncoderTests // Always save as we need to compare the encoded output. provider.Utility.SaveTestOutputFile(image, "gif", encoder, "global"); - encoder = new() + encoder = new GifEncoder { ColorTableMode = FrameColorTableMode.Local, Quantizer = new OctreeQuantizer(new QuantizerOptions { Dither = null }), diff --git a/tests/ImageSharp.Tests/Formats/Icon/Cur/CurEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Icon/Cur/CurEncoderTests.cs index 69c6317a7..f895afbd5 100644 --- a/tests/ImageSharp.Tests/Formats/Icon/Cur/CurEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Icon/Cur/CurEncoderTests.cs @@ -122,7 +122,7 @@ public class CurEncoderTests { if (expectedColor != rowSpan[x]) { - var xx = 0; + int xx = 0; } diff --git a/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs index e076ccab6..85ff51b18 100644 --- a/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Icon/Ico/IcoDecoderTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Bmp; using SixLabors.ImageSharp.Formats.Ico; using SixLabors.ImageSharp.Formats.Icon; @@ -277,7 +278,7 @@ public class IcoDecoderTests [WithFile(MultiSizeF, PixelTypes.Rgba32)] public void MultiSize_CanDecodeSingleFrame(TestImageProvider provider) { - using Image image = provider.GetImage(IcoDecoder.Instance, new() { MaxFrames = 1 }); + using Image image = provider.GetImage(IcoDecoder.Instance, new DecoderOptions { MaxFrames = 1 }); Assert.Single(image.Frames); } @@ -293,7 +294,7 @@ public class IcoDecoderTests TestFile testFile = TestFile.Create(imagePath); using MemoryStream stream = new(testFile.Bytes, false); - ImageInfo imageInfo = Image.Identify(new() { MaxFrames = 1 }, stream); + ImageInfo imageInfo = Image.Identify(new DecoderOptions { MaxFrames = 1 }, stream); Assert.Single(imageInfo.FrameMetadataCollection); } diff --git a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs index 324bd4783..9c8f45f78 100644 --- a/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs +++ b/tests/ImageSharp.Tests/Formats/ImageFormatManagerTests.cs @@ -123,7 +123,7 @@ public class ImageFormatManagerTests IImageFormat format = Image.DetectFormat(jpegImage); Assert.IsType(format); - byte[] invalidImage = { 1, 2, 3 }; + byte[] invalidImage = [1, 2, 3]; Assert.Throws(() => Image.DetectFormat(invalidImage)); } } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs index 740b410fe..aee064ccc 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs @@ -10,10 +10,10 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg; public class AdobeMarkerTests { // Taken from actual test image - private readonly byte[] bytes = { 0x41, 0x64, 0x6F, 0x62, 0x65, 0x0, 0x64, 0x0, 0x0, 0x0, 0x0, 0x2 }; + private readonly byte[] bytes = [0x41, 0x64, 0x6F, 0x62, 0x65, 0x0, 0x64, 0x0, 0x0, 0x0, 0x0, 0x2]; // Altered components - private readonly byte[] bytes2 = { 0x41, 0x64, 0x6F, 0x62, 0x65, 0x0, 0x64, 0x0, 0x0, 0x1, 0x1, 0x1 }; + private readonly byte[] bytes2 = [0x41, 0x64, 0x6F, 0x62, 0x65, 0x0, 0x64, 0x0, 0x0, 0x1, 0x1, 0x1]; [Fact] public void MarkerLengthIsCorrect() @@ -36,7 +36,7 @@ public class AdobeMarkerTests [Fact] public void MarkerIgnoresIncorrectValue() { - bool isAdobe = AdobeMarker.TryParse(new byte[] { 0, 0, 0, 0 }, out AdobeMarker marker); + bool isAdobe = AdobeMarker.TryParse([0, 0, 0, 0], out AdobeMarker marker); Assert.False(isAdobe); Assert.Equal(default, marker); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs index ab205c8a3..368a7b369 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs @@ -267,7 +267,7 @@ public partial class Block8x8FTests : JpegFixture RunTest, srcSeed, qtSeed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } [Fact] @@ -462,7 +462,7 @@ public partial class Block8x8FTests : JpegFixture // 3. DisableAvx2 - call fallback code of float implementation FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } [Theory] diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs index cb8f52a96..fb1e062f2 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs @@ -21,7 +21,7 @@ public class Block8x8Tests : JpegFixture { short[] data = Create8x8ShortData(); - var block = Block8x8.Load(data); + Block8x8 block = Block8x8.Load(data); for (int i = 0; i < Block8x8.Size; i++) { @@ -47,7 +47,7 @@ public class Block8x8Tests : JpegFixture { short[] data = Create8x8ShortData(); - var source = Block8x8.Load(data); + Block8x8 source = Block8x8.Load(data); Block8x8F dest = source.AsFloatBlock(); @@ -61,7 +61,7 @@ public class Block8x8Tests : JpegFixture public void ToArray() { short[] data = Create8x8ShortData(); - var block = Block8x8.Load(data); + Block8x8 block = Block8x8.Load(data); short[] result = block.ToArray(); @@ -72,8 +72,8 @@ public class Block8x8Tests : JpegFixture public void Equality_WhenFalse() { short[] data = Create8x8ShortData(); - var block1 = Block8x8.Load(data); - var block2 = Block8x8.Load(data); + Block8x8 block1 = Block8x8.Load(data); + Block8x8 block2 = Block8x8.Load(data); block1[0] = 42; block2[0] = 666; @@ -96,8 +96,8 @@ public class Block8x8Tests : JpegFixture public void TotalDifference() { short[] data = Create8x8ShortData(); - var block1 = Block8x8.Load(data); - var block2 = Block8x8.Load(data); + Block8x8 block1 = Block8x8.Load(data); + Block8x8 block2 = Block8x8.Load(data); block2[10] += 7; block2[63] += 8; @@ -157,7 +157,7 @@ public class Block8x8Tests : JpegFixture static void RunTest(string seedSerialized) { int seed = FeatureTestRunner.Deserialize(seedSerialized); - var rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { @@ -188,7 +188,7 @@ public class Block8x8Tests : JpegFixture static void RunTest(string seedSerialized) { int seed = FeatureTestRunner.Deserialize(seedSerialized); - var rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { @@ -223,7 +223,7 @@ public class Block8x8Tests : JpegFixture static void RunTest(string seedSerialized) { int seed = FeatureTestRunner.Deserialize(seedSerialized); - var rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs index 7b411a28f..50eada4c7 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs @@ -46,7 +46,7 @@ public static class DCTTests { float[] sourceArray = Create8x8RandomFloatData(MinInputValue, MaxInputValue, seed); - var srcBlock = Block8x8F.Load(sourceArray); + Block8x8F srcBlock = Block8x8F.Load(sourceArray); // reference Block8x8F expected = ReferenceImplementations.LLM_FloatingPoint_DCT.TransformIDCT(ref srcBlock); @@ -79,7 +79,7 @@ public static class DCTTests { float[] sourceArray = Create8x8RandomFloatData(MinInputValue, MaxInputValue, seed); - var srcBlock = Block8x8F.Load(sourceArray); + Block8x8F srcBlock = Block8x8F.Load(sourceArray); // reference Block8x8F expected = ReferenceImplementations.AccurateDCT.TransformIDCT(ref srcBlock); @@ -152,7 +152,7 @@ public static class DCTTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, seed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } [Theory] @@ -352,15 +352,14 @@ public static class DCTTests Assert.Equal(expectedDest, actualDest, new ApproximateFloatComparer(1f)); } - // 4 paths: - // 1. AllowAll - call avx/fma implementation - // 2. DisableFMA - call avx without fma implementation - // 3. DisableAvx - call Vector4 implementation - // 4. DisableHWIntrinsic - call scalar fallback implementation + // 3 paths: + // 1. AllowAll - call avx implementation + // 2. DisableAvx - call Vector4 implementation + // 3. DisableHWIntrinsic - call scalar fallback implementation FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, seed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); } } } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs index b89d9ad27..36b792fa1 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/HuffmanScanEncoderTests.cs @@ -69,7 +69,7 @@ public class HuffmanScanEncoderTests { int maxNumber = 1 << 16; - var rng = new Random(seed); + Random rng = new(seed); for (int i = 0; i < 1000; i++) { uint number = (uint)rng.Next(0, maxNumber); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.cs index 3b7e20eb4..22b25a2be 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.cs @@ -10,13 +10,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg; public class JFifMarkerTests { // Taken from actual test image - private readonly byte[] bytes = { 0x4A, 0x46, 0x49, 0x46, 0x0, 0x1, 0x1, 0x1, 0x0, 0x60, 0x0, 0x60, 0x0 }; + private readonly byte[] bytes = [0x4A, 0x46, 0x49, 0x46, 0x0, 0x1, 0x1, 0x1, 0x0, 0x60, 0x0, 0x60, 0x0]; // Altered components - private readonly byte[] bytes2 = { 0x4A, 0x46, 0x49, 0x46, 0x0, 0x1, 0x1, 0x1, 0x0, 0x48, 0x0, 0x48, 0x0 }; + private readonly byte[] bytes2 = [0x4A, 0x46, 0x49, 0x46, 0x0, 0x1, 0x1, 0x1, 0x0, 0x48, 0x0, 0x48, 0x0]; // Incorrect density values. Zero is invalid. - private readonly byte[] bytes3 = { 0x4A, 0x46, 0x49, 0x46, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0 }; + private readonly byte[] bytes3 = [0x4A, 0x46, 0x49, 0x46, 0x0, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0]; [Fact] public void MarkerLengthIsCorrect() @@ -40,7 +40,7 @@ public class JFifMarkerTests [Fact] public void MarkerIgnoresIncorrectValue() { - bool isJFif = JFifMarker.TryParse(new byte[] { 0, 0, 0, 0 }, out JFifMarker marker); + bool isJFif = JFifMarker.TryParse([0, 0, 0, 0], out JFifMarker marker); Assert.False(isJFif); Assert.Equal(default, marker); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs index 1dba8ee1c..8d94fb5cf 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs @@ -19,12 +19,8 @@ public class JpegColorConverterTests private const int TestBufferLength = 40; - private const HwIntrinsics IntrinsicsConfig = HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2; - private static readonly ApproximateColorProfileComparer ColorSpaceComparer = new(epsilon: Precision); - private static readonly ColorProfileConverter ColorSpaceConverter = new(); - public static readonly TheoryData Seeds = new() { 1, 2, 3 }; public JpegColorConverterTests(ITestOutputHelper output) @@ -73,7 +69,7 @@ public class JpegColorConverterTests { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -106,7 +102,7 @@ public class JpegColorConverterTests { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -139,7 +135,7 @@ public class JpegColorConverterTests { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -172,7 +168,7 @@ public class JpegColorConverterTests { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -205,7 +201,7 @@ public class JpegColorConverterTests { FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); static void RunTest(string arg) { @@ -783,8 +779,8 @@ public class JpegColorConverterTests g /= MaxColorChannelValue; b /= MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -804,9 +800,9 @@ public class JpegColorConverterTests r /= MaxColorChannelValue; g /= MaxColorChannelValue; b /= MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -817,9 +813,9 @@ public class JpegColorConverterTests float r = values.Component0[i] / MaxColorChannelValue; float g = values.Component1[i] / MaxColorChannelValue; float b = values.Component2[i] / MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -828,9 +824,9 @@ public class JpegColorConverterTests private static void ValidateGrayScale(in JpegColorConverterBase.ComponentValues values, in JpegColorConverterBase.ComponentValues result, int i) { float y = values.Component0[i] / MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(y, y, y)); + Rgb expected = Rgb.Clamp(new Rgb(y, y, y)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component0[i], result.Component0[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component0[i], result.Component0[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); @@ -846,9 +842,9 @@ public class JpegColorConverterTests float r = c * k / MaxColorChannelValue; float g = m * k / MaxColorChannelValue; float b = y * k / MaxColorChannelValue; - Rgb expected = Rgb.Clamp(new(r, g, b)); + Rgb expected = Rgb.Clamp(new Rgb(r, g, b)); - Rgb actual = Rgb.Clamp(new(result.Component0[i], result.Component1[i], result.Component2[i])); + Rgb actual = Rgb.Clamp(new Rgb(result.Component0[i], result.Component1[i], result.Component2[i])); bool equal = ColorSpaceComparer.Equals(expected, actual); Assert.True(equal, $"Colors {expected} and {actual} are not equal at index {i}"); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs index 85fad3f82..a4a71c673 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs @@ -7,7 +7,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg; public partial class JpegDecoderTests { public static string[] BaselineTestJpegs = - { + [ TestImages.Jpeg.Baseline.Calliphora, TestImages.Jpeg.Baseline.Cmyk, TestImages.Jpeg.Baseline.Ycck, @@ -41,11 +41,11 @@ public partial class JpegDecoderTests TestImages.Jpeg.Baseline.Testorig12bit, // Grayscale jpeg with 2x2 sampling factors (not a usual thing to encounter in the wild) - TestImages.Jpeg.Baseline.GrayscaleSampling2x2, - }; + TestImages.Jpeg.Baseline.GrayscaleSampling2x2 + ]; public static string[] ProgressiveTestJpegs = - { + [ TestImages.Jpeg.Progressive.Fb, TestImages.Jpeg.Progressive.Progress, TestImages.Jpeg.Progressive.Festzug, @@ -61,20 +61,20 @@ public partial class JpegDecoderTests TestImages.Jpeg.Issues.OrderedInterleavedProgressive723A, TestImages.Jpeg.Issues.OrderedInterleavedProgressive723B, TestImages.Jpeg.Issues.OrderedInterleavedProgressive723C - }; + ]; public static string[] UnsupportedTestJpegs = - { + [ // Invalid componentCount value (2 or > 4) TestImages.Jpeg.Issues.Fuzz.NullReferenceException823, TestImages.Jpeg.Issues.MalformedUnsupportedComponentCount, // Lossless jpeg TestImages.Jpeg.Baseline.Lossless - }; + ]; public static string[] UnrecoverableTestJpegs = - { + [ TestImages.Jpeg.Issues.CriticalEOF214, TestImages.Jpeg.Issues.Fuzz.NullReferenceException797, TestImages.Jpeg.Issues.Fuzz.AccessViolationException798, @@ -98,8 +98,8 @@ public partial class JpegDecoderTests TestImages.Jpeg.Issues.Fuzz.IndexOutOfRangeException1693A, TestImages.Jpeg.Issues.Fuzz.IndexOutOfRangeException1693B, TestImages.Jpeg.Issues.Fuzz.IndexOutOfRangeException824C, - TestImages.Jpeg.Issues.Fuzz.NullReferenceException2085, - }; + TestImages.Jpeg.Issues.Fuzz.NullReferenceException2085 + ]; private static readonly Dictionary CustomToleranceValues = new() { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Internal.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Internal.cs index 6cf6250cb..b780b14fb 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Internal.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Internal.cs @@ -19,7 +19,7 @@ public partial class JpegDecoderTests [InlineData(4, JpegConstants.Adobe.ColorTransformYcck, JpegColorSpace.Ycck)] internal void DeduceJpegColorSpaceAdobeMarker_ShouldReturnValidColorSpace(byte componentCount, byte adobeFlag, JpegColorSpace expectedColorSpace) { - byte[] adobeMarkerPayload = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, adobeFlag }; + byte[] adobeMarkerPayload = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, adobeFlag]; ProfileResolver.AdobeMarker.CopyTo(adobeMarkerPayload); _ = AdobeMarker.TryParse(adobeMarkerPayload, out AdobeMarker adobeMarker); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs index 20a9ad387..11c7dc86d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs @@ -461,7 +461,7 @@ public partial class JpegDecoderTests // We want to test the encoder to ensure the determined values can be encoded but not by encoding // the full size image as it would be too slow. // We will crop the image to a smaller size and then encode it. - image.Mutate(x => x.Crop(new(0, 0, 100, 100))); + image.Mutate(x => x.Crop(new Rectangle(0, 0, 100, 100))); using MemoryStream ms = new(); image.Save(ms, new JpegEncoder()); @@ -501,7 +501,7 @@ public partial class JpegDecoderTests // the profile contains 4 duplicated UserComment Assert.Equal(1, exifProfile.Values.Count(t => t.Tag == ExifTag.UserComment)); - image.Mutate(x => x.Crop(new(0, 0, 100, 100))); + image.Mutate(x => x.Crop(new Rectangle(0, 0, 100, 100))); image.Save(ms, new JpegEncoder()); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 6df354276..3fd55eb91 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -44,8 +44,8 @@ public partial class JpegDecoderTests private static bool SkipTest(ITestImageProvider provider) { string[] largeImagesToSkipOn32Bit = - { - TestImages.Jpeg.Baseline.Jpeg420Exif, + [ + TestImages.Jpeg.Baseline.Jpeg420Exif, TestImages.Jpeg.Issues.MissingFF00ProgressiveBedroom159, TestImages.Jpeg.Issues.BadZigZagProgressive385, TestImages.Jpeg.Issues.NoEoiProgressive517, @@ -53,7 +53,7 @@ public partial class JpegDecoderTests TestImages.Jpeg.Issues.InvalidEOI695, TestImages.Jpeg.Issues.ExifResizeOutOfRange696, TestImages.Jpeg.Issues.ExifGetString750Transform - }; + ]; return !TestEnvironment.Is64BitProcess && largeImagesToSkipOn32Bit.Contains(provider.SourceFileOrDescription); } @@ -116,7 +116,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); FormattableString details = $"{options.TargetSize.Value.Width}_{options.TargetSize.Value.Height}"; @@ -136,7 +136,7 @@ public partial class JpegDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 }, + TargetSize = new Size { Width = 150, Height = 150 }, Sampler = KnownResamplers.Bicubic }; using Image image = provider.GetImage(JpegDecoder.Instance, options); @@ -156,7 +156,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Specialized_IDCT_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; JpegDecoderOptions specializedOptions = new() { GeneralOptions = options, @@ -180,7 +180,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Specialized_Scale_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; JpegDecoderOptions specializedOptions = new() { GeneralOptions = options, @@ -204,7 +204,7 @@ public partial class JpegDecoderTests public void JpegDecoder_Decode_Specialized_Combined_Resize(TestImageProvider provider) where TPixel : unmanaged, IPixel { - DecoderOptions options = new() { TargetSize = new() { Width = 150, Height = 150 } }; + DecoderOptions options = new() { TargetSize = new Size { Width = 150, Height = 150 } }; JpegDecoderOptions specializedOptions = new() { GeneralOptions = options, @@ -372,7 +372,7 @@ public partial class JpegDecoderTests { JpegDecoderOptions options = new() { - GeneralOptions = new() { ColorProfileHandling = ColorProfileHandling.Convert } + GeneralOptions = new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); @@ -387,7 +387,7 @@ public partial class JpegDecoderTests { JpegDecoderOptions options = new() { - GeneralOptions = new() { ColorProfileHandling = ColorProfileHandling.Convert } + GeneralOptions = new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); @@ -402,16 +402,35 @@ public partial class JpegDecoderTests [WithFile(TestImages.Jpeg.ICC.ProPhoto, PixelTypes.Rgba32)] [WithFile(TestImages.Jpeg.ICC.WideRGB, PixelTypes.Rgba32)] [WithFile(TestImages.Jpeg.ICC.AppleRGB, PixelTypes.Rgba32)] + [WithFile(TestImages.Jpeg.ICC.SRgbGray, PixelTypes.Rgba32)] + [WithFile(TestImages.Jpeg.ICC.Perceptual, PixelTypes.Rgba32)] + [WithFile(TestImages.Jpeg.ICC.PerceptualcLUTOnly, PixelTypes.Rgba32)] public void Decode_RGB_ICC_Jpeg(TestImageProvider provider) where TPixel : unmanaged, IPixel { JpegDecoderOptions options = new() { - GeneralOptions = new() { ColorProfileHandling = ColorProfileHandling.Convert } + GeneralOptions = new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert } }; using Image image = provider.GetImage(JpegDecoder.Instance, options); image.DebugSave(provider); image.CompareToReferenceOutput(provider); } + + // https://github.com/SixLabors/ImageSharp/issues/2948 + [Theory] + [WithFile(TestImages.Jpeg.Issues.Issue2948, PixelTypes.Rgb24)] + public void Issue2948_No_SOS_Decode_Throws_InvalidImageContentException(TestImageProvider provider) + where TPixel : unmanaged, IPixel + => Assert.Throws(() => + { + using Image image = provider.GetImage(JpegDecoder.Instance); + }); + + // https://github.com/SixLabors/ImageSharp/issues/2948 + [Theory] + [InlineData(TestImages.Jpeg.Issues.Issue2948)] + public void Issue2948_No_SOS_Identify_Throws_InvalidImageContentException(string imagePath) + => Assert.Throws(() => _ = Image.Identify(TestFile.Create(imagePath).Bytes)); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs index 58b437af0..ede147dbe 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs @@ -258,8 +258,8 @@ where TPixel : unmanaged, IPixel using Image image = provider.GetImage(); image.Mutate(x => x.Crop(132, 1606)); - int[] quality = new int[] { 100, 50 }; - JpegColorType[] colors = new[] { JpegColorType.YCbCrRatio444, JpegColorType.YCbCrRatio420 }; + int[] quality = [100, 50]; + JpegColorType[] colors = [JpegColorType.YCbCrRatio444, JpegColorType.YCbCrRatio420]; for (int i = 0; i < quality.Length; i++) { int q = quality[i]; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs index df74d266c..62362ec80 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegFileMarkerTests.cs @@ -14,7 +14,7 @@ public class JpegFileMarkerTests { const byte app1 = JpegConstants.Markers.APP1; const int position = 5; - var marker = new JpegFileMarker(app1, position); + JpegFileMarker marker = new(app1, position); Assert.Equal(app1, marker.Marker); Assert.Equal(position, marker.Position); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs index 19b5265a1..37be0f8f5 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegMetadataTests.cs @@ -12,8 +12,8 @@ public class JpegMetadataTests [Fact] public void CloneIsDeep() { - var meta = new JpegMetadata { ColorType = JpegColorType.Luminance }; - var clone = (JpegMetadata)meta.DeepClone(); + JpegMetadata meta = new() { ColorType = JpegColorType.Luminance }; + JpegMetadata clone = (JpegMetadata)meta.DeepClone(); clone.ColorType = JpegColorType.YCbCrRatio420; @@ -23,7 +23,7 @@ public class JpegMetadataTests [Fact] public void Quality_DefaultQuality() { - var meta = new JpegMetadata(); + JpegMetadata meta = new(); Assert.Equal(meta.Quality, ImageSharp.Formats.Jpeg.Components.Quantization.DefaultQualityFactor); } @@ -33,7 +33,7 @@ public class JpegMetadataTests { int quality = 50; - var meta = new JpegMetadata { LuminanceQuality = quality }; + JpegMetadata meta = new() { LuminanceQuality = quality }; Assert.Equal(meta.Quality, quality); } @@ -43,7 +43,7 @@ public class JpegMetadataTests { int quality = 50; - var meta = new JpegMetadata { LuminanceQuality = quality, ChrominanceQuality = quality }; + JpegMetadata meta = new() { LuminanceQuality = quality, ChrominanceQuality = quality }; Assert.Equal(meta.Quality, quality); } @@ -54,7 +54,7 @@ public class JpegMetadataTests int qualityLuma = 50; int qualityChroma = 30; - var meta = new JpegMetadata { LuminanceQuality = qualityLuma, ChrominanceQuality = qualityChroma }; + JpegMetadata meta = new() { LuminanceQuality = qualityLuma, ChrominanceQuality = qualityChroma }; Assert.Equal(meta.Quality, qualityLuma); } @@ -62,7 +62,7 @@ public class JpegMetadataTests [Fact] public void Comment_EmptyComment() { - var meta = new JpegMetadata(); + JpegMetadata meta = new(); Assert.True(Array.Empty().SequenceEqual(meta.Comments)); } @@ -71,9 +71,9 @@ public class JpegMetadataTests public void Comment_OnlyComment() { string comment = "test comment"; - var expectedCollection = new Collection { comment }; + Collection expectedCollection = new() { comment }; - var meta = new JpegMetadata(); + JpegMetadata meta = new(); meta.Comments.Add(JpegComData.FromString(comment)); Assert.Equal(1, meta.Comments.Count); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs index b202fd9ec..b6a59fa93 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs @@ -27,7 +27,7 @@ public class ParseStreamTests [InlineData(TestImages.Jpeg.Baseline.Cmyk, JpegColorSpace.Cmyk)] public void ColorSpace_IsDeducedCorrectly(string imageFile, object expectedColorSpaceValue) { - var expectedColorSpace = (JpegColorSpace)expectedColorSpaceValue; + JpegColorSpace expectedColorSpace = (JpegColorSpace)expectedColorSpaceValue; using (JpegDecoderCore decoder = JpegFixture.ParseJpegStream(imageFile, metaDataOnly: true)) { @@ -47,7 +47,7 @@ public class ParseStreamTests Assert.Equal(expectedSizeInBlocks, decoder.Frame.McuSize); - var uniform1 = new Size(1, 1); + Size uniform1 = new(1, 1); IJpegComponent c0 = decoder.Components[0]; VerifyJpeg.VerifyComponent(c0, expectedSizeInBlocks, uniform1, uniform1); } @@ -62,7 +62,7 @@ public class ParseStreamTests [InlineData(TestImages.Jpeg.Baseline.Cmyk)] public void PrintComponentData(string imageFile) { - var sb = new StringBuilder(); + StringBuilder sb = new(); using (JpegDecoderCore decoder = JpegFixture.ParseJpegStream(imageFile)) { @@ -98,8 +98,8 @@ public class ParseStreamTests object expectedLumaFactors, object expectedChromaFactors) { - var fLuma = (Size)expectedLumaFactors; - var fChroma = (Size)expectedChromaFactors; + Size fLuma = (Size)expectedLumaFactors; + Size fChroma = (Size)expectedChromaFactors; using (JpegDecoderCore decoder = JpegFixture.ParseJpegStream(imageFile)) { @@ -110,7 +110,7 @@ public class ParseStreamTests IJpegComponent c1 = decoder.Components[1]; IJpegComponent c2 = decoder.Components[2]; - var uniform1 = new Size(1, 1); + Size uniform1 = new(1, 1); Size expectedLumaSizeInBlocks = decoder.Frame.McuSize.MultiplyBy(fLuma); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs index f5d7c159b..2fcd953ae 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs @@ -53,7 +53,7 @@ public partial class ReferenceImplementationsTests { float[] sourceArray = Create8x8RandomFloatData(-range, range, seed); - var source = Block8x8F.Load(sourceArray); + Block8x8F source = Block8x8F.Load(sourceArray); Block8x8F expected = ReferenceImplementations.AccurateDCT.TransformIDCT(ref source); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs index 499cf7991..903a6b076 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/SpectralJpegTests.cs @@ -22,19 +22,19 @@ public class SpectralJpegTests private ITestOutputHelper Output { get; } public static readonly string[] BaselineTestJpegs = - { - TestImages.Jpeg.Baseline.Calliphora, TestImages.Jpeg.Baseline.Cmyk, TestImages.Jpeg.Baseline.Jpeg400, + [ + TestImages.Jpeg.Baseline.Calliphora, TestImages.Jpeg.Baseline.Cmyk, TestImages.Jpeg.Baseline.Jpeg400, TestImages.Jpeg.Baseline.Jpeg444, TestImages.Jpeg.Baseline.Testorig420, TestImages.Jpeg.Baseline.Jpeg420Small, TestImages.Jpeg.Baseline.Bad.BadEOF, TestImages.Jpeg.Baseline.MultiScanBaselineCMYK - }; + ]; public static readonly string[] ProgressiveTestJpegs = - { - TestImages.Jpeg.Progressive.Fb, TestImages.Jpeg.Progressive.Progress, + [ + TestImages.Jpeg.Progressive.Fb, TestImages.Jpeg.Progressive.Progress, TestImages.Jpeg.Progressive.Festzug, TestImages.Jpeg.Progressive.Bad.BadEOF, - TestImages.Jpeg.Progressive.Bad.ExifUndefType, - }; + TestImages.Jpeg.Progressive.Bad.ExifUndefType + ]; public static readonly string[] AllTestJpegs = BaselineTestJpegs.Concat(ProgressiveTestJpegs).ToArray(); @@ -47,13 +47,13 @@ public class SpectralJpegTests byte[] sourceBytes = TestFile.Create(provider.SourceFileOrDescription).Bytes; JpegDecoderOptions option = new(); - using var decoder = new JpegDecoderCore(option); - using var ms = new MemoryStream(sourceBytes); - using var bufferedStream = new BufferedReadStream(Configuration.Default, ms); + using JpegDecoderCore decoder = new(option); + using MemoryStream ms = new(sourceBytes); + using BufferedReadStream bufferedStream = new(Configuration.Default, ms); // internal scan decoder which we substitute to assert spectral correctness - var debugConverter = new DebugSpectralConverter(); - var scanDecoder = new HuffmanScanDecoder(bufferedStream, debugConverter, cancellationToken: default); + DebugSpectralConverter debugConverter = new(); + HuffmanScanDecoder scanDecoder = new(bufferedStream, debugConverter, cancellationToken: default); // This would parse entire image decoder.ParseStream(bufferedStream, debugConverter, cancellationToken: default); @@ -77,12 +77,12 @@ public class SpectralJpegTests byte[] sourceBytes = TestFile.Create(provider.SourceFileOrDescription).Bytes; JpegDecoderOptions options = new(); - using var decoder = new JpegDecoderCore(options); - using var ms = new MemoryStream(sourceBytes); - using var bufferedStream = new BufferedReadStream(Configuration.Default, ms); + using JpegDecoderCore decoder = new(options); + using MemoryStream ms = new(sourceBytes); + using BufferedReadStream bufferedStream = new(Configuration.Default, ms); // internal scan decoder which we substitute to assert spectral correctness - var debugConverter = new DebugSpectralConverter(); + DebugSpectralConverter debugConverter = new(); // This would parse entire image decoder.ParseStream(bufferedStream, debugConverter, cancellationToken: default); @@ -198,7 +198,7 @@ public class SpectralJpegTests public override void PrepareForDecoding() { - var spectralComponents = new LibJpegTools.ComponentData[this.frame.ComponentCount]; + LibJpegTools.ComponentData[] spectralComponents = new LibJpegTools.ComponentData[this.frame.ComponentCount]; for (int i = 0; i < spectralComponents.Length; i++) { JpegComponent component = this.frame.Components[i]; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs index b9f4a90b6..13300ee80 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/SpectralToPixelConversionTests.cs @@ -15,12 +15,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg; public class SpectralToPixelConversionTests { public static readonly string[] BaselineTestJpegs = - { + [ TestImages.Jpeg.Baseline.Calliphora, TestImages.Jpeg.Baseline.Cmyk, TestImages.Jpeg.Baseline.Jpeg400, TestImages.Jpeg.Baseline.Jpeg444, TestImages.Jpeg.Baseline.Testorig420, TestImages.Jpeg.Baseline.Jpeg420Small, TestImages.Jpeg.Baseline.Bad.BadEOF, TestImages.Jpeg.Baseline.MultiScanBaselineCMYK - }; + ]; public SpectralToPixelConversionTests(ITestOutputHelper output) => this.Output = output; @@ -33,14 +33,14 @@ public class SpectralToPixelConversionTests { // Stream byte[] sourceBytes = TestFile.Create(provider.SourceFileOrDescription).Bytes; - using var ms = new MemoryStream(sourceBytes); - using var bufferedStream = new BufferedReadStream(Configuration.Default, ms); + using MemoryStream ms = new(sourceBytes); + using BufferedReadStream bufferedStream = new(Configuration.Default, ms); // Decoding JpegDecoderOptions options = new(); - using var converter = new SpectralConverter(Configuration.Default); - using var decoder = new JpegDecoderCore(options); - var scanDecoder = new HuffmanScanDecoder(bufferedStream, converter, cancellationToken: default); + using SpectralConverter converter = new(Configuration.Default); + using JpegDecoderCore decoder = new(options); + HuffmanScanDecoder scanDecoder = new(bufferedStream, converter, cancellationToken: default); decoder.ParseStream(bufferedStream, converter, cancellationToken: default); // Test metadata @@ -48,7 +48,7 @@ public class SpectralToPixelConversionTests provider.Utility.TestName = JpegDecoderTests.DecodeBaselineJpegOutputName; // Comparison - using var image = new Image(Configuration.Default, converter.GetPixelBuffer(null, CancellationToken.None), new ImageMetadata()); + using Image image = new(Configuration.Default, converter.GetPixelBuffer(null, CancellationToken.None), new ImageMetadata()); using Image referenceImage = provider.GetReferenceOutputImage(appendPixelTypeToFileName: false); ImageSimilarityReport report = ImageComparer.Exact.CompareImagesOrFrames(referenceImage, image); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs index a3fbe4018..33e95c5aa 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs @@ -72,7 +72,7 @@ public class JpegFixture : MeasureFixture // ReSharper disable once InconsistentNaming public static int[] Create8x8RandomIntData(int minValue, int maxValue, int seed = 42) { - var rnd = new Random(seed); + Random rnd = new(seed); int[] result = new int[64]; for (int i = 0; i < 8; i++) { @@ -87,7 +87,7 @@ public class JpegFixture : MeasureFixture public static float[] Create8x8RandomFloatData(float minValue, float maxValue, int seed = 42, int xBorder = 8, int yBorder = 8) { - var rnd = new Random(seed); + Random rnd = new(seed); float[] result = new float[64]; for (int y = 0; y < yBorder; y++) { @@ -112,7 +112,7 @@ public class JpegFixture : MeasureFixture internal void Print8x8Data(Span data) { - var bld = new StringBuilder(); + StringBuilder bld = new(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) @@ -135,7 +135,7 @@ public class JpegFixture : MeasureFixture count = data.Length; } - var sb = new StringBuilder(); + StringBuilder sb = new(); for (int i = 0; i < count; i++) { sb.Append($"{data[i],3} "); @@ -158,7 +158,7 @@ public class JpegFixture : MeasureFixture internal void CompareBlocks(Span a, Span b, float tolerance) { - var comparer = new ApproximateFloatComparer(tolerance); + ApproximateFloatComparer comparer = new(tolerance); double totalDifference = 0.0; bool failed = false; @@ -192,7 +192,7 @@ public class JpegFixture : MeasureFixture internal static bool CompareBlocks(Span a, Span b, float tolerance, out float diff) { - var comparer = new ApproximateFloatComparer(tolerance); + ApproximateFloatComparer comparer = new(tolerance); bool failed = false; diff = 0; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs index bd1df3377..888459112 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs @@ -65,7 +65,7 @@ internal static partial class LibJpegTools } string args = $@"""{sourceFile}"" ""{destFile}"""; - var process = new Process + Process process = new() { StartInfo = { @@ -95,21 +95,21 @@ internal static partial class LibJpegTools { RunDumpJpegCoeffsTool(testFile.FullPath, coeffFileFullPath); - using (var dumpStream = new FileStream(coeffFileFullPath, FileMode.Open)) - using (var rdr = new BinaryReader(dumpStream)) + using (FileStream dumpStream = new(coeffFileFullPath, FileMode.Open)) + using (BinaryReader rdr = new(dumpStream)) { int componentCount = rdr.ReadInt16(); - var result = new ComponentData[componentCount]; + ComponentData[] result = new ComponentData[componentCount]; for (int i = 0; i < componentCount; i++) { int widthInBlocks = rdr.ReadInt16(); int heightInBlocks = rdr.ReadInt16(); - var resultComponent = new ComponentData(widthInBlocks, heightInBlocks, i); + ComponentData resultComponent = new(widthInBlocks, heightInBlocks, i); result[i] = resultComponent; } - var buffer = new byte[64 * sizeof(short)]; + byte[] buffer = new byte[64 * sizeof(short)]; for (int i = 0; i < result.Length; i++) { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs index b6e7b29a6..2d4db15df 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs @@ -30,7 +30,7 @@ internal static partial class ReferenceImplementations public static void TransformIDCTInplace(Span span) { - var temp = default(Block8x8); + Block8x8 temp = default(Block8x8); temp.LoadFrom(span); Block8x8 result = TransformIDCT(ref temp); result.CopyTo(span); @@ -45,7 +45,7 @@ internal static partial class ReferenceImplementations public static void TransformFDCTInplace(Span span) { - var temp = default(Block8x8); + Block8x8 temp = default(Block8x8); temp.LoadFrom(span); Block8x8 result = TransformFDCT(ref temp); result.CopyTo(span); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs index 0d5f3114d..7c7f47f94 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs @@ -208,8 +208,8 @@ internal static partial class ReferenceImplementations /*y[0] = c0 + c1; y[4] = c0 - c1;*/ - var w0 = new Vector4(0.541196f); - var w1 = new Vector4(1.306563f); + Vector4 w0 = new(0.541196f); + Vector4 w1 = new(1.306563f); _mm_store_ps(d, 16, (w0 * c2) + (w1 * c3)); @@ -242,7 +242,7 @@ internal static partial class ReferenceImplementations _mm_store_ps(d, 40, c3 - c1); // y[5] = c3 - c1; y[3] = c0 - c2; - var invsqrt2 = new Vector4(0.707107f); + Vector4 invsqrt2 = new(0.707107f); c0 = (c0 + c2) * invsqrt2; c3 = (c3 + c1) * invsqrt2; @@ -272,7 +272,7 @@ internal static partial class ReferenceImplementations FDCT2D8x4_32f(temp.Slice(4), d.Slice(4)); - var c = new Vector4(0.1250f); + Vector4 c = new(0.1250f); #pragma warning disable SA1107 // Code should not contain multiple statements on one line _mm_store_ps(d, 0, _mm_load_ps(d, 0) * c); d = d.Slice(4); // 0 @@ -318,29 +318,29 @@ internal static partial class ReferenceImplementations // Accurate variants of constants from: // https://github.com/mozilla/mozjpeg/blob/master/simd/jfdctint-altivec.c #pragma warning disable SA1309 // Field names should not begin with underscore - private static readonly Vector4 _1_175876 = new Vector4(1.175875602f); + private static readonly Vector4 _1_175876 = new(1.175875602f); - private static readonly Vector4 _1_961571 = new Vector4(-1.961570560f); + private static readonly Vector4 _1_961571 = new(-1.961570560f); - private static readonly Vector4 _0_390181 = new Vector4(-0.390180644f); + private static readonly Vector4 _0_390181 = new(-0.390180644f); - private static readonly Vector4 _0_899976 = new Vector4(-0.899976223f); + private static readonly Vector4 _0_899976 = new(-0.899976223f); - private static readonly Vector4 _2_562915 = new Vector4(-2.562915447f); + private static readonly Vector4 _2_562915 = new(-2.562915447f); - private static readonly Vector4 _0_298631 = new Vector4(0.298631336f); + private static readonly Vector4 _0_298631 = new(0.298631336f); - private static readonly Vector4 _2_053120 = new Vector4(2.053119869f); + private static readonly Vector4 _2_053120 = new(2.053119869f); - private static readonly Vector4 _3_072711 = new Vector4(3.072711026f); + private static readonly Vector4 _3_072711 = new(3.072711026f); - private static readonly Vector4 _1_501321 = new Vector4(1.501321110f); + private static readonly Vector4 _1_501321 = new(1.501321110f); - private static readonly Vector4 _0_541196 = new Vector4(0.541196100f); + private static readonly Vector4 _0_541196 = new(0.541196100f); - private static readonly Vector4 _1_847759 = new Vector4(-1.847759065f); + private static readonly Vector4 _1_847759 = new(-1.847759065f); - private static readonly Vector4 _0_765367 = new Vector4(0.765366865f); + private static readonly Vector4 _0_765367 = new(0.765366865f); #pragma warning restore SA1309 // Field names should not begin with underscore /// diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs index 95ab076b0..10019c609 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs @@ -71,10 +71,10 @@ internal static partial class ReferenceImplementations public static Block8x8 Subtract128_TransformFDCT_Upscale8(ref Block8x8 block) { - var temp = new int[Block8x8.Size]; + int[] temp = new int[Block8x8.Size]; block.CopyTo(temp); Subtract128_TransformFDCT_Upscale8_Inplace(temp); - var result = default(Block8x8); + Block8x8 result = default(Block8x8); result.LoadFrom(temp); return result; } @@ -82,10 +82,10 @@ internal static partial class ReferenceImplementations // [Obsolete("Looks like this method produces really bad results for bigger values!")] public static Block8x8 TransformIDCT(ref Block8x8 block) { - var temp = new int[Block8x8.Size]; + int[] temp = new int[Block8x8.Size]; block.CopyTo(temp); TransformIDCTInplace(temp); - var result = default(Block8x8); + Block8x8 result = default(Block8x8); result.LoadFrom(temp); return result; } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs index 240a338f9..d7c2c0bbb 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/SpanExtensions.cs @@ -74,7 +74,7 @@ internal static class SpanExtensions /// A new with float values public static float[] ConvertAllToFloat(this int[] src) { - var result = new float[src.Length]; + float[] result = new float[src.Length]; for (int i = 0; i < src.Length; i++) { result[i] = src[i]; @@ -91,7 +91,7 @@ internal static class SpanExtensions /// A new instance of public static Span AddScalarToAllValues(this Span src, float scalar) { - var result = new float[src.Length]; + float[] result = new float[src.Length]; for (int i = 0; i < src.Length; i++) { result[i] = src[i] + scalar; @@ -108,7 +108,7 @@ internal static class SpanExtensions /// A new instance of public static Span AddScalarToAllValues(this Span src, int scalar) { - var result = new int[src.Length]; + int[] result = new int[src.Length]; for (int i = 0; i < src.Length; i++) { result[i] = src[i] + scalar; diff --git a/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs index 11dd1cd58..476538ccd 100644 --- a/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Pbm/PbmDecoderTests.cs @@ -29,11 +29,11 @@ public class PbmDecoderTests public void ImageLoadCanDecode(string imagePath, PbmColorType expectedColorType, PbmComponentType expectedComponentType) { // Arrange - var testFile = TestFile.Create(imagePath); - using var stream = new MemoryStream(testFile.Bytes, false); + TestFile testFile = TestFile.Create(imagePath); + using MemoryStream stream = new(testFile.Bytes, false); // Act - using var image = Image.Load(stream); + using Image image = Image.Load(stream); // Assert Assert.NotNull(image); @@ -53,11 +53,11 @@ public class PbmDecoderTests public void ImageLoadL8CanDecode(string imagePath) { // Arrange - var testFile = TestFile.Create(imagePath); - using var stream = new MemoryStream(testFile.Bytes, false); + TestFile testFile = TestFile.Create(imagePath); + using MemoryStream stream = new(testFile.Bytes, false); // Act - using var image = Image.Load(stream); + using Image image = Image.Load(stream); // Assert Assert.NotNull(image); @@ -70,11 +70,11 @@ public class PbmDecoderTests public void ImageLoadRgb24CanDecode(string imagePath) { // Arrange - var testFile = TestFile.Create(imagePath); - using var stream = new MemoryStream(testFile.Bytes, false); + TestFile testFile = TestFile.Create(imagePath); + using MemoryStream stream = new(testFile.Bytes, false); // Act - using var image = Image.Load(stream); + using Image image = Image.Load(stream); // Assert Assert.NotNull(image); @@ -108,7 +108,7 @@ public class PbmDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(PbmDecoder.Instance, options); diff --git a/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs index 05f1d963b..0fea65f6e 100644 --- a/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Pbm/PbmEncoderTests.cs @@ -38,16 +38,16 @@ public class PbmEncoderTests [MemberData(nameof(PbmColorTypeFiles))] public void PbmEncoder_PreserveColorType(string imagePath, PbmColorType pbmColorType) { - var options = new PbmEncoder(); + PbmEncoder options = new(); - var testFile = TestFile.Create(imagePath); + TestFile testFile = TestFile.Create(imagePath); using (Image input = testFile.CreateRgba32Image()) { - using (var memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { input.Save(memStream, options); memStream.Position = 0; - using (var output = Image.Load(memStream)) + using (Image output = Image.Load(memStream)) { PbmMetadata meta = output.Metadata.GetPbmMetadata(); Assert.Equal(pbmColorType, meta.ColorType); @@ -60,15 +60,15 @@ public class PbmEncoderTests [MemberData(nameof(PbmColorTypeFiles))] public void PbmEncoder_WithPlainEncoding_PreserveBitsPerPixel(string imagePath, PbmColorType pbmColorType) { - var options = new PbmEncoder() + PbmEncoder options = new() { Encoding = PbmEncoding.Plain }; - var testFile = TestFile.Create(imagePath); + TestFile testFile = TestFile.Create(imagePath); using (Image input = testFile.CreateRgba32Image()) { - using (var memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { input.Save(memStream, options); @@ -78,7 +78,7 @@ public class PbmEncoderTests Assert.Equal(0x20, lastByte); memStream.Seek(0, SeekOrigin.Begin); - using (var output = Image.Load(memStream)) + using (Image output = Image.Load(memStream)) { PbmMetadata meta = output.Metadata.GetPbmMetadata(); Assert.Equal(pbmColorType, meta.ColorType); @@ -132,13 +132,13 @@ public class PbmEncoderTests { using (Image image = provider.GetImage()) { - var encoder = new PbmEncoder { ColorType = colorType, Encoding = encoding }; + PbmEncoder encoder = new() { ColorType = colorType, Encoding = encoding }; - using (var memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { image.Save(memStream, encoder); memStream.Position = 0; - using (var encodedImage = (Image)Image.Load(memStream)) + using (Image encodedImage = (Image)Image.Load(memStream)) { ImageComparingUtils.CompareWithReferenceDecoder(provider, encodedImage, useExactComparer, compareTolerance); } diff --git a/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs b/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs index b7ce32ed8..6524b3506 100644 --- a/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs +++ b/tests/ImageSharp.Tests/Formats/Pbm/PbmRoundTripTests.cs @@ -21,11 +21,11 @@ public class PbmRoundTripTests public void PbmGrayscaleImageCanRoundTrip(string imagePath) { // Arrange - var testFile = TestFile.Create(imagePath); - using var stream = new MemoryStream(testFile.Bytes, false); + TestFile testFile = TestFile.Create(imagePath); + using MemoryStream stream = new(testFile.Bytes, false); // Act - using var originalImage = Image.Load(stream); + using Image originalImage = Image.Load(stream); using Image colorImage = originalImage.CloneAs(); using Image encodedImage = this.RoundTrip(colorImage); @@ -42,11 +42,11 @@ public class PbmRoundTripTests public void PbmColorImageCanRoundTrip(string imagePath) { // Arrange - var testFile = TestFile.Create(imagePath); - using var stream = new MemoryStream(testFile.Bytes, false); + TestFile testFile = TestFile.Create(imagePath); + using MemoryStream stream = new(testFile.Bytes, false); // Act - using var originalImage = Image.Load(stream); + using Image originalImage = Image.Load(stream); using Image encodedImage = this.RoundTrip(originalImage); // Assert @@ -57,10 +57,10 @@ public class PbmRoundTripTests private Image RoundTrip(Image originalImage) where TPixel : unmanaged, IPixel { - using var decodedStream = new MemoryStream(); + using MemoryStream decodedStream = new(); originalImage.SaveAsPbm(decodedStream); decodedStream.Seek(0, SeekOrigin.Begin); - var encodedImage = Image.Load(decodedStream); + Image encodedImage = Image.Load(decodedStream); return encodedImage; } } diff --git a/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs b/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs index 1b66c4cc3..c2b640a1d 100644 --- a/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs @@ -30,7 +30,7 @@ public class Adler32Tests { // arrange byte[] data = GetBuffer(length); - var adler = new SharpAdler32(); + SharpAdler32 adler = new(); adler.Update(data); long expected = adler.Value; @@ -60,7 +60,7 @@ public class Adler32Tests private static void RunCalculateAdlerTest() { - int[] testData = { 0, 8, 215, 1024, 1024 + 15, 2034, 4096 }; + int[] testData = [0, 8, 215, 1024, 1024 + 15, 2034, 4096]; for (int i = 0; i < testData.Length; i++) { CalculateAdlerAndCompareToReference(testData[i]); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs index f5c42c734..6616b0477 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs @@ -13,33 +13,33 @@ public class PngDecoderFilterTests { // arrange byte[] scanline = - { + [ 3, 39, 39, 39, 0, 4, 4, 4, 0, 1, 1, 1, 0, 1, 1, 1, 0, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 0, 4, 4, 4, 0, 2, 2, 2, 0, 3, 3, 3, 0, 1, 1, 1, 0, 3, 3, 3, 0, 3, 3, 3, 0, 1, 1, 1, 0, 3, 3, 3, 0, 2, 2, 2, 0, 1, 1, 1, 0, 3, 3, 3, 0, 1, 1, 1, 0, 3, 3, 3, 0, 1, 1, 1, 0, 3, 3, 3, 0, 3, 3, 3, 0, 254, 254, 254, 0, 6, 6, 6, 14, 71, 71, 71, 157, 254, 254, 254, 28, 251, 251, 251, 0, 4, 4, 4, 0, 2, 2, 2, 0, 11, 11, 11, 0, 226, 226, 226, 0, 255, 128, 234 - }; + ]; byte[] previousScanline = - { + [ 3, 74, 74, 74, 0, 73, 73, 73, 0, 73, 73, 73, 0, 74, 74, 74, 0, 74, 74, 74, 0, 73, 73, 73, 0, 72, 72, 72, 0, 72, 72, 72, 0, 73, 73, 73, 0, 74, 74, 74, 0, 73, 73, 73, 0, 72, 72, 72, 0, 72, 72, 72, 0, 74, 74, 74, 0, 72, 72, 72, 0, 73, 73, 73, 0, 75, 75, 75, 0, 73, 73, 73, 0, 74, 74, 74, 0, 72, 72, 72, 0, 73, 73, 73, 0, 73, 73, 73, 0, 72, 72, 72, 0, 74, 74, 74, 0, 61, 61, 61, 0, 101, 101, 101, 78, 197, 197, 197, 251, 152, 152, 152, 255, 155, 155, 155, 255, 162, 162, 162, 255, 175, 175, 175, 255, 160, 160, 160, 255, 139, 128, 134 - }; + ]; byte[] expected = - { + [ 3, 76, 76, 76, 0, 78, 78, 78, 0, 76, 76, 76, 0, 76, 76, 76, 0, 77, 77, 77, 0, 77, 77, 77, 0, 76, 76, 76, 0, 78, 78, 78, 0, 77, 77, 77, 0, 78, 78, 78, 0, 76, 76, 76, 0, 77, 77, 77, 0, 77, 77, 77, 0, 76, 76, 76, 0, 77, 77, 77, 0, 77, 77, 77, 0, 77, 77, 77, 0, 78, 78, 78, 0, 77, 77, 77, 0, 77, 77, 77, 0, 76, 76, 76, 0, 77, 77, 77, 0, 77, 77, 77, 0, 73, 73, 73, 0, 73, 73, 73, 14, 158, 158, 158, 203, 175, 175, 175, 255, 158, 158, 158, 255, 160, 160, 160, 255, 163, 163, 163, 255, 180, 180, 180, 255, 140, 140, 140, 255, 138, 6, 115 - }; + ]; // act AverageFilter.Decode(scanline, previousScanline, 4); @@ -52,25 +52,25 @@ public class PngDecoderFilterTests { // arrange byte[] scanline = - { + [ 62, 23, 186, 150, 174, 4, 205, 59, 153, 134, 158, 86, 240, 173, 191, 58, 111, 183, 77, 37, 85, 23, 93, 204, 110, 139, 9, 20, 87, 154, 176, 54, 207, 214, 40, 11, 179, 199, 7, 219, 174, 242, 112, 220, 149, 5, 9, 110, 103, 107, 231, 241, 13, 70, 216, 39, 186, 237, 39, 34, 251, 185, 228, 254 - }; + ]; byte[] previousScanline = - { + [ 214, 103, 135, 26, 133, 179, 134, 168, 175, 114, 118, 99, 167, 129, 55, 105, 129, 154, 173, 235, 179, 191, 41, 137, 253, 0, 81, 198, 159, 228, 224, 245, 14, 113, 5, 45, 126, 239, 233, 179, 229, 62, 66, 155, 207, 117, 128, 56, 181, 190, 160, 96, 11, 248, 74, 23, 62, 253, 29, 132, 98, 192, 9, 202 - }; + ]; byte[] expected = - { + [ 62, 126, 65, 176, 51, 183, 83, 227, 72, 248, 20, 185, 151, 46, 246, 163, 240, 81, 250, 16, 8, 214, 134, 85, 107, 139, 90, 218, 246, 126, 144, 43, 221, 71, 45, 56, 49, 182, 240, 142, 147, 48, 178, 119, 100, 122, 137, 166, 28, 41, 135, 81, 24, 62, 34, 62, 248, 234, 68, 166, 93, 121, 237, 200 - }; + ]; // act UpFilter.Decode(scanline, previousScanline); @@ -83,18 +83,18 @@ public class PngDecoderFilterTests { // arrange byte[] scanline = - { + [ 62, 23, 186, 150, 174, 4, 205, 59, 153, 134, 158, 86, 240, 173, 191, 58, 111, 183, 77, 37, 85, 23, 93, 204, 110, 139, 9, 20, 87, 154, 176, 54, 207, 214, 40, 11, 179, 199, 7, 219, 174, 242, 112, 220, 149, 5, 9, 110, 103, 107, 231, 241, 13, 70, 216, 39, 186, 237, 39, 34, 251, 185, 228, 254 - }; + ]; byte[] expected = - { + [ 62, 23, 186, 150, 174, 27, 135, 209, 71, 161, 37, 39, 55, 78, 228, 97, 166, 5, 49, 134, 251, 28, 142, 82, 105, 167, 151, 102, 192, 65, 71, 156, 143, 23, 111, 167, 66, 222, 118, 130, 240, 208, 230, 94, 133, 213, 239, 204, 236, 64, 214, 189, 249, 134, 174, 228, 179, 115, 213, 6, 174, 44, 185, 4 - }; + ]; // act SubFilter.Decode(scanline, 4); @@ -107,25 +107,25 @@ public class PngDecoderFilterTests { // arrange byte[] scanline = - { + [ 62, 23, 186, 150, 174, 4, 205, 59, 153, 134, 158, 86, 240, 173, 191, 58, 111, 183, 77, 37, 85, 23, 93, 204, 110, 139, 9, 20, 87, 154, 176, 54, 207, 214, 40, 11, 179, 199, 7, 219, 174, 242, 112, 220, 149, 5, 9, 110, 103, 107, 231, 241, 13, 70, 216, 39, 186, 237, 39, 34, 251, 185, 228, 254 - }; + ]; byte[] previousScanline = - { + [ 214, 103, 135, 26, 133, 179, 134, 168, 175, 114, 118, 99, 167, 129, 55, 105, 129, 154, 173, 235, 179, 191, 41, 137, 253, 0, 81, 198, 159, 228, 224, 245, 14, 113, 5, 45, 126, 239, 233, 179, 229, 62, 66, 155, 207, 117, 128, 56, 181, 190, 160, 96, 11, 248, 74, 23, 62, 253, 29, 132, 98, 192, 9, 202 - }; + ]; byte[] expected = - { + [ 62, 126, 65, 176, 51, 183, 14, 235, 30, 248, 172, 254, 14, 165, 53, 56, 125, 92, 250, 16, 8, 177, 10, 220, 118, 139, 50, 240, 205, 126, 144, 43, 221, 71, 45, 54, 144, 182, 240, 142, 147, 48, 178, 106, 40, 122, 187, 166, 143, 41, 162, 151, 24, 111, 34, 135, 248, 92, 68, 169, 243, 21, 1, 200 - }; + ]; // act PaethFilter.Decode(scanline, previousScanline, 4); @@ -171,7 +171,7 @@ public class PngDecoderFilterTests public void PaethFilter_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.AllowAll); [Fact] - public void PaethFilter_WithoutSsse3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableSSSE3); + public void PaethFilter_WithoutSsse3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void PaethFilter_WithoutHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableHWIntrinsic); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs index aff8bc12a..8dfa98748 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.Chunks.cs @@ -14,12 +14,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png; public partial class PngDecoderTests { // Represents ASCII string of "123456789" - private readonly byte[] check = { 49, 50, 51, 52, 53, 54, 55, 56, 57 }; + private readonly byte[] check = [49, 50, 51, 52, 53, 54, 55, 56, 57]; // Contains the png marker, IHDR and pHYs chunks of a 1x1 pixel 32bit png 1 a single black pixel. private static readonly byte[] Raw1X1PngIhdrAndpHYs = - { - // PNG Identifier + [ + // PNG Identifier 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, // IHDR @@ -36,12 +36,12 @@ public partial class PngDecoderTests // pHYS CRC 0xC7, 0x6F, 0xA8, 0x64 - }; + ]; // Contains the png marker, IDAT and IEND chunks of a 1x1 pixel 32bit png 1 a single black pixel. private static readonly byte[] Raw1X1PngIdatAndIend = - { - // IDAT + [ + // IDAT 0x00, 0x00, 0x00, 0x0C, 0x49, 0x44, 0x41, 0x54, 0x18, 0x57, 0x63, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, @@ -54,7 +54,7 @@ public partial class PngDecoderTests // IEND CRC 0xAE, 0x42, 0x60, 0x82 - }; + ]; [Theory] [InlineData((uint)PngChunkType.Header)] // IHDR @@ -64,7 +64,7 @@ public partial class PngDecoderTests { string chunkName = GetChunkTypeName(chunkType); - using (var memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { WriteHeaderChunk(memStream); WriteChunk(memStream, chunkName); @@ -94,10 +94,10 @@ public partial class PngDecoderTests private static void WriteChunk(MemoryStream memStream, string chunkName) { // Needs a minimum length of 9 for pHYs chunk. - memStream.Write(new byte[] { 0, 0, 0, 9 }, 0, 4); + memStream.Write([0, 0, 0, 9], 0, 4); memStream.Write(Encoding.ASCII.GetBytes(chunkName), 0, 4); // 4 bytes chunk header - memStream.Write(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 9); // 9 bytes of chunk data - memStream.Write(new byte[] { 0, 0, 0, 0 }, 0, 4); // Junk Crc + memStream.Write([0, 0, 0, 0, 0, 0, 0, 0, 0], 0, 9); // 9 bytes of chunk data + memStream.Write([0, 0, 0, 0], 0, 4); // Junk Crc } private static void WriteDataChunk(MemoryStream memStream) diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs index 4d058e54e..a58101a6b 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs @@ -21,7 +21,7 @@ public partial class PngDecoderTests private const PixelTypes TestPixelTypes = PixelTypes.Rgba32 | PixelTypes.RgbaVector | PixelTypes.Argb32; public static readonly string[] CommonTestImages = - { + [ TestImages.Png.Splash, TestImages.Png.FilterVar, @@ -35,29 +35,29 @@ public partial class PngDecoderTests TestImages.Png.Rgb24BppTrans, TestImages.Png.Bad.ChunkLength1, - TestImages.Png.Bad.ChunkLength2, - }; + TestImages.Png.Bad.ChunkLength2 + ]; public static readonly string[] TestImagesIssue1014 = - { + [ TestImages.Png.Issue1014_1, TestImages.Png.Issue1014_2, TestImages.Png.Issue1014_3, TestImages.Png.Issue1014_4, TestImages.Png.Issue1014_5, TestImages.Png.Issue1014_6 - }; + ]; public static readonly string[] TestImagesIssue1177 = - { + [ TestImages.Png.Issue1177_1, TestImages.Png.Issue1177_2 - }; + ]; public static readonly string[] CorruptedTestImages = - { + [ TestImages.Png.Bad.CorruptedChunk, TestImages.Png.Bad.ZlibOverflow, TestImages.Png.Bad.ZlibOverflow2, - TestImages.Png.Bad.ZlibZtxtBadHeader, - }; + TestImages.Png.Bad.ZlibZtxtBadHeader + ]; public static readonly TheoryData PixelFormatRange = new() { @@ -79,7 +79,7 @@ public partial class PngDecoderTests }; public static readonly string[] MultiFrameTestFiles = - { + [ TestImages.Png.APng, TestImages.Png.SplitIDatZeroLength, TestImages.Png.DisposeNone, @@ -90,7 +90,7 @@ public partial class PngDecoderTests TestImages.Png.BlendOverMultiple, TestImages.Png.FrameOffset, TestImages.Png.DefaultNotAnimated - }; + ]; [Theory] [MemberData(nameof(PixelFormatRange))] @@ -140,7 +140,7 @@ public partial class PngDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(PngDecoder.Instance, options); @@ -178,7 +178,7 @@ public partial class PngDecoderTests DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(PngDecoder.Instance, options); @@ -206,6 +206,22 @@ public partial class PngDecoderTests image.CompareToOriginal(provider, ImageComparer.Exact); } + [Theory] + [WithFile(TestImages.Png.Icc.Perceptual, PixelTypes.Rgba32)] + [WithFile(TestImages.Png.Icc.PerceptualcLUTOnly, PixelTypes.Rgba32)] + [WithFile(TestImages.Png.Icc.SRgbGray, PixelTypes.Rgba32)] + [WithFile(TestImages.Png.Icc.SRgbGrayInterlacedRgba32, PixelTypes.Rgba32)] + [WithFile(TestImages.Png.Icc.SRgbGrayInterlacedRgba64, PixelTypes.Rgba32)] + public void Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(PngDecoder.Instance, new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert }); + + image.DebugSave(provider); + image.CompareToReferenceOutput(provider); + Assert.Null(image.Metadata.IccProfile); + } + [Theory] [WithFile(TestImages.Png.SubFilter3BytesPerPixel, PixelTypes.Rgba32)] [WithFile(TestImages.Png.SubFilter4BytesPerPixel, PixelTypes.Rgba32)] @@ -389,7 +405,7 @@ public partial class PngDecoderTests TestFile testFile = TestFile.Create(imagePath); using MemoryStream stream = new(testFile.Bytes, false); - ImageInfo imageInfo = Image.Identify(new DecoderOptions() { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData }, stream); + ImageInfo imageInfo = Image.Identify(new DecoderOptions { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData }, stream); Assert.NotNull(imageInfo); Assert.Equal(expectedPixelSize, imageInfo.PixelType.BitsPerPixel); @@ -674,7 +690,7 @@ public partial class PngDecoderTests public void Binary_PrematureEof() { PngDecoder decoder = PngDecoder.Instance; - PngDecoderOptions options = new() { GeneralOptions = new() { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData } }; + PngDecoderOptions options = new() { GeneralOptions = new DecoderOptions { SegmentIntegrityHandling = SegmentIntegrityHandling.IgnoreData } }; using EofHitCounter eofHitCounter = EofHitCounter.RunDecoder(TestImages.Png.Bad.FlagOfGermany0000016446, decoder, options); // TODO: Try to reduce this to 1. diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs index 796d35bf7..3a31b395f 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs @@ -31,7 +31,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } @@ -45,13 +45,13 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSSE3); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); } [Fact] @@ -59,7 +59,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } @@ -73,7 +73,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Average, Size); + TestData data = new(PngFilterMethod.Average, Size); data.TestFilter(); } @@ -87,7 +87,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Paeth, Size); + TestData data = new(PngFilterMethod.Paeth, Size); data.TestFilter(); } @@ -101,7 +101,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Paeth, Size); + TestData data = new(PngFilterMethod.Paeth, Size); data.TestFilter(); } @@ -115,7 +115,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Paeth, Size); + TestData data = new(PngFilterMethod.Paeth, Size); data.TestFilter(); } @@ -129,7 +129,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Up, Size); + TestData data = new(PngFilterMethod.Up, Size); data.TestFilter(); } @@ -143,7 +143,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Up, Size); + TestData data = new(PngFilterMethod.Up, Size); data.TestFilter(); } @@ -157,7 +157,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Up, Size); + TestData data = new(PngFilterMethod.Up, Size); data.TestFilter(); } @@ -171,7 +171,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Sub, Size); + TestData data = new(PngFilterMethod.Sub, Size); data.TestFilter(); } @@ -185,7 +185,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Sub, Size); + TestData data = new(PngFilterMethod.Sub, Size); data.TestFilter(); } @@ -199,7 +199,7 @@ public class PngEncoderFilterTests : MeasureFixture { static void RunTest() { - var data = new TestData(PngFilterMethod.Sub, Size); + TestData data = new(PngFilterMethod.Sub, Size); data.TestFilter(); } @@ -227,7 +227,7 @@ public class PngEncoderFilterTests : MeasureFixture this.expectedResult = new byte[1 + (size * size * bpp)]; this.resultBuffer = new byte[1 + (size * size * bpp)]; - var rng = new Random(12345678); + Random rng = new(12345678); byte[] tmp = new byte[6]; for (int i = 0; i < this.previousScanline.Length; i += bpp) { diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.Chunks.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.Chunks.cs index 76fd260dd..fdaa70e03 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.Chunks.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.Chunks.cs @@ -188,15 +188,15 @@ public partial class PngEncoderTests { PngChunkType.Data, false }, { PngChunkType.End, false } }; - List excludedChunkTypes = new() - { + List excludedChunkTypes = + [ PngChunkType.Gamma, PngChunkType.Exif, PngChunkType.Physical, PngChunkType.Text, PngChunkType.InternationalText, - PngChunkType.CompressedText, - }; + PngChunkType.CompressedText + ]; // act input.Save(memStream, encoder); @@ -252,7 +252,7 @@ public partial class PngEncoderTests { PngChunkType.Data, false }, { PngChunkType.End, false } }; - List excludedChunkTypes = new(); + List excludedChunkTypes = []; switch (chunkFilter) { case PngChunkFilter.ExcludeGammaChunk: @@ -326,8 +326,8 @@ public partial class PngEncoderTests using Image input = testFile.CreateRgba32Image(); using MemoryStream memStream = new(); PngEncoder encoder = new() { ChunkFilter = PngChunkFilter.None, TextCompressionThreshold = 8 }; - List expectedChunkTypes = new() - { + List expectedChunkTypes = + [ PngChunkType.Header, PngChunkType.Gamma, PngChunkType.EmbeddedColorProfile, @@ -338,8 +338,8 @@ public partial class PngEncoderTests PngChunkType.Exif, PngChunkType.Physical, PngChunkType.Data, - PngChunkType.End, - }; + PngChunkType.End + ]; // act input.Save(memStream, encoder); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index b0d0563cc..4ebcbc13b 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -88,11 +88,11 @@ public partial class PngEncoderTests 80, 100, 120, 230 }; - public static readonly PngInterlaceMode[] InterlaceMode = new[] - { + public static readonly PngInterlaceMode[] InterlaceMode = + [ PngInterlaceMode.None, PngInterlaceMode.Adam7 - }; + ]; public static readonly TheoryData RatioFiles = new() @@ -289,8 +289,8 @@ public partial class PngEncoderTests byte[] data = ms.ToArray().Take(8).ToArray(); byte[] expected = - { - 0x89, // Set the high bit. + [ + 0x89, // Set the high bit. 0x50, // P 0x4E, // N 0x47, // G @@ -298,7 +298,7 @@ public partial class PngEncoderTests 0x0A, // Line ending CRLF 0x1A, // EOF 0x0A // LF - }; + ]; Assert.Equal(expected, data); } @@ -618,7 +618,7 @@ public partial class PngEncoderTests FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.DisableSSSE3, + HwIntrinsics.DisableHWIntrinsic, provider); } @@ -680,7 +680,7 @@ public partial class PngEncoderTests PaletteQuantizer quantizer = new( palette.Select(Color.FromPixel).ToArray(), - new QuantizerOptions() { ColorMatchingMode = ColorMatchingMode.Hybrid }); + new QuantizerOptions { ColorMatchingMode = ColorMatchingMode.Hybrid }); using MemoryStream ms = new(); image.Save(ms, new PngEncoder diff --git a/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs index 8fde21654..efc18c16a 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngFrameMetadataTests.cs @@ -14,7 +14,7 @@ public class PngFrameMetadataTests { PngFrameMetadata meta = new() { - FrameDelay = new(1, 0), + FrameDelay = new Rational(1, 0), DisposalMode = FrameDisposalMode.RestoreToBackground, BlendMode = FrameBlendMode.Over, }; @@ -25,7 +25,7 @@ public class PngFrameMetadataTests Assert.True(meta.DisposalMode.Equals(clone.DisposalMode)); Assert.True(meta.BlendMode.Equals(clone.BlendMode)); - clone.FrameDelay = new(2, 1); + clone.FrameDelay = new Rational(2, 1); clone.DisposalMode = FrameDisposalMode.RestoreToPrevious; clone.BlendMode = FrameBlendMode.Source; diff --git a/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs index 225e4deef..42048426e 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngMetadataTests.cs @@ -6,6 +6,7 @@ using SixLabors.ImageSharp.Formats.Png; using SixLabors.ImageSharp.Formats.Png.Chunks; using SixLabors.ImageSharp.Metadata; using SixLabors.ImageSharp.Metadata.Profiles.Exif; +using SixLabors.ImageSharp.Metadata.Profiles.Iptc; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Tests.TestUtilities; @@ -31,16 +32,16 @@ public class PngMetadataTests ColorType = PngColorType.GrayscaleWithAlpha, InterlaceMethod = PngInterlaceMode.Adam7, Gamma = 2, - TextData = new List { new PngTextData("name", "value", "foo", "bar") }, + TextData = [new("name", "value", "foo", "bar")], RepeatCount = 123, AnimateRootFrame = false }; - PngMetadata clone = (PngMetadata)meta.DeepClone(); + PngMetadata clone = meta.DeepClone(); - Assert.True(meta.BitDepth == clone.BitDepth); - Assert.True(meta.ColorType == clone.ColorType); - Assert.True(meta.InterlaceMethod == clone.InterlaceMethod); + Assert.Equal(meta.BitDepth, clone.BitDepth); + Assert.Equal(meta.ColorType, clone.ColorType); + Assert.Equal(meta.InterlaceMethod, clone.InterlaceMethod); Assert.True(meta.Gamma.Equals(clone.Gamma)); Assert.False(meta.TextData.Equals(clone.TextData)); Assert.True(meta.TextData.SequenceEqual(clone.TextData)); @@ -53,15 +54,47 @@ public class PngMetadataTests clone.Gamma = 1; clone.RepeatCount = 321; - Assert.False(meta.BitDepth == clone.BitDepth); - Assert.False(meta.ColorType == clone.ColorType); - Assert.False(meta.InterlaceMethod == clone.InterlaceMethod); + Assert.NotEqual(meta.BitDepth, clone.BitDepth); + Assert.NotEqual(meta.ColorType, clone.ColorType); + Assert.NotEqual(meta.InterlaceMethod, clone.InterlaceMethod); Assert.False(meta.Gamma.Equals(clone.Gamma)); Assert.False(meta.TextData.Equals(clone.TextData)); Assert.True(meta.TextData.SequenceEqual(clone.TextData)); Assert.False(meta.RepeatCount == clone.RepeatCount); } + [Theory] + [WithFile(TestImages.Png.IptcMetadata, PixelTypes.Rgba32)] + public void Decoder_CanReadIptcProfile(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(PngDecoder.Instance); + Assert.NotNull(image.Metadata.IptcProfile); + Assert.Equal("test1, test2", image.Metadata.IptcProfile.GetValues(IptcTag.Keywords)[0].Value); + Assert.Equal("\0\u0004", image.Metadata.IptcProfile.GetValues(IptcTag.RecordVersion)[0].Value); + } + + [Theory] + [WithFile(TestImages.Png.IptcMetadata, PixelTypes.Rgba32)] + public void Encoder_CanWriteIptcProfile(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(PngDecoder.Instance); + Assert.NotNull(image.Metadata.IptcProfile); + Assert.Equal("test1, test2", image.Metadata.IptcProfile.GetValues(IptcTag.Keywords)[0].Value); + Assert.Equal("\0\u0004", image.Metadata.IptcProfile.GetValues(IptcTag.RecordVersion)[0].Value); + + using MemoryStream memoryStream = new(); + image.Save(memoryStream, new PngEncoder()); + + memoryStream.Position = 0; + + using Image decoded = PngDecoder.Instance.Decode(DecoderOptions.Default, memoryStream); + Assert.NotNull(decoded.Metadata.IptcProfile); + Assert.Equal("test1, test2", decoded.Metadata.IptcProfile.GetValues(IptcTag.Keywords)[0].Value); + Assert.Equal("\0\u0004", decoded.Metadata.IptcProfile.GetValues(IptcTag.RecordVersion)[0].Value); + } + [Theory] [WithFile(TestImages.Png.PngWithMetadata, PixelTypes.Rgba32)] public void Decoder_CanReadTextData(TestImageProvider provider) @@ -336,4 +369,28 @@ public class PngMetadataTests Assert.Equal(42, (int)exif.GetValue(ExifTag.ImageNumber).Value); } + + [Theory] + [InlineData(PixelColorType.Binary, PngColorType.Palette)] + [InlineData(PixelColorType.Indexed, PngColorType.Palette)] + [InlineData(PixelColorType.Luminance, PngColorType.Grayscale)] + [InlineData(PixelColorType.RGB, PngColorType.Rgb)] + [InlineData(PixelColorType.BGR, PngColorType.Rgb)] + [InlineData(PixelColorType.YCbCr, PngColorType.RgbWithAlpha)] + [InlineData(PixelColorType.CMYK, PngColorType.RgbWithAlpha)] + [InlineData(PixelColorType.YCCK, PngColorType.RgbWithAlpha)] + public void FromFormatConnectingMetadata_ConvertColorTypeAsExpected(PixelColorType pixelColorType, PngColorType expectedPngColorType) + { + FormatConnectingMetadata formatConnectingMetadata = new() + { + PixelTypeInfo = new PixelTypeInfo(24) + { + ColorType = pixelColorType, + }, + }; + + PngMetadata actual = PngMetadata.FromFormatConnectingMetadata(formatConnectingMetadata); + + Assert.Equal(expectedPngColorType, actual.ColorType); + } } diff --git a/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs index 878f3fb8d..4c46692f3 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngTextDataTests.cs @@ -17,8 +17,8 @@ public class PngTextDataTests [Fact] public void AreEqual() { - var property1 = new PngTextData("Foo", "Bar", "foo", "bar"); - var property2 = new PngTextData("Foo", "Bar", "foo", "bar"); + PngTextData property1 = new("Foo", "Bar", "foo", "bar"); + PngTextData property2 = new("Foo", "Bar", "foo", "bar"); Assert.Equal(property1, property2); Assert.True(property1 == property2); @@ -30,10 +30,10 @@ public class PngTextDataTests [Fact] public void AreNotEqual() { - var property1 = new PngTextData("Foo", "Bar", "foo", "bar"); - var property2 = new PngTextData("Foo", "Foo", string.Empty, string.Empty); - var property3 = new PngTextData("Bar", "Bar", "unit", "test"); - var property4 = new PngTextData("Foo", null, "test", "case"); + PngTextData property1 = new("Foo", "Bar", "foo", "bar"); + PngTextData property2 = new("Foo", "Foo", string.Empty, string.Empty); + PngTextData property3 = new("Bar", "Bar", "unit", "test"); + PngTextData property4 = new("Foo", null, "test", "case"); Assert.NotEqual(property1, property2); Assert.True(property1 != property2); @@ -59,7 +59,7 @@ public class PngTextDataTests [Fact] public void ConstructorAssignsProperties() { - var property = new PngTextData("Foo", null, "unit", "test"); + PngTextData property = new("Foo", null, "unit", "test"); Assert.Equal("Foo", property.Keyword); Assert.Null(property.Value); Assert.Equal("unit", property.LanguageTag); diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs index dbd7885e5..03669908e 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs @@ -749,7 +749,7 @@ public class TgaDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(TgaDecoder.Instance, options); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs index 4646de7f8..d19f27807 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/BigTiffMetadataTests.cs @@ -16,7 +16,7 @@ public class BigTiffMetadataTests [Fact] public void ExifLong8() { - var long8 = new ExifLong8(ExifTagValue.StripByteCounts); + ExifLong8 long8 = new(ExifTagValue.StripByteCounts); Assert.True(long8.TrySetValue(0)); Assert.Equal(0UL, long8.GetValue()); @@ -34,7 +34,7 @@ public class BigTiffMetadataTests [Fact] public void ExifSignedLong8() { - var long8 = new ExifSignedLong8(ExifTagValue.ImageID); + ExifSignedLong8 long8 = new(ExifTagValue.ImageID); Assert.False(long8.TrySetValue(0)); @@ -53,7 +53,7 @@ public class BigTiffMetadataTests [Fact] public void ExifLong8Array() { - var long8 = new ExifLong8Array(ExifTagValue.StripOffsets); + ExifLong8Array long8 = new(ExifTagValue.StripOffsets); Assert.True(long8.TrySetValue((short)-123)); Assert.Equal(new[] { 0UL }, long8.GetValue()); @@ -91,7 +91,7 @@ public class BigTiffMetadataTests [Fact] public void ExifSignedLong8Array() { - var long8 = new ExifSignedLong8Array(ExifTagValue.StripOffsets); + ExifSignedLong8Array long8 = new(ExifTagValue.StripOffsets); Assert.True(long8.TrySetValue(new[] { 0L })); Assert.Equal(new[] { 0L }, long8.GetValue()); @@ -105,9 +105,9 @@ public class BigTiffMetadataTests [Fact] public void NotCoveredTags() { - using var input = new Image(10, 10); + using Image input = new(10, 10); - var testTags = new Dictionary + Dictionary testTags = new() { { new ExifTag((ExifTagValue)0xdd01), (ExifDataType.SingleFloat, new float[] { 1.2f, 2.3f, 4.5f }) }, { new ExifTag((ExifTagValue)0xdd02), (ExifDataType.SingleFloat, 2.345f) }, @@ -122,7 +122,7 @@ public class BigTiffMetadataTests }; // arrange - var values = new List(); + List values = new(); foreach (KeyValuePair tag in testTags) { ExifValue newExifValue = ExifValues.Create((ExifTagValue)(ushort)tag.Key, tag.Value.DataType, tag.Value.Value is Array); @@ -134,13 +134,13 @@ public class BigTiffMetadataTests input.Frames.RootFrame.Metadata.ExifProfile = new ExifProfile(values, Array.Empty()); // act - var encoder = new TiffEncoder(); - using var memStream = new MemoryStream(); + TiffEncoder encoder = new(); + using MemoryStream memStream = new(); input.Save(memStream, encoder); // assert memStream.Position = 0; - using var output = Image.Load(memStream); + using Image output = Image.Load(memStream); ImageFrameMetadata loadedFrameMetadata = output.Frames.RootFrame.Metadata; foreach (KeyValuePair tag in testTags) { @@ -158,7 +158,7 @@ public class BigTiffMetadataTests [Fact] public void NotCoveredTags64bit() { - var testTags = new Dictionary + Dictionary testTags = new() { { new ExifTag((ExifTagValue)0xdd11), (ExifDataType.Long8, ulong.MaxValue) }, { new ExifTag((ExifTagValue)0xdd12), (ExifDataType.SignedLong8, long.MaxValue) }, @@ -167,7 +167,7 @@ public class BigTiffMetadataTests ////{ new ExifTag((ExifTagValue)0xdd14), (ExifDataType.SignedLong8, new long[] { -1234, 56789L, long.MaxValue }) }, }; - var values = new List(); + List values = new(); foreach (KeyValuePair tag in testTags) { ExifValue newExifValue = ExifValues.Create((ExifTagValue)(ushort)tag.Key, tag.Value.DataType, tag.Value.Value is Array); @@ -179,7 +179,7 @@ public class BigTiffMetadataTests // act byte[] inputBytes = WriteIfdTags64Bit(values); Configuration config = Configuration.Default; - var reader = new EntryReader( + EntryReader reader = new( new MemoryStream(inputBytes), BitConverter.IsLittleEndian ? ByteOrder.LittleEndian : ByteOrder.BigEndian, config.MemoryAllocator); @@ -205,8 +205,8 @@ public class BigTiffMetadataTests private static byte[] WriteIfdTags64Bit(List values) { byte[] buffer = new byte[8]; - var ms = new MemoryStream(); - var writer = new TiffStreamWriter(ms); + MemoryStream ms = new(); + TiffStreamWriter writer = new(ms); WriteLong8(writer, buffer, (ulong)values.Count); foreach (IExifValue entry in values) diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs index b16119f33..cc2faeab7 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/DeflateTiffCompressionTests.cs @@ -23,7 +23,7 @@ public class DeflateTiffCompressionTests using BufferedReadStream stream = CreateCompressedStream(data); byte[] buffer = new byte[data.Length]; - using var decompressor = new DeflateTiffCompression(Configuration.Default.MemoryAllocator, 10, 8, TiffColorType.BlackIsZero8, TiffPredictor.None, false, false, 0, 0); + using DeflateTiffCompression decompressor = new(Configuration.Default.MemoryAllocator, 10, 8, TiffColorType.BlackIsZero8, TiffPredictor.None, false, false, 0, 0); decompressor.Decompress(stream, 0, (uint)stream.Length, 1, buffer, default); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs index 8c21e346a..25c9633c1 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/LzwTiffCompressionTests.cs @@ -37,7 +37,7 @@ public class LzwTiffCompressionTests using BufferedReadStream stream = CreateCompressedStream(data); byte[] buffer = new byte[data.Length]; - using var decompressor = new LzwTiffCompression(Configuration.Default.MemoryAllocator, 10, 8, TiffColorType.BlackIsZero8, TiffPredictor.None, false, false, 0, 0); + using LzwTiffCompression decompressor = new(Configuration.Default.MemoryAllocator, 10, 8, TiffColorType.BlackIsZero8, TiffPredictor.None, false, false, 0, 0); decompressor.Decompress(stream, 0, (uint)stream.Length, 1, buffer, default); Assert.Equal(data, buffer); @@ -47,7 +47,7 @@ public class LzwTiffCompressionTests { Stream compressedStream = new MemoryStream(); - using (var encoder = new TiffLzwEncoder(Configuration.Default.MemoryAllocator)) + using (TiffLzwEncoder encoder = new(Configuration.Default.MemoryAllocator)) { encoder.Encode(inputData, compressedStream); } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs index e79ed7ce7..b911d1b17 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/NoneTiffCompressionTests.cs @@ -14,11 +14,11 @@ public class NoneTiffCompressionTests [InlineData(new byte[] { 10, 15, 20, 25, 30, 35, 40, 45 }, 5, new byte[] { 10, 15, 20, 25, 30 })] public void Decompress_ReadsData(byte[] inputData, uint byteCount, byte[] expectedResult) { - using var memoryStream = new MemoryStream(inputData); - using var stream = new BufferedReadStream(Configuration.Default, memoryStream); + using MemoryStream memoryStream = new(inputData); + using BufferedReadStream stream = new(Configuration.Default, memoryStream); byte[] buffer = new byte[expectedResult.Length]; - using var decompressor = new NoneTiffCompression(default, default, default); + using NoneTiffCompression decompressor = new(default, default, default); decompressor.Decompress(stream, 0, byteCount, 1, buffer, default); Assert.Equal(expectedResult, buffer); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs index c91ab0e7f..8f71cdda7 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Compression/PackBitsTiffCompressionTests.cs @@ -22,11 +22,11 @@ public class PackBitsTiffCompressionTests [InlineData(new byte[] { 0xFE, 0xAA, 0x02, 0x80, 0x00, 0x2A, 0xFD, 0xAA, 0x03, 0x80, 0x00, 0x2A, 0x22, 0xF7, 0xAA }, new byte[] { 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0xAA, 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0x22, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA })] // Apple PackBits sample public void Decompress_ReadsData(byte[] inputData, byte[] expectedResult) { - using var memoryStream = new MemoryStream(inputData); - using var stream = new BufferedReadStream(Configuration.Default, memoryStream); + using MemoryStream memoryStream = new(inputData); + using BufferedReadStream stream = new(Configuration.Default, memoryStream); byte[] buffer = new byte[expectedResult.Length]; - using var decompressor = new PackBitsTiffCompression(MemoryAllocator.Create(), default, default); + using PackBitsTiffCompression decompressor = new(MemoryAllocator.Create(), default, default); decompressor.Decompress(stream, 0, (uint)inputData.Length, 1, buffer, default); Assert.Equal(expectedResult, buffer); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs index 0fa7e01e8..54c8172b8 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColorTests.cs @@ -20,100 +20,100 @@ public class BlackIsZeroTiffColorTests : PhotometricInterpretationTestBase private static readonly Rgba32 Bit1 = new(255, 255, 255, 255); private static readonly byte[] BilevelBytes4X4 = - { + [ 0b01010000, 0b11110000, 0b01110000, 0b10010000 - }; + ]; private static readonly Rgba32[][] BilevelResult4X4 = - { - new[] { Bit0, Bit1, Bit0, Bit1 }, - new[] { Bit1, Bit1, Bit1, Bit1 }, - new[] { Bit0, Bit1, Bit1, Bit1 }, - new[] { Bit1, Bit0, Bit0, Bit1 } - }; + [ + [Bit0, Bit1, Bit0, Bit1], + [Bit1, Bit1, Bit1, Bit1], + [Bit0, Bit1, Bit1, Bit1], + [Bit1, Bit0, Bit0, Bit1] + ]; private static readonly byte[] BilevelBytes12X4 = - { + [ 0b01010101, 0b01010000, 0b11111111, 0b11111111, 0b01101001, 0b10100000, 0b10010000, 0b01100000 - }; + ]; private static readonly Rgba32[][] BilevelResult12X4 = - { - new[] { Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1 }, - new[] { Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1 }, - new[] { Bit0, Bit1, Bit1, Bit0, Bit1, Bit0, Bit0, Bit1, Bit1, Bit0, Bit1, Bit0 }, - new[] { Bit1, Bit0, Bit0, Bit1, Bit0, Bit0, Bit0, Bit0, Bit0, Bit1, Bit1, Bit0 } - }; + [ + [Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1], + [Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1], + [Bit0, Bit1, Bit1, Bit0, Bit1, Bit0, Bit0, Bit1, Bit1, Bit0, Bit1, Bit0], + [Bit1, Bit0, Bit0, Bit1, Bit0, Bit0, Bit0, Bit0, Bit0, Bit1, Bit1, Bit0] + ]; private static readonly byte[] Grayscale4Bytes4X4 = - { + [ 0x8F, 0x0F, 0xFF, 0xFF, 0x08, 0x8F, 0xF0, 0xF8 - }; + ]; private static readonly Rgba32[][] Grayscale4Result4X4 = - { - new[] { Gray8, GrayF, Gray0, GrayF }, - new[] { GrayF, GrayF, GrayF, GrayF }, - new[] { Gray0, Gray8, Gray8, GrayF }, - new[] { GrayF, Gray0, GrayF, Gray8 } - }; + [ + [Gray8, GrayF, Gray0, GrayF], + [GrayF, GrayF, GrayF, GrayF], + [Gray0, Gray8, Gray8, GrayF], + [GrayF, Gray0, GrayF, Gray8] + ]; private static readonly byte[] Grayscale4Bytes3X4 = - { + [ 0x8F, 0x00, 0xFF, 0xF0, 0x08, 0x80, 0xF0, 0xF0 - }; + ]; private static readonly Rgba32[][] Grayscale4Result3X4 = - { - new[] { Gray8, GrayF, Gray0 }, - new[] { GrayF, GrayF, GrayF }, - new[] { Gray0, Gray8, Gray8 }, - new[] { GrayF, Gray0, GrayF } - }; + [ + [Gray8, GrayF, Gray0], + [GrayF, GrayF, GrayF], + [Gray0, Gray8, Gray8], + [GrayF, Gray0, GrayF] + ]; private static readonly byte[] Grayscale8Bytes4X4 = - { + [ 128, 255, 000, 255, 255, 255, 255, 255, 000, 128, 128, 255, 255, 000, 255, 128 - }; + ]; private static readonly Rgba32[][] Grayscale8Result4X4 = - { - new[] { Gray128, Gray255, Gray000, Gray255 }, - new[] { Gray255, Gray255, Gray255, Gray255 }, - new[] { Gray000, Gray128, Gray128, Gray255 }, - new[] { Gray255, Gray000, Gray255, Gray128 } - }; + [ + [Gray128, Gray255, Gray000, Gray255], + [Gray255, Gray255, Gray255, Gray255], + [Gray000, Gray128, Gray128, Gray255], + [Gray255, Gray000, Gray255, Gray128] + ]; public static IEnumerable BilevelData { get { - yield return new object[] { BilevelBytes4X4, 1, 0, 0, 4, 4, BilevelResult4X4 }; - yield return new object[] { BilevelBytes4X4, 1, 0, 0, 4, 4, Offset(BilevelResult4X4, 0, 0, 6, 6) }; - yield return new object[] { BilevelBytes4X4, 1, 1, 0, 4, 4, Offset(BilevelResult4X4, 1, 0, 6, 6) }; - yield return new object[] { BilevelBytes4X4, 1, 0, 1, 4, 4, Offset(BilevelResult4X4, 0, 1, 6, 6) }; - yield return new object[] { BilevelBytes4X4, 1, 1, 1, 4, 4, Offset(BilevelResult4X4, 1, 1, 6, 6) }; - - yield return new object[] { BilevelBytes12X4, 1, 0, 0, 12, 4, BilevelResult12X4 }; - yield return new object[] { BilevelBytes12X4, 1, 0, 0, 12, 4, Offset(BilevelResult12X4, 0, 0, 18, 6) }; - yield return new object[] { BilevelBytes12X4, 1, 1, 0, 12, 4, Offset(BilevelResult12X4, 1, 0, 18, 6) }; - yield return new object[] { BilevelBytes12X4, 1, 0, 1, 12, 4, Offset(BilevelResult12X4, 0, 1, 18, 6) }; - yield return new object[] { BilevelBytes12X4, 1, 1, 1, 12, 4, Offset(BilevelResult12X4, 1, 1, 18, 6) }; + yield return [BilevelBytes4X4, 1, 0, 0, 4, 4, BilevelResult4X4]; + yield return [BilevelBytes4X4, 1, 0, 0, 4, 4, Offset(BilevelResult4X4, 0, 0, 6, 6)]; + yield return [BilevelBytes4X4, 1, 1, 0, 4, 4, Offset(BilevelResult4X4, 1, 0, 6, 6)]; + yield return [BilevelBytes4X4, 1, 0, 1, 4, 4, Offset(BilevelResult4X4, 0, 1, 6, 6)]; + yield return [BilevelBytes4X4, 1, 1, 1, 4, 4, Offset(BilevelResult4X4, 1, 1, 6, 6)]; + + yield return [BilevelBytes12X4, 1, 0, 0, 12, 4, BilevelResult12X4]; + yield return [BilevelBytes12X4, 1, 0, 0, 12, 4, Offset(BilevelResult12X4, 0, 0, 18, 6)]; + yield return [BilevelBytes12X4, 1, 1, 0, 12, 4, Offset(BilevelResult12X4, 1, 0, 18, 6)]; + yield return [BilevelBytes12X4, 1, 0, 1, 12, 4, Offset(BilevelResult12X4, 0, 1, 18, 6)]; + yield return [BilevelBytes12X4, 1, 1, 1, 12, 4, Offset(BilevelResult12X4, 1, 1, 18, 6)]; } } @@ -121,17 +121,17 @@ public class BlackIsZeroTiffColorTests : PhotometricInterpretationTestBase { get { - yield return new object[] { Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Grayscale4Result4X4 }; - yield return new object[] { Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Offset(Grayscale4Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes4X4, 4, 1, 0, 4, 4, Offset(Grayscale4Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes4X4, 4, 0, 1, 4, 4, Offset(Grayscale4Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Grayscale4Bytes4X4, 4, 1, 1, 4, 4, Offset(Grayscale4Result4X4, 1, 1, 6, 6) }; - - yield return new object[] { Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Grayscale4Result3X4 }; - yield return new object[] { Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Offset(Grayscale4Result3X4, 0, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes3X4, 4, 1, 0, 3, 4, Offset(Grayscale4Result3X4, 1, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes3X4, 4, 0, 1, 3, 4, Offset(Grayscale4Result3X4, 0, 1, 6, 6) }; - yield return new object[] { Grayscale4Bytes3X4, 4, 1, 1, 3, 4, Offset(Grayscale4Result3X4, 1, 1, 6, 6) }; + yield return [Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Grayscale4Result4X4]; + yield return [Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Offset(Grayscale4Result4X4, 0, 0, 6, 6)]; + yield return [Grayscale4Bytes4X4, 4, 1, 0, 4, 4, Offset(Grayscale4Result4X4, 1, 0, 6, 6)]; + yield return [Grayscale4Bytes4X4, 4, 0, 1, 4, 4, Offset(Grayscale4Result4X4, 0, 1, 6, 6)]; + yield return [Grayscale4Bytes4X4, 4, 1, 1, 4, 4, Offset(Grayscale4Result4X4, 1, 1, 6, 6)]; + + yield return [Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Grayscale4Result3X4]; + yield return [Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Offset(Grayscale4Result3X4, 0, 0, 6, 6)]; + yield return [Grayscale4Bytes3X4, 4, 1, 0, 3, 4, Offset(Grayscale4Result3X4, 1, 0, 6, 6)]; + yield return [Grayscale4Bytes3X4, 4, 0, 1, 3, 4, Offset(Grayscale4Result3X4, 0, 1, 6, 6)]; + yield return [Grayscale4Bytes3X4, 4, 1, 1, 3, 4, Offset(Grayscale4Result3X4, 1, 1, 6, 6)]; } } @@ -139,11 +139,11 @@ public class BlackIsZeroTiffColorTests : PhotometricInterpretationTestBase { get { - yield return new object[] { Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Grayscale8Result4X4 }; - yield return new object[] { Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Offset(Grayscale8Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Grayscale8Bytes4X4, 8, 1, 0, 4, 4, Offset(Grayscale8Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Grayscale8Bytes4X4, 8, 0, 1, 4, 4, Offset(Grayscale8Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Grayscale8Bytes4X4, 8, 1, 1, 4, 4, Offset(Grayscale8Result4X4, 1, 1, 6, 6) }; + yield return [Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Grayscale8Result4X4]; + yield return [Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Offset(Grayscale8Result4X4, 0, 0, 6, 6)]; + yield return [Grayscale8Bytes4X4, 8, 1, 0, 4, 4, Offset(Grayscale8Result4X4, 1, 0, 6, 6)]; + yield return [Grayscale8Bytes4X4, 8, 0, 1, 4, 4, Offset(Grayscale8Result4X4, 0, 1, 6, 6)]; + yield return [Grayscale8Bytes4X4, 8, 1, 1, 4, 4, Offset(Grayscale8Result4X4, 1, 1, 6, 6)]; } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs index c809c6c7f..dbfa00950 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PaletteTiffColorTests.cs @@ -15,39 +15,43 @@ public class PaletteTiffColorTests : PhotometricInterpretationTestBase public static ushort[] Palette4ColorMap => GenerateColorMap(Palette4ColorPalette); private static readonly byte[] Palette4Bytes4X4 = - { + [ 0x01, 0x23, 0x4A, 0xD2, 0x12, 0x34, 0xAB, 0xEF - }; + ]; private static readonly Rgba32[][] Palette4Result4X4 = GenerateResult( Palette4ColorPalette, - new[] { new[] { 0x00, 0x01, 0x02, 0x03 }, new[] { 0x04, 0x0A, 0x0D, 0x02 }, new[] { 0x01, 0x02, 0x03, 0x04 }, new[] { 0x0A, 0x0B, 0x0E, 0x0F } }); + [ + [0x00, 0x01, 0x02, 0x03], [0x04, 0x0A, 0x0D, 0x02], [0x01, 0x02, 0x03, 0x04], [0x0A, 0x0B, 0x0E, 0x0F] + ]); private static readonly byte[] Palette4Bytes3X4 = - { + [ 0x01, 0x20, 0x4A, 0xD0, 0x12, 0x30, 0xAB, 0xE0 - }; + ]; - private static readonly Rgba32[][] Palette4Result3X4 = GenerateResult(Palette4ColorPalette, new[] { new[] { 0x00, 0x01, 0x02 }, new[] { 0x04, 0x0A, 0x0D }, new[] { 0x01, 0x02, 0x03 }, new[] { 0x0A, 0x0B, 0x0E } }); + private static readonly Rgba32[][] Palette4Result3X4 = GenerateResult(Palette4ColorPalette, [ + [0x00, 0x01, 0x02], [0x04, 0x0A, 0x0D], [0x01, 0x02, 0x03], [0x0A, 0x0B, 0x0E] + ]); public static IEnumerable Palette4Data { get { - yield return new object[] { Palette4Bytes4X4, 4, Palette4ColorMap, 0, 0, 4, 4, Palette4Result4X4 }; - yield return new object[] { Palette4Bytes4X4, 4, Palette4ColorMap, 0, 0, 4, 4, Offset(Palette4Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Palette4Bytes4X4, 4, Palette4ColorMap, 1, 0, 4, 4, Offset(Palette4Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Palette4Bytes4X4, 4, Palette4ColorMap, 0, 1, 4, 4, Offset(Palette4Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Palette4Bytes4X4, 4, Palette4ColorMap, 1, 1, 4, 4, Offset(Palette4Result4X4, 1, 1, 6, 6) }; - - yield return new object[] { Palette4Bytes3X4, 4, Palette4ColorMap, 0, 0, 3, 4, Palette4Result3X4 }; - yield return new object[] { Palette4Bytes3X4, 4, Palette4ColorMap, 0, 0, 3, 4, Offset(Palette4Result3X4, 0, 0, 6, 6) }; - yield return new object[] { Palette4Bytes3X4, 4, Palette4ColorMap, 1, 0, 3, 4, Offset(Palette4Result3X4, 1, 0, 6, 6) }; - yield return new object[] { Palette4Bytes3X4, 4, Palette4ColorMap, 0, 1, 3, 4, Offset(Palette4Result3X4, 0, 1, 6, 6) }; - yield return new object[] { Palette4Bytes3X4, 4, Palette4ColorMap, 1, 1, 3, 4, Offset(Palette4Result3X4, 1, 1, 6, 6) }; + yield return [Palette4Bytes4X4, 4, Palette4ColorMap, 0, 0, 4, 4, Palette4Result4X4]; + yield return [Palette4Bytes4X4, 4, Palette4ColorMap, 0, 0, 4, 4, Offset(Palette4Result4X4, 0, 0, 6, 6)]; + yield return [Palette4Bytes4X4, 4, Palette4ColorMap, 1, 0, 4, 4, Offset(Palette4Result4X4, 1, 0, 6, 6)]; + yield return [Palette4Bytes4X4, 4, Palette4ColorMap, 0, 1, 4, 4, Offset(Palette4Result4X4, 0, 1, 6, 6)]; + yield return [Palette4Bytes4X4, 4, Palette4ColorMap, 1, 1, 4, 4, Offset(Palette4Result4X4, 1, 1, 6, 6)]; + + yield return [Palette4Bytes3X4, 4, Palette4ColorMap, 0, 0, 3, 4, Palette4Result3X4]; + yield return [Palette4Bytes3X4, 4, Palette4ColorMap, 0, 0, 3, 4, Offset(Palette4Result3X4, 0, 0, 6, 6)]; + yield return [Palette4Bytes3X4, 4, Palette4ColorMap, 1, 0, 3, 4, Offset(Palette4Result3X4, 1, 0, 6, 6)]; + yield return [Palette4Bytes3X4, 4, Palette4ColorMap, 0, 1, 3, 4, Offset(Palette4Result3X4, 0, 1, 6, 6)]; + yield return [Palette4Bytes3X4, 4, Palette4ColorMap, 1, 1, 3, 4, Offset(Palette4Result3X4, 1, 1, 6, 6)]; } } @@ -56,24 +60,26 @@ public class PaletteTiffColorTests : PhotometricInterpretationTestBase public static ushort[] Palette8ColorMap => GenerateColorMap(Palette8ColorPalette); private static readonly byte[] Palette8Bytes4X4 = - { + [ 000, 001, 002, 003, 100, 110, 120, 130, 000, 255, 128, 255, 050, 100, 150, 200 - }; + ]; - private static readonly Rgba32[][] Palette8Result4X4 = GenerateResult(Palette8ColorPalette, new[] { new[] { 000, 001, 002, 003 }, new[] { 100, 110, 120, 130 }, new[] { 000, 255, 128, 255 }, new[] { 050, 100, 150, 200 } }); + private static readonly Rgba32[][] Palette8Result4X4 = GenerateResult(Palette8ColorPalette, [ + [000, 001, 002, 003], [100, 110, 120, 130], [000, 255, 128, 255], [050, 100, 150, 200] + ]); public static IEnumerable Palette8Data { get { - yield return new object[] { Palette8Bytes4X4, 8, Palette8ColorMap, 0, 0, 4, 4, Palette8Result4X4 }; - yield return new object[] { Palette8Bytes4X4, 8, Palette8ColorMap, 0, 0, 4, 4, Offset(Palette8Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Palette8Bytes4X4, 8, Palette8ColorMap, 1, 0, 4, 4, Offset(Palette8Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Palette8Bytes4X4, 8, Palette8ColorMap, 0, 1, 4, 4, Offset(Palette8Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Palette8Bytes4X4, 8, Palette8ColorMap, 1, 1, 4, 4, Offset(Palette8Result4X4, 1, 1, 6, 6) }; + yield return [Palette8Bytes4X4, 8, Palette8ColorMap, 0, 0, 4, 4, Palette8Result4X4]; + yield return [Palette8Bytes4X4, 8, Palette8ColorMap, 0, 0, 4, 4, Offset(Palette8Result4X4, 0, 0, 6, 6)]; + yield return [Palette8Bytes4X4, 8, Palette8ColorMap, 1, 0, 4, 4, Offset(Palette8Result4X4, 1, 0, 6, 6)]; + yield return [Palette8Bytes4X4, 8, Palette8ColorMap, 0, 1, 4, 4, Offset(Palette8Result4X4, 0, 1, 6, 6)]; + yield return [Palette8Bytes4X4, 8, Palette8ColorMap, 1, 1, 4, 4, Offset(Palette8Result4X4, 1, 1, 6, 6)]; } } @@ -83,16 +89,20 @@ public class PaletteTiffColorTests : PhotometricInterpretationTestBase public void Decode_WritesPixelData(byte[] inputData, ushort bitsPerSample, ushort[] colorMap, int left, int top, int width, int height, Rgba32[][] expectedResult) => AssertDecode(expectedResult, pixels => { - new PaletteTiffColor(new TiffBitsPerSample(bitsPerSample, 0, 0), colorMap).Decode(inputData, pixels, left, top, width, height); + new PaletteTiffColor( + new TiffBitsPerSample(bitsPerSample, 0, 0), + colorMap, + TiffExtraSampleType.UnspecifiedData) + .Decode(inputData, pixels, left, top, width, height); }); private static uint[][] GeneratePalette(int count) { - var palette = new uint[count][]; + uint[][] palette = new uint[count][]; for (uint i = 0; i < count; i++) { - palette[i] = new[] { (i * 2u) % 65536u, (i * 2625u) % 65536u, (i * 29401u) % 65536u }; + palette[i] = [(i * 2u) % 65536u, (i * 2625u) % 65536u, (i * 29401u) % 65536u]; } return palette; @@ -101,7 +111,7 @@ public class PaletteTiffColorTests : PhotometricInterpretationTestBase private static ushort[] GenerateColorMap(uint[][] colorPalette) { int colorCount = colorPalette.Length; - var colorMap = new ushort[colorCount * 3]; + ushort[] colorMap = new ushort[colorCount * 3]; for (int i = 0; i < colorCount; i++) { @@ -115,7 +125,7 @@ public class PaletteTiffColorTests : PhotometricInterpretationTestBase private static Rgba32[][] GenerateResult(uint[][] colorPalette, int[][] pixelLookup) { - var result = new Rgba32[pixelLookup.Length][]; + Rgba32[][] result = new Rgba32[pixelLookup.Length][]; for (int y = 0; y < pixelLookup.Length; y++) { diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs index 3582dc75a..7040e167d 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs @@ -10,14 +10,14 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation; [Trait("Format", "Tiff")] public abstract class PhotometricInterpretationTestBase { - public static Rgba32 DefaultColor = new Rgba32(42, 96, 18, 128); + public static Rgba32 DefaultColor = new(42, 96, 18, 128); public static Rgba32[][] Offset(Rgba32[][] input, int xOffset, int yOffset, int width, int height) { int inputHeight = input.Length; int inputWidth = input[0].Length; - var output = new Rgba32[height][]; + Rgba32[][] output = new Rgba32[height][]; for (int y = 0; y < output.Length; y++) { @@ -45,7 +45,7 @@ public abstract class PhotometricInterpretationTestBase int resultWidth = expectedResult[0].Length; int resultHeight = expectedResult.Length; - using (var image = new Image(resultWidth, resultHeight)) + using (Image image = new(resultWidth, resultHeight)) { image.Mutate(x => x.BackgroundColor(Color.FromPixel(DefaultColor))); Buffer2D pixels = image.GetRootFramePixelBuffer(); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs index d8249c361..5df7c4d62 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColorTests.cs @@ -12,226 +12,230 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation; [Trait("Format", "Tiff")] public class RgbPlanarTiffColorTests : PhotometricInterpretationTestBase { - private static readonly Rgba32 Rgb4_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb4_444 = new Rgba32(68, 68, 68, 255); - private static readonly Rgba32 Rgb4_888 = new Rgba32(136, 136, 136, 255); - private static readonly Rgba32 Rgb4_CCC = new Rgba32(204, 204, 204, 255); - private static readonly Rgba32 Rgb4_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb4_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb4_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb4_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb4_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb4_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb4_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb4_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb4_48C = new Rgba32(68, 136, 204, 255); + private static readonly Rgba32 Rgb4_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb4_444 = new(68, 68, 68, 255); + private static readonly Rgba32 Rgb4_888 = new(136, 136, 136, 255); + private static readonly Rgba32 Rgb4_CCC = new(204, 204, 204, 255); + private static readonly Rgba32 Rgb4_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb4_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb4_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb4_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb4_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb4_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb4_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb4_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb4_48C = new(68, 136, 204, 255); private static readonly byte[] Rgb4Bytes4X4R = - { + [ 0x0F, 0x0F, 0xF0, 0x0F, 0x48, 0xC4, 0x04, 0x8C - }; + ]; private static readonly byte[] Rgb4Bytes4X4G = - { + [ 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x08, 0x04, 0x8C - }; + ]; private static readonly byte[] Rgb4Bytes4X4B = - { + [ 0x0F, 0x0F, 0x00, 0xFF, 0x00, 0x0C, 0x04, 0x8C - }; + ]; - private static readonly byte[][] Rgb4Bytes4X4 = { Rgb4Bytes4X4R, Rgb4Bytes4X4G, Rgb4Bytes4X4B }; + private static readonly byte[][] Rgb4Bytes4X4 = [Rgb4Bytes4X4R, Rgb4Bytes4X4G, Rgb4Bytes4X4B]; private static readonly Rgba32[][] Rgb4Result4X4 = - { - new[] { Rgb4_000, Rgb4_FFF, Rgb4_000, Rgb4_FFF }, - new[] { Rgb4_F00, Rgb4_0F0, Rgb4_00F, Rgb4_F0F }, - new[] { Rgb4_400, Rgb4_800, Rgb4_C00, Rgb4_48C }, - new[] { Rgb4_000, Rgb4_444, Rgb4_888, Rgb4_CCC } - }; + [ + [Rgb4_000, Rgb4_FFF, Rgb4_000, Rgb4_FFF], + [Rgb4_F00, Rgb4_0F0, Rgb4_00F, Rgb4_F0F], + [Rgb4_400, Rgb4_800, Rgb4_C00, Rgb4_48C], + [Rgb4_000, Rgb4_444, Rgb4_888, Rgb4_CCC] + ]; private static readonly byte[] Rgb4Bytes3X4R = - { + [ 0x0F, 0x00, 0xF0, 0x00, 0x48, 0xC0, 0x04, 0x80 - }; + ]; private static readonly byte[] Rgb4Bytes3X4G = - { + [ 0x0F, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x04, 0x80 - }; + ]; private static readonly byte[] Rgb4Bytes3X4B = - { + [ 0x0F, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x04, 0x80 - }; + ]; - private static readonly byte[][] Rgb4Bytes3X4 = { Rgb4Bytes3X4R, Rgb4Bytes3X4G, Rgb4Bytes3X4B }; + private static readonly byte[][] Rgb4Bytes3X4 = [Rgb4Bytes3X4R, Rgb4Bytes3X4G, Rgb4Bytes3X4B]; private static readonly Rgba32[][] Rgb4Result3X4 = - { - new[] { Rgb4_000, Rgb4_FFF, Rgb4_000 }, - new[] { Rgb4_F00, Rgb4_0F0, Rgb4_00F }, - new[] { Rgb4_400, Rgb4_800, Rgb4_C00 }, - new[] { Rgb4_000, Rgb4_444, Rgb4_888 } - }; + [ + [Rgb4_000, Rgb4_FFF, Rgb4_000], + [Rgb4_F00, Rgb4_0F0, Rgb4_00F], + [Rgb4_400, Rgb4_800, Rgb4_C00], + [Rgb4_000, Rgb4_444, Rgb4_888] + ]; public static IEnumerable Rgb4Data { get { - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Rgb4Result4X4 }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Offset(Rgb4Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 4, 4, Offset(Rgb4Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 4, 4, Offset(Rgb4Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 4, 4, Offset(Rgb4Result4X4, 1, 1, 6, 6) }; - - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Rgb4Result3X4 }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Offset(Rgb4Result3X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 3, 4, Offset(Rgb4Result3X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 3, 4, Offset(Rgb4Result3X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 3, 4, Offset(Rgb4Result3X4, 1, 1, 6, 6) }; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Rgb4Result4X4]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Offset(Rgb4Result4X4, 0, 0, 6, 6)]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 4, 4, Offset(Rgb4Result4X4, 1, 0, 6, 6)]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 4, 4, Offset(Rgb4Result4X4, 0, 1, 6, 6)]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 4, 4, Offset(Rgb4Result4X4, 1, 1, 6, 6)]; + + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Rgb4Result3X4]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Offset(Rgb4Result3X4, 0, 0, 6, 6)]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 3, 4, Offset(Rgb4Result3X4, 1, 0, 6, 6)]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 3, 4, Offset(Rgb4Result3X4, 0, 1, 6, 6)]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 3, 4, Offset(Rgb4Result3X4, 1, 1, 6, 6)]; } } - private static readonly Rgba32 Rgb8_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb8_444 = new Rgba32(64, 64, 64, 255); - private static readonly Rgba32 Rgb8_888 = new Rgba32(128, 128, 128, 255); - private static readonly Rgba32 Rgb8_CCC = new Rgba32(192, 192, 192, 255); - private static readonly Rgba32 Rgb8_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb8_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb8_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb8_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb8_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb8_400 = new Rgba32(64, 0, 0, 255); - private static readonly Rgba32 Rgb8_800 = new Rgba32(128, 0, 0, 255); - private static readonly Rgba32 Rgb8_C00 = new Rgba32(192, 0, 0, 255); - private static readonly Rgba32 Rgb8_48C = new Rgba32(64, 128, 192, 255); + private static readonly Rgba32 Rgb8_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb8_444 = new(64, 64, 64, 255); + private static readonly Rgba32 Rgb8_888 = new(128, 128, 128, 255); + private static readonly Rgba32 Rgb8_CCC = new(192, 192, 192, 255); + private static readonly Rgba32 Rgb8_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb8_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb8_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb8_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb8_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb8_400 = new(64, 0, 0, 255); + private static readonly Rgba32 Rgb8_800 = new(128, 0, 0, 255); + private static readonly Rgba32 Rgb8_C00 = new(192, 0, 0, 255); + private static readonly Rgba32 Rgb8_48C = new(64, 128, 192, 255); private static readonly byte[] Rgb8Bytes4X4R = - { + [ 000, 255, 000, 255, 255, 000, 000, 255, 064, 128, 192, 064, 000, 064, 128, 192 - }; + ]; private static readonly byte[] Rgb8Bytes4X4G = - { + [ 000, 255, 000, 255, 000, 255, 000, 000, 000, 000, 000, 128, 000, 064, 128, 192 - }; + ]; private static readonly byte[] Rgb8Bytes4X4B = - { + [ 000, 255, 000, 255, 000, 000, 255, 255, 000, 000, 000, 192, 000, 064, 128, 192 - }; + ]; private static readonly byte[][] Rgb8Bytes4X4 = - { + [ Rgb8Bytes4X4R, Rgb8Bytes4X4G, Rgb8Bytes4X4B - }; + ]; private static readonly Rgba32[][] Rgb8Result4X4 = - { - new[] { Rgb8_000, Rgb8_FFF, Rgb8_000, Rgb8_FFF }, - new[] { Rgb8_F00, Rgb8_0F0, Rgb8_00F, Rgb8_F0F }, - new[] { Rgb8_400, Rgb8_800, Rgb8_C00, Rgb8_48C }, - new[] { Rgb8_000, Rgb8_444, Rgb8_888, Rgb8_CCC } - }; + [ + [Rgb8_000, Rgb8_FFF, Rgb8_000, Rgb8_FFF], + [Rgb8_F00, Rgb8_0F0, Rgb8_00F, Rgb8_F0F], + [Rgb8_400, Rgb8_800, Rgb8_C00, Rgb8_48C], + [Rgb8_000, Rgb8_444, Rgb8_888, Rgb8_CCC] + ]; public static IEnumerable Rgb8Data { get { - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Rgb8Result4X4 }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Offset(Rgb8Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 0, 4, 4, Offset(Rgb8Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 1, 4, 4, Offset(Rgb8Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 1, 4, 4, Offset(Rgb8Result4X4, 1, 1, 6, 6) }; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Rgb8Result4X4]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Offset(Rgb8Result4X4, 0, 0, 6, 6)]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 0, 4, 4, Offset(Rgb8Result4X4, 1, 0, 6, 6)]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 1, 4, 4, Offset(Rgb8Result4X4, 0, 1, 6, 6)]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 1, 4, 4, Offset(Rgb8Result4X4, 1, 1, 6, 6)]; } } - private static readonly Rgba32 Rgb484_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb484_444 = new Rgba32(68, 64, 68, 255); - private static readonly Rgba32 Rgb484_888 = new Rgba32(136, 128, 136, 255); - private static readonly Rgba32 Rgb484_CCC = new Rgba32(204, 192, 204, 255); - private static readonly Rgba32 Rgb484_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb484_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb484_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb484_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb484_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb484_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb484_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb484_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb484_48C = new Rgba32(68, 128, 204, 255); + private static readonly Rgba32 Rgb484_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb484_444 = new(68, 64, 68, 255); + private static readonly Rgba32 Rgb484_888 = new(136, 128, 136, 255); + private static readonly Rgba32 Rgb484_CCC = new(204, 192, 204, 255); + private static readonly Rgba32 Rgb484_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb484_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb484_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb484_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb484_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb484_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb484_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb484_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb484_48C = new(68, 128, 204, 255); private static readonly byte[] Rgb484Bytes4X4R = - { + [ 0x0F, 0x0F, 0xF0, 0x0F, 0x48, 0xC4, 0x04, 0x8C - }; + ]; private static readonly byte[] Rgb484Bytes4X4G = - { + [ 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x40, 0x80, 0xC0 - }; + ]; private static readonly byte[] Rgb484Bytes4X4B = - { + [ 0x0F, 0x0F, 0x00, 0xFF, 0x00, 0x0C, 0x04, 0x8C - }; + ]; private static readonly Rgba32[][] Rgb484Result4X4 = - { - new[] { Rgb484_000, Rgb484_FFF, Rgb484_000, Rgb484_FFF }, - new[] { Rgb484_F00, Rgb484_0F0, Rgb484_00F, Rgb484_F0F }, - new[] { Rgb484_400, Rgb484_800, Rgb484_C00, Rgb484_48C }, - new[] { Rgb484_000, Rgb484_444, Rgb484_888, Rgb484_CCC } - }; + [ + [Rgb484_000, Rgb484_FFF, Rgb484_000, Rgb484_FFF], + [Rgb484_F00, Rgb484_0F0, Rgb484_00F, Rgb484_F0F], + [Rgb484_400, Rgb484_800, Rgb484_C00, Rgb484_48C], + [Rgb484_000, Rgb484_444, Rgb484_888, Rgb484_CCC] + ]; - private static readonly byte[][] Rgb484Bytes4X4 = { Rgb484Bytes4X4R, Rgb484Bytes4X4G, Rgb484Bytes4X4B }; + private static readonly byte[][] Rgb484Bytes4X4 = [Rgb484Bytes4X4R, Rgb484Bytes4X4G, Rgb484Bytes4X4B]; public static IEnumerable Rgb484_Data { get { - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Rgb484Result4X4 }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Offset(Rgb484Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 0, 4, 4, Offset(Rgb484Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 1, 4, 4, Offset(Rgb484Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 1, 4, 4, Offset(Rgb484Result4X4, 1, 1, 6, 6) }; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Rgb484Result4X4]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Offset(Rgb484Result4X4, 0, 0, 6, 6) + ]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 0, 4, 4, Offset(Rgb484Result4X4, 1, 0, 6, 6) + ]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 1, 4, 4, Offset(Rgb484Result4X4, 0, 1, 6, 6) + ]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 1, 4, 4, Offset(Rgb484Result4X4, 1, 1, 6, 6) + ]; } } @@ -251,7 +255,7 @@ public class RgbPlanarTiffColorTests : PhotometricInterpretationTestBase expectedResult, pixels => { - var buffers = new IMemoryOwner[inputData.Length]; + IMemoryOwner[] buffers = new IMemoryOwner[inputData.Length]; for (int i = 0; i < buffers.Length; i++) { buffers[i] = Configuration.Default.MemoryAllocator.Allocate(inputData[i].Length); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs index aeb135773..6935d504e 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/RgbTiffColorTests.cs @@ -10,151 +10,155 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation; [Trait("Format", "Tiff")] public class RgbTiffColorTests : PhotometricInterpretationTestBase { - private static readonly Rgba32 Rgb4_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb4_444 = new Rgba32(68, 68, 68, 255); - private static readonly Rgba32 Rgb4_888 = new Rgba32(136, 136, 136, 255); - private static readonly Rgba32 Rgb4_CCC = new Rgba32(204, 204, 204, 255); - private static readonly Rgba32 Rgb4_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb4_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb4_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb4_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb4_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb4_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb4_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb4_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb4_48C = new Rgba32(68, 136, 204, 255); + private static readonly Rgba32 Rgb4_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb4_444 = new(68, 68, 68, 255); + private static readonly Rgba32 Rgb4_888 = new(136, 136, 136, 255); + private static readonly Rgba32 Rgb4_CCC = new(204, 204, 204, 255); + private static readonly Rgba32 Rgb4_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb4_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb4_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb4_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb4_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb4_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb4_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb4_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb4_48C = new(68, 136, 204, 255); private static readonly byte[] Rgb4Bytes4X4 = - { + [ 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xF0, 0x00, 0xF0, 0x00, 0xFF, 0x0F, 0x40, 0x08, 0x00, 0xC0, 0x04, 0x8C, 0x00, 0x04, 0x44, 0x88, 0x8C, 0xCC - }; + ]; private static readonly Rgba32[][] Rgb4Result4X4 = - { - new[] { Rgb4_000, Rgb4_FFF, Rgb4_000, Rgb4_FFF }, - new[] { Rgb4_F00, Rgb4_0F0, Rgb4_00F, Rgb4_F0F }, - new[] { Rgb4_400, Rgb4_800, Rgb4_C00, Rgb4_48C }, - new[] { Rgb4_000, Rgb4_444, Rgb4_888, Rgb4_CCC } - }; + [ + [Rgb4_000, Rgb4_FFF, Rgb4_000, Rgb4_FFF], + [Rgb4_F00, Rgb4_0F0, Rgb4_00F, Rgb4_F0F], + [Rgb4_400, Rgb4_800, Rgb4_C00, Rgb4_48C], + [Rgb4_000, Rgb4_444, Rgb4_888, Rgb4_CCC] + ]; private static readonly byte[] Rgb4Bytes3X4 = - { + [ 0x00, 0x0F, 0xFF, 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0xF0, 0x40, 0x08, 0x00, 0xC0, 0x00, 0x00, 0x04, 0x44, 0x88, 0x80 - }; + ]; private static readonly Rgba32[][] Rgb4Result3X4 = - { - new[] { Rgb4_000, Rgb4_FFF, Rgb4_000 }, - new[] { Rgb4_F00, Rgb4_0F0, Rgb4_00F }, - new[] { Rgb4_400, Rgb4_800, Rgb4_C00 }, - new[] { Rgb4_000, Rgb4_444, Rgb4_888 } - }; + [ + [Rgb4_000, Rgb4_FFF, Rgb4_000], + [Rgb4_F00, Rgb4_0F0, Rgb4_00F], + [Rgb4_400, Rgb4_800, Rgb4_C00], + [Rgb4_000, Rgb4_444, Rgb4_888] + ]; public static IEnumerable Rgb4Data { get { - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Rgb4Result4X4 }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Offset(Rgb4Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 4, 4, Offset(Rgb4Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 4, 4, Offset(Rgb4Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 4, 4, Offset(Rgb4Result4X4, 1, 1, 6, 6) }; - - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Rgb4Result3X4 }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Offset(Rgb4Result3X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 3, 4, Offset(Rgb4Result3X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 3, 4, Offset(Rgb4Result3X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 3, 4, Offset(Rgb4Result3X4, 1, 1, 6, 6) }; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Rgb4Result4X4]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 4, 4, Offset(Rgb4Result4X4, 0, 0, 6, 6)]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 4, 4, Offset(Rgb4Result4X4, 1, 0, 6, 6)]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 4, 4, Offset(Rgb4Result4X4, 0, 1, 6, 6)]; + yield return [Rgb4Bytes4X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 4, 4, Offset(Rgb4Result4X4, 1, 1, 6, 6)]; + + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Rgb4Result3X4]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 0, 3, 4, Offset(Rgb4Result3X4, 0, 0, 6, 6)]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 0, 3, 4, Offset(Rgb4Result3X4, 1, 0, 6, 6)]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 0, 1, 3, 4, Offset(Rgb4Result3X4, 0, 1, 6, 6)]; + yield return [Rgb4Bytes3X4, new TiffBitsPerSample(4, 4, 4), 1, 1, 3, 4, Offset(Rgb4Result3X4, 1, 1, 6, 6)]; } } - private static readonly Rgba32 Rgb8_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb8_444 = new Rgba32(64, 64, 64, 255); - private static readonly Rgba32 Rgb8_888 = new Rgba32(128, 128, 128, 255); - private static readonly Rgba32 Rgb8_CCC = new Rgba32(192, 192, 192, 255); - private static readonly Rgba32 Rgb8_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb8_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb8_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb8_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb8_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb8_400 = new Rgba32(64, 0, 0, 255); - private static readonly Rgba32 Rgb8_800 = new Rgba32(128, 0, 0, 255); - private static readonly Rgba32 Rgb8_C00 = new Rgba32(192, 0, 0, 255); - private static readonly Rgba32 Rgb8_48C = new Rgba32(64, 128, 192, 255); + private static readonly Rgba32 Rgb8_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb8_444 = new(64, 64, 64, 255); + private static readonly Rgba32 Rgb8_888 = new(128, 128, 128, 255); + private static readonly Rgba32 Rgb8_CCC = new(192, 192, 192, 255); + private static readonly Rgba32 Rgb8_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb8_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb8_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb8_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb8_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb8_400 = new(64, 0, 0, 255); + private static readonly Rgba32 Rgb8_800 = new(128, 0, 0, 255); + private static readonly Rgba32 Rgb8_C00 = new(192, 0, 0, 255); + private static readonly Rgba32 Rgb8_48C = new(64, 128, 192, 255); private static readonly byte[] Rgb8Bytes4X4 = - { + [ 000, 000, 000, 255, 255, 255, 000, 000, 000, 255, 255, 255, 255, 000, 000, 000, 255, 000, 000, 000, 255, 255, 000, 255, 064, 000, 000, 128, 000, 000, 192, 000, 000, 064, 128, 192, 000, 000, 000, 064, 064, 064, 128, 128, 128, 192, 192, 192 - }; + ]; private static readonly Rgba32[][] Rgb8Result4X4 = - { - new[] { Rgb8_000, Rgb8_FFF, Rgb8_000, Rgb8_FFF }, - new[] { Rgb8_F00, Rgb8_0F0, Rgb8_00F, Rgb8_F0F }, - new[] { Rgb8_400, Rgb8_800, Rgb8_C00, Rgb8_48C }, - new[] { Rgb8_000, Rgb8_444, Rgb8_888, Rgb8_CCC } - }; + [ + [Rgb8_000, Rgb8_FFF, Rgb8_000, Rgb8_FFF], + [Rgb8_F00, Rgb8_0F0, Rgb8_00F, Rgb8_F0F], + [Rgb8_400, Rgb8_800, Rgb8_C00, Rgb8_48C], + [Rgb8_000, Rgb8_444, Rgb8_888, Rgb8_CCC] + ]; public static IEnumerable Rgb8Data { get { - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Rgb8Result4X4 }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Offset(Rgb8Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 0, 4, 4, Offset(Rgb8Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 1, 4, 4, Offset(Rgb8Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 1, 4, 4, Offset(Rgb8Result4X4, 1, 1, 6, 6) }; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Rgb8Result4X4]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 0, 4, 4, Offset(Rgb8Result4X4, 0, 0, 6, 6)]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 0, 4, 4, Offset(Rgb8Result4X4, 1, 0, 6, 6)]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 0, 1, 4, 4, Offset(Rgb8Result4X4, 0, 1, 6, 6)]; + yield return [Rgb8Bytes4X4, new TiffBitsPerSample(8, 8, 8), 1, 1, 4, 4, Offset(Rgb8Result4X4, 1, 1, 6, 6)]; } } - private static readonly Rgba32 Rgb484_000 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Rgb484_444 = new Rgba32(68, 64, 68, 255); - private static readonly Rgba32 Rgb484_888 = new Rgba32(136, 128, 136, 255); - private static readonly Rgba32 Rgb484_CCC = new Rgba32(204, 192, 204, 255); - private static readonly Rgba32 Rgb484_FFF = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Rgb484_F00 = new Rgba32(255, 0, 0, 255); - private static readonly Rgba32 Rgb484_0F0 = new Rgba32(0, 255, 0, 255); - private static readonly Rgba32 Rgb484_00F = new Rgba32(0, 0, 255, 255); - private static readonly Rgba32 Rgb484_F0F = new Rgba32(255, 0, 255, 255); - private static readonly Rgba32 Rgb484_400 = new Rgba32(68, 0, 0, 255); - private static readonly Rgba32 Rgb484_800 = new Rgba32(136, 0, 0, 255); - private static readonly Rgba32 Rgb484_C00 = new Rgba32(204, 0, 0, 255); - private static readonly Rgba32 Rgb484_48C = new Rgba32(68, 128, 204, 255); + private static readonly Rgba32 Rgb484_000 = new(0, 0, 0, 255); + private static readonly Rgba32 Rgb484_444 = new(68, 64, 68, 255); + private static readonly Rgba32 Rgb484_888 = new(136, 128, 136, 255); + private static readonly Rgba32 Rgb484_CCC = new(204, 192, 204, 255); + private static readonly Rgba32 Rgb484_FFF = new(255, 255, 255, 255); + private static readonly Rgba32 Rgb484_F00 = new(255, 0, 0, 255); + private static readonly Rgba32 Rgb484_0F0 = new(0, 255, 0, 255); + private static readonly Rgba32 Rgb484_00F = new(0, 0, 255, 255); + private static readonly Rgba32 Rgb484_F0F = new(255, 0, 255, 255); + private static readonly Rgba32 Rgb484_400 = new(68, 0, 0, 255); + private static readonly Rgba32 Rgb484_800 = new(136, 0, 0, 255); + private static readonly Rgba32 Rgb484_C00 = new(204, 0, 0, 255); + private static readonly Rgba32 Rgb484_48C = new(68, 128, 204, 255); private static readonly byte[] Rgb484Bytes4X4 = - { + [ 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0x0F, 0xF0, 0x00, 0x0F, 0xF0, 0x0F, 0x40, 0x00, 0x80, 0x00, 0xC0, 0x00, 0x48, 0x0C, 0x00, 0x00, 0x44, 0x04, 0x88, 0x08, 0xCC, 0x0C - }; + ]; private static readonly Rgba32[][] Rgb484Result4X4 = - { - new[] { Rgb484_000, Rgb484_FFF, Rgb484_000, Rgb484_FFF }, - new[] { Rgb484_F00, Rgb484_0F0, Rgb484_00F, Rgb484_F0F }, - new[] { Rgb484_400, Rgb484_800, Rgb484_C00, Rgb484_48C }, - new[] { Rgb484_000, Rgb484_444, Rgb484_888, Rgb484_CCC } - }; + [ + [Rgb484_000, Rgb484_FFF, Rgb484_000, Rgb484_FFF], + [Rgb484_F00, Rgb484_0F0, Rgb484_00F, Rgb484_F0F], + [Rgb484_400, Rgb484_800, Rgb484_C00, Rgb484_48C], + [Rgb484_000, Rgb484_444, Rgb484_888, Rgb484_CCC] + ]; public static IEnumerable Rgb484Data { get { - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Rgb484Result4X4 }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Offset(Rgb484Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 0, 4, 4, Offset(Rgb484Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 1, 4, 4, Offset(Rgb484Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 1, 4, 4, Offset(Rgb484Result4X4, 1, 1, 6, 6) }; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Rgb484Result4X4]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 0, 4, 4, Offset(Rgb484Result4X4, 0, 0, 6, 6) + ]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 0, 4, 4, Offset(Rgb484Result4X4, 1, 0, 6, 6) + ]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 0, 1, 4, 4, Offset(Rgb484Result4X4, 0, 1, 6, 6) + ]; + yield return [Rgb484Bytes4X4, new TiffBitsPerSample(4, 8, 4), 1, 1, 4, 4, Offset(Rgb484Result4X4, 1, 1, 6, 6) + ]; } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs index 0b58e3891..7a09bfae7 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs @@ -10,110 +10,110 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation; [Trait("Format", "Tiff")] public class WhiteIsZeroTiffColorTests : PhotometricInterpretationTestBase { - private static readonly Rgba32 Gray000 = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Gray128 = new Rgba32(127, 127, 127, 255); - private static readonly Rgba32 Gray255 = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Gray0 = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Gray8 = new Rgba32(119, 119, 119, 255); - private static readonly Rgba32 GrayF = new Rgba32(0, 0, 0, 255); - private static readonly Rgba32 Bit0 = new Rgba32(255, 255, 255, 255); - private static readonly Rgba32 Bit1 = new Rgba32(0, 0, 0, 255); + private static readonly Rgba32 Gray000 = new(255, 255, 255, 255); + private static readonly Rgba32 Gray128 = new(127, 127, 127, 255); + private static readonly Rgba32 Gray255 = new(0, 0, 0, 255); + private static readonly Rgba32 Gray0 = new(255, 255, 255, 255); + private static readonly Rgba32 Gray8 = new(119, 119, 119, 255); + private static readonly Rgba32 GrayF = new(0, 0, 0, 255); + private static readonly Rgba32 Bit0 = new(255, 255, 255, 255); + private static readonly Rgba32 Bit1 = new(0, 0, 0, 255); private static readonly byte[] BilevelBytes4X4 = - { + [ 0b01010000, 0b11110000, 0b01110000, 0b10010000 - }; + ]; private static readonly Rgba32[][] BilevelResult4X4 = - { - new[] { Bit0, Bit1, Bit0, Bit1 }, - new[] { Bit1, Bit1, Bit1, Bit1 }, - new[] { Bit0, Bit1, Bit1, Bit1 }, - new[] { Bit1, Bit0, Bit0, Bit1 } - }; + [ + [Bit0, Bit1, Bit0, Bit1], + [Bit1, Bit1, Bit1, Bit1], + [Bit0, Bit1, Bit1, Bit1], + [Bit1, Bit0, Bit0, Bit1] + ]; private static readonly byte[] BilevelBytes12X4 = - { + [ 0b01010101, 0b01010000, 0b11111111, 0b11111111, 0b01101001, 0b10100000, 0b10010000, 0b01100000 - }; + ]; private static readonly Rgba32[][] BilevelResult12X4 = - { - new[] { Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1 }, - new[] { Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1 }, - new[] { Bit0, Bit1, Bit1, Bit0, Bit1, Bit0, Bit0, Bit1, Bit1, Bit0, Bit1, Bit0 }, - new[] { Bit1, Bit0, Bit0, Bit1, Bit0, Bit0, Bit0, Bit0, Bit0, Bit1, Bit1, Bit0 } - }; + [ + [Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1], + [Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1], + [Bit0, Bit1, Bit1, Bit0, Bit1, Bit0, Bit0, Bit1, Bit1, Bit0, Bit1, Bit0], + [Bit1, Bit0, Bit0, Bit1, Bit0, Bit0, Bit0, Bit0, Bit0, Bit1, Bit1, Bit0] + ]; private static readonly byte[] Grayscale4Bytes4X4 = - { + [ 0x8F, 0x0F, 0xFF, 0xFF, 0x08, 0x8F, 0xF0, 0xF8 - }; + ]; private static readonly Rgba32[][] Grayscale4Result4X4 = - { - new[] { Gray8, GrayF, Gray0, GrayF }, - new[] { GrayF, GrayF, GrayF, GrayF }, - new[] { Gray0, Gray8, Gray8, GrayF }, - new[] { GrayF, Gray0, GrayF, Gray8 } - }; + [ + [Gray8, GrayF, Gray0, GrayF], + [GrayF, GrayF, GrayF, GrayF], + [Gray0, Gray8, Gray8, GrayF], + [GrayF, Gray0, GrayF, Gray8] + ]; private static readonly byte[] Grayscale4Bytes3X4 = - { + [ 0x8F, 0x00, 0xFF, 0xF0, 0x08, 0x80, 0xF0, 0xF0 - }; + ]; private static readonly Rgba32[][] Grayscale4Result3X4 = - { - new[] { Gray8, GrayF, Gray0 }, - new[] { GrayF, GrayF, GrayF }, - new[] { Gray0, Gray8, Gray8 }, - new[] { GrayF, Gray0, GrayF } - }; + [ + [Gray8, GrayF, Gray0], + [GrayF, GrayF, GrayF], + [Gray0, Gray8, Gray8], + [GrayF, Gray0, GrayF] + ]; private static readonly byte[] Grayscale8Bytes4X4 = - { + [ 128, 255, 000, 255, 255, 255, 255, 255, 000, 128, 128, 255, 255, 000, 255, 128 - }; + ]; private static readonly Rgba32[][] Grayscale8Result4X4 = - { - new[] { Gray128, Gray255, Gray000, Gray255 }, - new[] { Gray255, Gray255, Gray255, Gray255 }, - new[] { Gray000, Gray128, Gray128, Gray255 }, - new[] { Gray255, Gray000, Gray255, Gray128 } - }; + [ + [Gray128, Gray255, Gray000, Gray255], + [Gray255, Gray255, Gray255, Gray255], + [Gray000, Gray128, Gray128, Gray255], + [Gray255, Gray000, Gray255, Gray128] + ]; public static IEnumerable BilevelData { get { - yield return new object[] { BilevelBytes4X4, 1, 0, 0, 4, 4, BilevelResult4X4 }; - yield return new object[] { BilevelBytes4X4, 1, 0, 0, 4, 4, Offset(BilevelResult4X4, 0, 0, 6, 6) }; - yield return new object[] { BilevelBytes4X4, 1, 1, 0, 4, 4, Offset(BilevelResult4X4, 1, 0, 6, 6) }; - yield return new object[] { BilevelBytes4X4, 1, 0, 1, 4, 4, Offset(BilevelResult4X4, 0, 1, 6, 6) }; - yield return new object[] { BilevelBytes4X4, 1, 1, 1, 4, 4, Offset(BilevelResult4X4, 1, 1, 6, 6) }; - - yield return new object[] { BilevelBytes12X4, 1, 0, 0, 12, 4, BilevelResult12X4 }; - yield return new object[] { BilevelBytes12X4, 1, 0, 0, 12, 4, Offset(BilevelResult12X4, 0, 0, 18, 6) }; - yield return new object[] { BilevelBytes12X4, 1, 1, 0, 12, 4, Offset(BilevelResult12X4, 1, 0, 18, 6) }; - yield return new object[] { BilevelBytes12X4, 1, 0, 1, 12, 4, Offset(BilevelResult12X4, 0, 1, 18, 6) }; - yield return new object[] { BilevelBytes12X4, 1, 1, 1, 12, 4, Offset(BilevelResult12X4, 1, 1, 18, 6) }; + yield return [BilevelBytes4X4, 1, 0, 0, 4, 4, BilevelResult4X4]; + yield return [BilevelBytes4X4, 1, 0, 0, 4, 4, Offset(BilevelResult4X4, 0, 0, 6, 6)]; + yield return [BilevelBytes4X4, 1, 1, 0, 4, 4, Offset(BilevelResult4X4, 1, 0, 6, 6)]; + yield return [BilevelBytes4X4, 1, 0, 1, 4, 4, Offset(BilevelResult4X4, 0, 1, 6, 6)]; + yield return [BilevelBytes4X4, 1, 1, 1, 4, 4, Offset(BilevelResult4X4, 1, 1, 6, 6)]; + + yield return [BilevelBytes12X4, 1, 0, 0, 12, 4, BilevelResult12X4]; + yield return [BilevelBytes12X4, 1, 0, 0, 12, 4, Offset(BilevelResult12X4, 0, 0, 18, 6)]; + yield return [BilevelBytes12X4, 1, 1, 0, 12, 4, Offset(BilevelResult12X4, 1, 0, 18, 6)]; + yield return [BilevelBytes12X4, 1, 0, 1, 12, 4, Offset(BilevelResult12X4, 0, 1, 18, 6)]; + yield return [BilevelBytes12X4, 1, 1, 1, 12, 4, Offset(BilevelResult12X4, 1, 1, 18, 6)]; } } @@ -121,17 +121,17 @@ public class WhiteIsZeroTiffColorTests : PhotometricInterpretationTestBase { get { - yield return new object[] { Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Grayscale4Result4X4 }; - yield return new object[] { Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Offset(Grayscale4Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes4X4, 4, 1, 0, 4, 4, Offset(Grayscale4Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes4X4, 4, 0, 1, 4, 4, Offset(Grayscale4Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Grayscale4Bytes4X4, 4, 1, 1, 4, 4, Offset(Grayscale4Result4X4, 1, 1, 6, 6) }; - - yield return new object[] { Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Grayscale4Result3X4 }; - yield return new object[] { Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Offset(Grayscale4Result3X4, 0, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes3X4, 4, 1, 0, 3, 4, Offset(Grayscale4Result3X4, 1, 0, 6, 6) }; - yield return new object[] { Grayscale4Bytes3X4, 4, 0, 1, 3, 4, Offset(Grayscale4Result3X4, 0, 1, 6, 6) }; - yield return new object[] { Grayscale4Bytes3X4, 4, 1, 1, 3, 4, Offset(Grayscale4Result3X4, 1, 1, 6, 6) }; + yield return [Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Grayscale4Result4X4]; + yield return [Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Offset(Grayscale4Result4X4, 0, 0, 6, 6)]; + yield return [Grayscale4Bytes4X4, 4, 1, 0, 4, 4, Offset(Grayscale4Result4X4, 1, 0, 6, 6)]; + yield return [Grayscale4Bytes4X4, 4, 0, 1, 4, 4, Offset(Grayscale4Result4X4, 0, 1, 6, 6)]; + yield return [Grayscale4Bytes4X4, 4, 1, 1, 4, 4, Offset(Grayscale4Result4X4, 1, 1, 6, 6)]; + + yield return [Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Grayscale4Result3X4]; + yield return [Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Offset(Grayscale4Result3X4, 0, 0, 6, 6)]; + yield return [Grayscale4Bytes3X4, 4, 1, 0, 3, 4, Offset(Grayscale4Result3X4, 1, 0, 6, 6)]; + yield return [Grayscale4Bytes3X4, 4, 0, 1, 3, 4, Offset(Grayscale4Result3X4, 0, 1, 6, 6)]; + yield return [Grayscale4Bytes3X4, 4, 1, 1, 3, 4, Offset(Grayscale4Result3X4, 1, 1, 6, 6)]; } } @@ -139,11 +139,11 @@ public class WhiteIsZeroTiffColorTests : PhotometricInterpretationTestBase { get { - yield return new object[] { Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Grayscale8Result4X4 }; - yield return new object[] { Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Offset(Grayscale8Result4X4, 0, 0, 6, 6) }; - yield return new object[] { Grayscale8Bytes4X4, 8, 1, 0, 4, 4, Offset(Grayscale8Result4X4, 1, 0, 6, 6) }; - yield return new object[] { Grayscale8Bytes4X4, 8, 0, 1, 4, 4, Offset(Grayscale8Result4X4, 0, 1, 6, 6) }; - yield return new object[] { Grayscale8Bytes4X4, 8, 1, 1, 4, 4, Offset(Grayscale8Result4X4, 1, 1, 6, 6) }; + yield return [Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Grayscale8Result4X4]; + yield return [Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Offset(Grayscale8Result4X4, 0, 0, 6, 6)]; + yield return [Grayscale8Bytes4X4, 8, 1, 0, 4, 4, Offset(Grayscale8Result4X4, 1, 0, 6, 6)]; + yield return [Grayscale8Bytes4X4, 8, 0, 1, 4, 4, Offset(Grayscale8Result4X4, 0, 1, 6, 6)]; + yield return [Grayscale8Bytes4X4, 8, 1, 1, 4, 4, Offset(Grayscale8Result4X4, 1, 1, 6, 6)]; } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs index cf27e561f..e432a7251 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs @@ -352,6 +352,21 @@ public class TiffDecoderTests : TiffDecoderBaseTester image.CompareToReferenceOutput(ImageComparer.Exact, provider); } + [Theory] + [WithFile(Icc.PerceptualCmyk, PixelTypes.Rgba32)] + [WithFile(Icc.PerceptualCieLab, PixelTypes.Rgba32)] + [WithFile(Icc.PerceptualRgb8, PixelTypes.Rgba32)] + [WithFile(Icc.PerceptualRgb16, PixelTypes.Rgba32)] + public void Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(TiffDecoder.Instance, new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert }); + + image.DebugSave(provider); + image.CompareToReferenceOutput(provider); + Assert.Null(image.Metadata.IccProfile); + } + [Theory] [WithFile(Issues2454_A, PixelTypes.Rgba32)] [WithFile(Issues2454_B, PixelTypes.Rgba32)] @@ -360,6 +375,21 @@ public class TiffDecoderTests : TiffDecoderBaseTester { using Image image = provider.GetImage(TiffDecoder.Instance); image.DebugSave(provider); + + // ARM reports a 0.0000% difference, so we use a tolerant comparer here. + image.CompareToReferenceOutput(ImageComparer.TolerantPercentage(0.0001F), provider); + } + + [Theory] + [WithFile(Issues3031, PixelTypes.Rgba64)] + [WithFile(Rgba16BitAssociatedAlphaBigEndian, PixelTypes.Rgba64)] + [WithFile(Rgba16BitAssociatedAlphaLittleEndian, PixelTypes.Rgba64)] + public void TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(TiffDecoder.Instance); + image.DebugSave(provider); + image.CompareToReferenceOutput(ImageComparer.Exact, provider); } @@ -783,7 +813,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester // ImageMagick cannot decode this image. image.DebugSave(provider); image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(0.0018F), // NET 9+ Uses zlib-ng to decompress, which manages to decode 2 extra pixels. + ImageComparer.TolerantPercentage(0.0034F), // NET 10 Uses zlib-ng to decompress, which manages to decode 3 extra pixels. provider, appendPixelTypeToFileName: false); } @@ -810,7 +840,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(TiffDecoder.Instance, options); @@ -828,4 +858,14 @@ public class TiffDecoderTests : TiffDecoderBaseTester testOutputDetails: details, appendPixelTypeToFileName: false); } + + [Theory] + [WithFile(ExtraSamplesUnspecified, PixelTypes.Rgba32)] + public void TiffDecoder_CanDecode_ExtraSamplesUnspecified(TestImageProvider provider) + where TPixel : unmanaged, IPixel => TestTiffDecoder(provider); + + [Theory] + [WithFile(Issue2983, PixelTypes.Rgba32)] + public void TiffDecoder_CanDecode_Issue2983(TestImageProvider provider) + where TPixel : unmanaged, IPixel => TestTiffDecoder(provider); } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs index 1bf9f5a40..158a0d473 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderBaseTester.cs @@ -26,9 +26,9 @@ public abstract class TiffEncoderBaseTester where TPixel : unmanaged, IPixel { // arrange - var tiffEncoder = new TiffEncoder() { PhotometricInterpretation = photometricInterpretation, Compression = compression }; + TiffEncoder tiffEncoder = new() { PhotometricInterpretation = photometricInterpretation, Compression = compression }; using Image input = provider.GetImage(); - using var memStream = new MemoryStream(); + using MemoryStream memStream = new(); TiffFrameMetadata inputMeta = input.Frames.RootFrame.Metadata.GetTiffMetadata(); TiffCompression inputCompression = inputMeta.Compression; @@ -37,7 +37,7 @@ public abstract class TiffEncoderBaseTester // assert memStream.Position = 0; - using var output = Image.Load(memStream); + using Image output = Image.Load(memStream); ExifProfile exifProfileOutput = output.Frames.RootFrame.Metadata.ExifProfile; TiffFrameMetadata outputMeta = output.Frames.RootFrame.Metadata.GetTiffMetadata(); ImageFrame rootFrame = output.Frames.RootFrame; @@ -89,7 +89,7 @@ public abstract class TiffEncoderBaseTester where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - var encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = photometricInterpretation, BitsPerPixel = bitsPerPixel, diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs index 716b978a7..9f6e74183 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderMultiframeTests.cs @@ -46,7 +46,7 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester image.Frames.RemoveFrame(0); TiffBitsPerPixel bitsPerPixel = TiffBitsPerPixel.Bit24; - var encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = TiffPhotometricInterpretation.Rgb, BitsPerPixel = bitsPerPixel, @@ -69,27 +69,27 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester using Image image = provider.GetImage(); Assert.Equal(1, image.Frames.Count); - using var image1 = new Image(image.Width, image.Height, Color.Green.ToPixel()); + using Image image1 = new(image.Width, image.Height, Color.Green.ToPixel()); - using var image2 = new Image(image.Width, image.Height, Color.Yellow.ToPixel()); + using Image image2 = new(image.Width, image.Height, Color.Yellow.ToPixel()); image.Frames.AddFrame(image1.Frames.RootFrame); image.Frames.AddFrame(image2.Frames.RootFrame); TiffBitsPerPixel bitsPerPixel = TiffBitsPerPixel.Bit24; - var encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = TiffPhotometricInterpretation.Rgb, BitsPerPixel = bitsPerPixel, Compression = TiffCompression.Deflate }; - using (var ms = new System.IO.MemoryStream()) + using (MemoryStream ms = new()) { image.Save(ms, encoder); ms.Position = 0; - using var output = Image.Load(ms); + using Image output = Image.Load(ms); Assert.Equal(3, output.Frames.Count); @@ -121,11 +121,11 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester { using Image image = provider.GetImage(); - using var image0 = new Image(image.Width, image.Height, Color.Red.ToPixel()); + using Image image0 = new(image.Width, image.Height, Color.Red.ToPixel()); - using var image1 = new Image(image.Width, image.Height, Color.Green.ToPixel()); + using Image image1 = new(image.Width, image.Height, Color.Green.ToPixel()); - using var image2 = new Image(image.Width, image.Height, Color.Yellow.ToPixel()); + using Image image2 = new(image.Width, image.Height, Color.Yellow.ToPixel()); image.Frames.AddFrame(image0.Frames.RootFrame); image.Frames.AddFrame(image1.Frames.RootFrame); @@ -133,19 +133,19 @@ public class TiffEncoderMultiframeTests : TiffEncoderBaseTester image.Frames.RemoveFrame(0); TiffBitsPerPixel bitsPerPixel = TiffBitsPerPixel.Bit8; - var encoder = new TiffEncoder + TiffEncoder encoder = new() { PhotometricInterpretation = TiffPhotometricInterpretation.PaletteColor, BitsPerPixel = bitsPerPixel, Compression = TiffCompression.Lzw }; - using (var ms = new System.IO.MemoryStream()) + using (MemoryStream ms = new()) { image.Save(ms, encoder); ms.Position = 0; - using var output = Image.Load(ms); + using Image output = Image.Load(ms); Assert.Equal(3, output.Frames.Count); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs index e31487cd2..8d75cd9bc 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs @@ -61,16 +61,15 @@ public class TiffMetadataTests clone.PhotometricInterpretation = TiffPhotometricInterpretation.CieLab; clone.Predictor = TiffPredictor.Horizontal; - Assert.False(meta.BitsPerPixel == clone.BitsPerPixel); - Assert.False(meta.Compression == clone.Compression); - Assert.False(meta.PhotometricInterpretation == clone.PhotometricInterpretation); - Assert.False(meta.Predictor == clone.Predictor); + Assert.NotEqual(meta.BitsPerPixel, clone.BitsPerPixel); + Assert.NotEqual(meta.Compression, clone.Compression); + Assert.NotEqual(meta.PhotometricInterpretation, clone.PhotometricInterpretation); + Assert.NotEqual(meta.Predictor, clone.Predictor); } private static void VerifyExpectedTiffFrameMetaDataIsPresent(TiffFrameMetadata frameMetaData) { Assert.NotNull(frameMetaData); - Assert.NotNull(frameMetaData.BitsPerPixel); Assert.Equal(TiffBitsPerPixel.Bit4, frameMetaData.BitsPerPixel); Assert.Equal(TiffCompression.Lzw, frameMetaData.Compression); Assert.Equal(TiffPhotometricInterpretation.PaletteColor, frameMetaData.PhotometricInterpretation); @@ -157,7 +156,7 @@ public class TiffMetadataTests { Assert.NotNull(rootFrameMetaData.XmpProfile); Assert.NotNull(rootFrameMetaData.ExifProfile); - Assert.Equal(2599, rootFrameMetaData.XmpProfile.Data.Length); + Assert.Equal(2596, rootFrameMetaData.XmpProfile.Data.Length); // padding bytes are trimmed Assert.Equal(25, rootFrameMetaData.ExifProfile.Values.Count); } } @@ -186,7 +185,7 @@ public class TiffMetadataTests Assert.Equal(32, rootFrame.Width); Assert.Equal(32, rootFrame.Height); Assert.NotNull(rootFrame.Metadata.XmpProfile); - Assert.Equal(2599, rootFrame.Metadata.XmpProfile.Data.Length); + Assert.Equal(2596, rootFrame.Metadata.XmpProfile.Data.Length); // padding bytes are trimmed ExifProfile exifProfile = rootFrame.Metadata.ExifProfile; TiffFrameMetadata tiffFrameMetadata = rootFrame.Metadata.GetTiffMetadata(); @@ -208,8 +207,8 @@ public class TiffMetadataTests Rational expectedResolution = new(10, 1, simplify: false); Assert.Equal(expectedResolution, exifProfile.GetValue(ExifTag.XResolution).Value); Assert.Equal(expectedResolution, exifProfile.GetValue(ExifTag.YResolution).Value); - Assert.Equal(new Number[] { 8u }, exifProfile.GetValue(ExifTag.StripOffsets)?.Value, new NumberComparer()); - Assert.Equal(new Number[] { 285u }, exifProfile.GetValue(ExifTag.StripByteCounts)?.Value, new NumberComparer()); + Assert.Equal([8u], exifProfile.GetValue(ExifTag.StripOffsets)?.Value, new NumberComparer()); + Assert.Equal([285u], exifProfile.GetValue(ExifTag.StripByteCounts)?.Value, new NumberComparer()); Assert.Null(exifProfile.GetValue(ExifTag.ExtraSamples, false)?.Value); Assert.Equal(32u, exifProfile.GetValue(ExifTag.RowsPerStrip).Value); Assert.Null(exifProfile.GetValue(ExifTag.SampleFormat, false)); @@ -409,4 +408,17 @@ public class TiffMetadataTests // Adding the IPTC and ICC profiles dynamically increments the number of values in the original EXIF profile by 2 Assert.Equal(exifProfileInput.Values.Count + 2, encodedImageExifProfile.Values.Count); } + + [Theory] + [WithFile(PaletteDeflateMultistrip, PixelTypes.Rgba32)] + [WithFile(PaletteUncompressed, PixelTypes.Rgba32)] + public void TiffDecoder_CanAssign_ColorPalette(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(TiffDecoder.Instance); + ImageFrame frame = image.Frames.RootFrame; + TiffFrameMetadata tiffMeta = frame.Metadata.GetTiffMetadata(); + Assert.Equal(TiffPhotometricInterpretation.PaletteColor, tiffMeta.PhotometricInterpretation); + Assert.NotNull(tiffMeta.LocalColorTable); + } } diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffUtilitiesTest.cs b/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffUtilitiesTest.cs new file mode 100644 index 000000000..6483b63c5 --- /dev/null +++ b/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffUtilitiesTest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using SixLabors.ImageSharp.Formats.Tiff.Utils; +using SixLabors.ImageSharp.PixelFormats; + +namespace SixLabors.ImageSharp.Tests.Formats.Tiff.Utils; + +[Trait("Format", "Tiff")] +public class TiffUtilitiesTest +{ + [Theory] + [InlineData(0, 0, 0, 0)] + [InlineData(42, 84, 128, 0)] + [InlineData(65535, 65535, 65535, 0)] + public void ColorFromRgba64Premultiplied_WithZeroAlpha_ReturnsDefaultPixel(ushort r, ushort g, ushort b, ushort a) + { + Rgba64 actual = TiffUtilities.ColorFromRgba64Premultiplied(r, g, b, a); + + Assert.Equal(default, actual); + } + + [Theory] + [InlineData(65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535)] + [InlineData(32767, 0, 0, 65535, 32767, 0, 0, 65535)] + [InlineData(0, 32767, 0, 65535, 0, 32767, 0, 65535)] + [InlineData(0, 0, 32767, 65535, 0, 0, 32767, 65535)] + public void ColorFromRgba64Premultiplied_WithNoAlpha_ReturnExpectedValues(ushort r, ushort g, ushort b, ushort a, ushort expectedR, ushort expectedG, ushort expectedB, ushort expectedA) + { + Rgba64 actual = TiffUtilities.ColorFromRgba64Premultiplied(r, g, b, a); + + Assert.Equal(new Rgba64(expectedR, expectedG, expectedB, expectedA), actual); + } + + [Theory] + [InlineData(32766, 0, 0, 32766, 65535, 0, 0, 32766)] // Red, 50% Alpha + [InlineData(0, 32766, 0, 32766, 0, 65535, 0, 32766)] // Green, 50% Alpha + [InlineData(0, 0, 32766, 32766, 0, 0, 65535, 32766)] // Blue, 50% Alpha + [InlineData(8191, 0, 0, 16383, 32765, 0, 0, 16383)] // Red, 25% Alpha + [InlineData(0, 8191, 0, 16383, 0, 32765, 0, 16383)] // Green, 25% Alpha + [InlineData(0, 0, 8191, 16383, 0, 0, 32765, 16383)] // Blue, 25% Alpha + [InlineData(8191, 0, 0, 0, 0, 0, 0, 0)] // Red, 0% Alpha + [InlineData(0, 8191, 0, 0, 0, 0, 0, 0)] // Green, 0% Alpha + [InlineData(0, 0, 8191, 0, 0, 0, 0, 0)] // Blue, 0% Alpha + public void ColorFromRgba64Premultiplied_WithAlpha_ReturnExpectedValues(ushort r, ushort g, ushort b, ushort a, ushort expectedR, ushort expectedG, ushort expectedB, ushort expectedA) + { + Rgba64 actual = TiffUtilities.ColorFromRgba64Premultiplied(r, g, b, a); + + Assert.Equal(new Rgba64(expectedR, expectedG, expectedB, expectedA), actual); + } +} diff --git a/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs index 9b26ab270..939baeeb6 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/Utils/TiffWriterTests.cs @@ -11,8 +11,8 @@ public class TiffWriterTests [Fact] public void IsLittleEndian_IsTrueOnWindows() { - using var stream = new MemoryStream(); - using var writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); Assert.True(TiffStreamWriter.IsLittleEndian); } @@ -22,8 +22,8 @@ public class TiffWriterTests [InlineData(new byte[] { 1, 2, 3, 4, 5 }, 5)] public void Position_EqualsTheStreamPosition(byte[] data, long expectedResult) { - using var stream = new MemoryStream(); - using var writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(data); Assert.Equal(writer.Position, expectedResult); } @@ -31,8 +31,8 @@ public class TiffWriterTests [Fact] public void Write_WritesByte() { - using var stream = new MemoryStream(); - using var writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(42); Assert.Equal(new byte[] { 42 }, stream.ToArray()); @@ -41,8 +41,8 @@ public class TiffWriterTests [Fact] public void Write_WritesByteArray() { - using var stream = new MemoryStream(); - using var writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(new byte[] { 2, 4, 6, 8 }); Assert.Equal(new byte[] { 2, 4, 6, 8 }, stream.ToArray()); @@ -51,8 +51,8 @@ public class TiffWriterTests [Fact] public void Write_WritesUInt16() { - using var stream = new MemoryStream(); - using var writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(1234, stackalloc byte[2]); Assert.Equal(new byte[] { 0xD2, 0x04 }, stream.ToArray()); @@ -61,8 +61,8 @@ public class TiffWriterTests [Fact] public void Write_WritesUInt32() { - using var stream = new MemoryStream(); - using var writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.Write(12345678U, stackalloc byte[4]); Assert.Equal(new byte[] { 0x4E, 0x61, 0xBC, 0x00 }, stream.ToArray()); @@ -78,8 +78,8 @@ public class TiffWriterTests public void WritePadded_WritesByteArray(byte[] bytes, byte[] expectedResult) { - using var stream = new MemoryStream(); - using var writer = new TiffStreamWriter(stream); + using MemoryStream stream = new(); + using TiffStreamWriter writer = new(stream); writer.WritePadded(bytes); Assert.Equal(expectedResult, stream.ToArray()); @@ -88,10 +88,10 @@ public class TiffWriterTests [Fact] public void WriteMarker_WritesToPlacedPosition() { - using var stream = new MemoryStream(); + using MemoryStream stream = new(); Span buffer = stackalloc byte[4]; - using (var writer = new TiffStreamWriter(stream)) + using (TiffStreamWriter writer = new(stream)) { writer.Write(0x11111111, buffer); long marker = writer.PlaceMarker(buffer); diff --git a/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs index 6073888fe..9657859e0 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs @@ -12,13 +12,13 @@ public class ColorSpaceTransformUtilsTests private static void RunCollectColorBlueTransformsTest() { uint[] pixelData = - { + [ 3074, 256, 256, 256, 0, 65280, 65280, 65280, 256, 256, 0, 256, 0, 65280, 0, 65280, 16711680, 256, 256, 0, 65024, 0, 256, 256, 0, 65280, 0, 65280, 0, 256, 0, 256 - }; + ]; int[] expectedOutput = - { + [ 31, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -27,7 +27,7 @@ public class ColorSpaceTransformUtilsTests 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; + ]; int[] histo = new int[256]; ColorSpaceTransformUtils.CollectColorBlueTransforms(pixelData, 0, 32, 1, 0, 0, histo); @@ -38,13 +38,13 @@ public class ColorSpaceTransformUtilsTests private static void RunCollectColorRedTransformsTest() { uint[] pixelData = - { + [ 3074, 256, 256, 256, 0, 65280, 65280, 65280, 256, 256, 0, 256, 0, 65280, 0, 65280, 16711680, 256, 256, 0, 65024, 0, 256, 256, 0, 65280, 0, 65280, 0, 256, 0, 256 - }; + ]; int[] expectedOutput = - { + [ 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -53,7 +53,7 @@ public class ColorSpaceTransformUtilsTests 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 - }; + ]; int[] histo = new int[256]; ColorSpaceTransformUtils.CollectColorRedTransforms(pixelData, 0, 32, 1, 0, histo); @@ -71,7 +71,7 @@ public class ColorSpaceTransformUtilsTests public void CollectColorBlueTransforms_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.AllowAll); [Fact] - public void CollectColorBlueTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableSSE41); + public void CollectColorBlueTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void CollectColorBlueTransforms_WithoutVector256_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableAVX2); @@ -80,7 +80,7 @@ public class ColorSpaceTransformUtilsTests public void CollectColorRedTransforms_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.AllowAll); [Fact] - public void CollectColorRedTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableSSE41); + public void CollectColorRedTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void CollectColorRedTransforms_WithoutVector256_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableAVX2); diff --git a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs index 4551e3e23..4dcccb1a3 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs @@ -11,8 +11,10 @@ public class LosslessUtilsTests { private static void RunCombinedShannonEntropyTest() { - int[] x = { 3, 5, 2, 5, 3, 1, 2, 2, 3, 3, 1, 2, 1, 2, 1, 1, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 1, 0, 0, 2, 1, 1, 0, 3, 1, 2, 3, 2, 3 }; - int[] y = { 11, 12, 8, 3, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 1, 1, 2, 4, 6, 4 }; + int[] x = [3, 5, 2, 5, 3, 1, 2, 2, 3, 3, 1, 2, 1, 2, 1, 1, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 1, 0, 0, 2, 1, 1, 0, 3, 1, 2, 3, 2, 3 + ]; + int[] y = [11, 12, 8, 3, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 1, 1, 2, 4, 6, 4 + ]; const float expected = 884.7585f; float actual = LosslessUtils.CombinedShannonEntropy(x, y); @@ -23,7 +25,7 @@ public class LosslessUtilsTests private static void RunSubtractGreenTest() { uint[] pixelData = - { + [ 4293035898, 4293101432, 4292903793, 4292838511, 4292837995, 4292771950, 4292903791, 4293299316, 4293563769, 4293629303, 4293363312, 4291913575, 4289282905, 4288692313, 4289349210, 4289809240, 4289743703, 4289874775, 4289940567, 4289743701, 4290137943, 4290860378, 4291058267, 4291386715, @@ -31,10 +33,10 @@ public class LosslessUtilsTests 4291913571, 4292044130, 4291978850, 4291847521, 4291847524, 4291847779, 4291913571, 4291848293, 4291651689, 4291585895, 4291519584, 4291715936, 4291520355, 4291650658, 4291847263, 4291913313, 4291847777, 4291781731, 4291783015 - }; + ]; uint[] expectedOutput = - { + [ 4284188659, 4284254193, 4284318702, 4284187883, 4284318441, 4284383470, 4284318700, 4284124392, 4283799012, 4283864546, 4284581610, 4285163264, 4284891926, 4284497945, 4284761620, 4284893965, 4284828428, 4284959500, 4284959755, 4284828426, 4284960520, 4285289733, 4285159937, 4285292030, @@ -42,7 +44,7 @@ public class LosslessUtilsTests 4285163516, 4285425149, 4285294332, 4285228540, 4285228543, 4285163261, 4285163516, 4285032701, 4284835841, 4284835584, 4284966140, 4285228029, 4284770300, 4285097214, 4285293819, 4285228795, 4285163259, 4285228287, 4284901886 - }; + ]; LosslessUtils.SubtractGreenFromBlueAndRed(pixelData); @@ -52,7 +54,7 @@ public class LosslessUtilsTests private static void RunAddGreenToBlueAndRedTest() { uint[] pixelData = - { + [ 4284188659, 4284254193, 4284318702, 4284187883, 4284318441, 4284383470, 4284318700, 4284124392, 4283799012, 4283864546, 4284581610, 4285163264, 4284891926, 4284497945, 4284761620, 4284893965, 4284828428, 4284959500, 4284959755, 4284828426, 4284960520, 4285289733, 4285159937, 4285292030, @@ -60,10 +62,10 @@ public class LosslessUtilsTests 4285163516, 4285425149, 4285294332, 4285228540, 4285228543, 4285163261, 4285163516, 4285032701, 4284835841, 4284835584, 4284966140, 4285228029, 4284770300, 4285097214, 4285293819, 4285228795, 4285163259, 4285228287, 4284901886 - }; + ]; uint[] expectedOutput = - { + [ 4293035898, 4293101432, 4292903793, 4292838511, 4292837995, 4292771950, 4292903791, 4293299316, 4293563769, 4293629303, 4293363312, 4291913575, 4289282905, 4288692313, 4289349210, 4289809240, 4289743703, 4289874775, 4289940567, 4289743701, 4290137943, 4290860378, 4291058267, 4291386715, @@ -71,7 +73,7 @@ public class LosslessUtilsTests 4291913571, 4292044130, 4291978850, 4291847521, 4291847524, 4291847779, 4291913571, 4291848293, 4291651689, 4291585895, 4291519584, 4291715936, 4291520355, 4291650658, 4291847263, 4291913313, 4291847777, 4291781731, 4291783015 - }; + ]; LosslessUtils.AddGreenToBlueAndRed(pixelData); @@ -81,15 +83,15 @@ public class LosslessUtilsTests private static void RunTransformColorTest() { uint[] pixelData = - { + [ 5998579, 65790, 130301, 16646653, 196350, 130565, 16712702, 16583164, 16452092, 65790, 782600, 647446, 16571414, 16448771, 263931, 132601, 16711935, 131072, 511, 16711679, 132350, 329469, 16647676, 132093, 66303, 16647169, 16515584, 196607, 196096, 16646655, 514, 131326, 16712192, 327169, 16646655, 16776960, 3, 16712190, 511, 16646401, 16580612, 65535, 196092, 327425, 16319743, 392450, 196861, 16712192, 16711680, 130564, 16451071 - }; + ]; - var m = new Vp8LMultipliers() + Vp8LMultipliers m = new() { GreenToBlue = 240, GreenToRed = 232, @@ -97,13 +99,13 @@ public class LosslessUtilsTests }; uint[] expectedOutput = - { + [ 100279, 65790, 16710907, 16712190, 130813, 65028, 131840, 264449, 133377, 65790, 61697, 15917319, 14801924, 16317698, 591614, 394748, 16711935, 131072, 65792, 16711679, 328704, 656896, 132607, 328703, 197120, 66563, 16646657, 196607, 130815, 16711936, 131587, 131326, 66049, 261632, 16711936, 16776960, 3, 511, 65792, 16711938, 16580612, 65535, 65019, 327425, 16516097, 261377, 196861, 66049, 16711680, 65027, 16712962 - }; + ]; LosslessUtils.TransformColor(m, pixelData, pixelData.Length); @@ -113,15 +115,15 @@ public class LosslessUtilsTests private static void RunTransformColorInverseTest() { uint[] pixelData = - { + [ 100279, 65790, 16710907, 16712190, 130813, 65028, 131840, 264449, 133377, 65790, 61697, 15917319, 14801924, 16317698, 591614, 394748, 16711935, 131072, 65792, 16711679, 328704, 656896, 132607, 328703, 197120, 66563, 16646657, 196607, 130815, 16711936, 131587, 131326, 66049, 261632, 16711936, 16776960, 3, 511, 65792, 16711938, 16580612, 65535, 65019, 327425, 16516097, 261377, 196861, 66049, 16711680, 65027, 16712962 - }; + ]; - var m = new Vp8LMultipliers() + Vp8LMultipliers m = new() { GreenToBlue = 240, GreenToRed = 232, @@ -129,13 +131,13 @@ public class LosslessUtilsTests }; uint[] expectedOutput = - { + [ 5998579, 65790, 130301, 16646653, 196350, 130565, 16712702, 16583164, 16452092, 65790, 782600, 647446, 16571414, 16448771, 263931, 132601, 16711935, 131072, 511, 16711679, 132350, 329469, 16647676, 132093, 66303, 16647169, 16515584, 196607, 196096, 16646655, 514, 131326, 16712192, 327169, 16646655, 16776960, 3, 16712190, 511, 16646401, 16580612, 65535, 196092, 327425, 16319743, 392450, 196861, 16712192, 16711680, 130564, 16451071 - }; + ]; LosslessUtils.TransformColorInverse(m, pixelData); @@ -145,7 +147,7 @@ public class LosslessUtilsTests private static void RunPredictor11Test() { // arrange - uint[] topData = { 4278258949, 4278258949 }; + uint[] topData = [4278258949, 4278258949]; const uint left = 4294839812; short[] scratch = new short[8]; const uint expectedResult = 4294839812; @@ -166,7 +168,7 @@ public class LosslessUtilsTests private static void RunPredictor12Test() { // arrange - uint[] topData = { 4294844413, 4294779388 }; + uint[] topData = [4294844413, 4294779388]; const uint left = 4294844413; const uint expectedResult = 4294779388; @@ -186,10 +188,10 @@ public class LosslessUtilsTests private static void RunPredictor13Test() { // arrange - uint[] topData0 = { 4278193922, 4278193666 }; + uint[] topData0 = [4278193922, 4278193666]; const uint left0 = 4278193410; const uint expectedResult0 = 4278193154; - uint[] topData1 = { 4294933015, 4278219803 }; + uint[] topData1 = [4294933015, 4278219803]; const uint left1 = 4278236686; const uint expectedResult1 = 4278231571; uint actual0 = 0; @@ -218,17 +220,18 @@ public class LosslessUtilsTests public void BundleColorMap_WithXbitsZero_Works() { // arrange - byte[] row = { 238, 238, 238, 238, 238, 238, 240, 237, 240, 235, 223, 223, 218, 220, 226, 219, 220, 204, 218, 211, 218, 221, 254, 255 }; + byte[] row = [238, 238, 238, 238, 238, 238, 240, 237, 240, 235, 223, 223, 218, 220, 226, 219, 220, 204, 218, 211, 218, 221, 254, 255 + ]; int xBits = 0; uint[] actual = new uint[row.Length]; uint[] expected = - { + [ 4278251008, 4278251008, 4278251008, 4278251008, 4278251008, 4278251008, 4278251520, 4278250752, 4278251520, 4278250240, 4278247168, 4278247168, 4278245888, 4278246400, 4278247936, 4278246144, 4278246400, 4278242304, 4278245888, 4278244096, 4278245888, 4278246656, 4278255104, 4278255360 - }; + ]; // act LosslessUtils.BundleColorMap(row, actual.Length, xBits, actual); @@ -242,7 +245,7 @@ public class LosslessUtilsTests { // arrange byte[] row = - { + [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -251,17 +254,17 @@ public class LosslessUtilsTests 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 - }; + ]; int xBits = 2; uint[] actual = new uint[row.Length]; uint[] expected = - { + [ 4278233600, 4278233600, 4278233600, 4278233600, 4278255360, 4278255360, 4278255360, 4278255360, 4278233600, 4278233600, 4278233600, 4278233600, 4278255360, 4278255360, 4278255360, 4278255360, 4278211840, 4278211840, 4278211840, 4278211840, 4278255360, 4278255360, 4278255360, 4278255360, 4278255360, 4278255360, 4278255360, 4278255360, 4278255360, 4278255360, 4278255360, 4278206208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; + ]; // act LosslessUtils.BundleColorMap(row, actual.Length, xBits, actual); @@ -301,19 +304,19 @@ public class LosslessUtilsTests public void Predictor11_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.AllowAll); [Fact] - public void Predictor11_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.DisableSSE2); + public void Predictor11_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.DisableHWIntrinsic); [Fact] public void Predictor12_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.AllowAll); [Fact] - public void Predictor12_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.DisableSSE2); + public void Predictor12_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.DisableHWIntrinsic); [Fact] public void Predictor13_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.AllowAll); [Fact] - public void Predictor13_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.DisableSSE2); + public void Predictor13_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.DisableHWIntrinsic); [Fact] public void SubtractGreen_Works() => RunSubtractGreenTest(); @@ -328,7 +331,7 @@ public class LosslessUtilsTests public void SubtractGreen_Scalar_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableHWIntrinsic); [Fact] - public void SubtractGreen_WithoutAvxOrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSSE3); + public void SubtractGreen_WithoutAvxOrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); [Fact] public void AddGreenToBlueAndRed_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.AllowAll); @@ -337,13 +340,13 @@ public class LosslessUtilsTests public void AddGreenToBlueAndRed_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2); [Fact] - public void AddGreenToBlueAndRed_WithoutAVX2OrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableSSSE3); + public void AddGreenToBlueAndRed_WithoutAVX2OrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic); [Fact] public void TransformColor_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.AllowAll); [Fact] - public void TransformColor_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableSSE2); + public void TransformColor_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void TransformColor_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableAVX2); @@ -352,7 +355,7 @@ public class LosslessUtilsTests public void TransformColorInverse_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.AllowAll); [Fact] - public void TransformColorInverse_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableSSE2); + public void TransformColorInverse_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void TransformColorInverse_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableAVX2); diff --git a/tests/ImageSharp.Tests/Formats/WebP/LossyUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/LossyUtilsTests.cs index 73e7044f5..f4189933f 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/LossyUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/LossyUtilsTests.cs @@ -13,9 +13,10 @@ public class LossyUtilsTests private static void RunTransformTwoTest() { // arrange - short[] src = { 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 23, 0, 0, -23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + short[] src = [19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 23, 0, 0, -23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; byte[] dst = - { + [ 103, 103, 103, 103, 103, 103, 103, 103, 0, 0, 0, 0, 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 0, 0, 0, 0, 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, @@ -23,16 +24,16 @@ public class LossyUtilsTests 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 0, 0, 0, 0, 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, 0, 0, 0, 0 - }; + ]; byte[] expected = - { + [ 105, 105, 105, 105, 105, 103, 100, 98, 0, 0, 0, 0, 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, 103, 103, 103, 103, 105, 105, 105, 105, 108, 105, 102, 100, 0, 0, 0, 0, 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, 103, 103, 103, 103, 105, 105, 105, 105, 111, 109, 106, 103, 0, 0, 0, 0, 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, 103, 103, 103, 103, 105, 105, 105, 105, 113, 111, 108, 106, 0, 0, 0, 0, 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, 171, 171, 0, 0, 0, 0, 0, 0, 0, 0 - }; + ]; int[] scratch = new int[16]; // act @@ -45,9 +46,9 @@ public class LossyUtilsTests private static void RunTransformOneTest() { // arrange - short[] src = { -176, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + short[] src = [-176, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; byte[] dst = - { + [ 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, @@ -55,9 +56,9 @@ public class LossyUtilsTests 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129 - }; + ]; byte[] expected = - { + [ 111, 111, 111, 111, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 108, 108, 108, 108, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, @@ -65,7 +66,7 @@ public class LossyUtilsTests 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 101, 101, 101, 101, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 129 - }; + ]; int[] scratch = new int[16]; // act @@ -86,7 +87,7 @@ public class LossyUtilsTests a[i] = (byte)rand.Next(byte.MaxValue); b[i] = (byte)rand.Next(byte.MaxValue); } - int[] expected = { 2533110, 2818581, 2984663, 2891188, 2855134, 2634604, 2466504, 3061747, 2626010, 2640965 }; + int[] expected = [2533110, 2818581, 2984663, 2891188, 2855134, 2634604, 2466504, 3061747, 2626010, 2640965]; // act + assert int offset = 0; @@ -110,7 +111,7 @@ public class LossyUtilsTests a[i] = (byte)rand.Next(byte.MaxValue); b[i] = (byte)rand.Next(byte.MaxValue); } - int[] expected = { 1298274, 1234836, 1325264, 1493317, 1551995, 1432668, 1407891, 1483297, 1537930, 1317204 }; + int[] expected = [1298274, 1234836, 1325264, 1493317, 1551995, 1432668, 1407891, 1483297, 1537930, 1317204]; // act + assert int offset = 0; @@ -134,7 +135,7 @@ public class LossyUtilsTests a[i] = (byte)rand.Next(byte.MaxValue); b[i] = (byte)rand.Next(byte.MaxValue); } - int[] expected = { 194133, 125861, 165966, 195688, 106491, 173015, 266960, 200272, 311224, 122545 }; + int[] expected = [194133, 125861, 165966, 195688, 106491, 173015, 266960, 200272, 311224, 122545]; // act + assert int offset = 0; @@ -151,7 +152,7 @@ public class LossyUtilsTests { // arrange byte[] input = - { + [ 154, 145, 102, 115, 127, 129, 126, 125, 126, 120, 133, 152, 157, 153, 119, 94, 104, 116, 111, 113, 113, 109, 105, 124, 173, 175, 177, 170, 175, 172, 166, 164, 151, 141, 99, 114, 125, 126, 135, 150, 133, 115, 127, 149, 141, 168, 100, 54, 110, 117, 115, 116, 119, 115, 117, 130, 174, 174, 174, 157, @@ -159,9 +160,9 @@ public class LossyUtilsTests 109, 115, 113, 120, 120, 117, 128, 115, 174, 173, 173, 161, 152, 148, 153, 162, 105, 140, 96, 114, 115, 122, 141, 173, 190, 190, 142, 106, 151, 78, 66, 141, 110, 117, 123, 136, 118, 124, 127, 114, 173, 175, 166, 155, 155, 159, 159, 158 - }; + ]; uint[] dc = new uint[4]; - uint[] expectedDc = { 1940, 2139, 2252, 1813 }; + uint[] expectedDc = [1940, 2139, 2252, 1813]; // act LossyUtils.Mean16x4(input, dc); @@ -174,24 +175,24 @@ public class LossyUtilsTests { // arrange byte[] a = - { + [ 27, 27, 28, 29, 29, 28, 27, 27, 27, 28, 28, 29, 29, 28, 28, 27, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 29, 29, 28, 28, 27, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 27, 27, 26, 26, 26, 26, 27, 27, 27, 28, 28, 29, 29, 28, 28, 27, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 28, 27, 27, 26, 26, 27, 27, 28, 27, 28, 28, 29, 29, 28, 28, 27 - }; + ]; byte[] b = - { + [ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28 - }; + ]; - ushort[] w = { 38, 32, 20, 9, 32, 28, 17, 7, 20, 17, 10, 4, 9, 7, 4, 2 }; + ushort[] w = [38, 32, 20, 9, 32, 28, 17, 7, 20, 17, 10, 4, 9, 7, 4, 2]; int expected = 2; // act diff --git a/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs index b4279b045..16990c357 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs @@ -24,7 +24,7 @@ public class PredictorEncoderTests [Fact] public void ColorSpaceTransform_WithPeakImage_WithoutSSE41_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithPeakImage_ProducesExpectedData, HwIntrinsics.DisableSSE41); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithPeakImage_ProducesExpectedData, HwIntrinsics.DisableHWIntrinsic); [Fact] public void ColorSpaceTransform_WithBikeImage_WithHardwareIntrinsics_Works() @@ -32,7 +32,7 @@ public class PredictorEncoderTests [Fact] public void ColorSpaceTransform_WithBikeImage_WithoutSSE41_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithBikeImage_ProducesExpectedData, HwIntrinsics.DisableSSE41); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithBikeImage_ProducesExpectedData, HwIntrinsics.DisableHWIntrinsic); [Fact] public void ColorSpaceTransform_WithBikeImage_WithoutAvx2_Works() @@ -43,7 +43,7 @@ public class PredictorEncoderTests { // arrange uint[] expectedData = - { + [ 4278191104, 4278191104, 4278191104, 4278191104, 4278191104, 4278191104, 4278191104, 4294577152, 4294707200, 4294707200, 4294707200, 4294707200, 4294837248, 4294837248, 4293926912, 4294316544, 4278191104, 4278191104, 4294837248, 4294837248, 4280287232, 4280350720, 4294447104, 4294707200, @@ -76,7 +76,7 @@ public class PredictorEncoderTests 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4279503872, 4279503872, 4280288256, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232 - }; + ]; // Convert image pixels to bgra array. byte[] imgBytes = File.ReadAllBytes(TestImageFullPath(TestImages.Webp.Peak)); @@ -100,13 +100,13 @@ public class PredictorEncoderTests { // arrange uint[] expectedData = - { + [ 4278714368, 4278192876, 4278198304, 4278198304, 4278190304, 4278190080, 4278190080, 4278198272, 4278197760, 4278198816, 4278197794, 4278197774, 4278190080, 4278190080, 4278198816, 4278197281, 4278197280, 4278197792, 4278200353, 4278191343, 4278190304, 4294713873, 4278198784, 4294844416, 4278201578, 4278200044, 4278191343, 4278190288, 4294705200, 4294717139, 4278203628, 4278201064, 4278201586, 4278197792, 4279240909 - }; + ]; // Convert image pixels to bgra array. byte[] imgBytes = File.ReadAllBytes(TestImageFullPath(TestImages.Webp.Lossy.BikeSmall)); diff --git a/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs b/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs index 59691204b..3808ba6d0 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs @@ -12,13 +12,14 @@ public class QuantEncTests private static unsafe void RunQuantizeBlockTest() { // arrange - short[] input = { 378, 777, -851, 888, 259, 148, 0, -111, -185, -185, -74, -37, 148, 74, 111, 74 }; + short[] input = [378, 777, -851, 888, 259, 148, 0, -111, -185, -185, -74, -37, 148, 74, 111, 74]; short[] output = new short[16]; - ushort[] q = { 42, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37 }; - ushort[] iq = { 3120, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542 }; - uint[] bias = { 49152, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296 }; - uint[] zthresh = { 26, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21 }; - short[] expectedOutput = { 9, 21, 7, -5, 4, -23, 24, 0, -5, 4, 2, -2, -3, -1, 3, 2 }; + ushort[] q = [42, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37]; + ushort[] iq = [3120, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542, 3542]; + uint[] bias = [49152, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296, 55296 + ]; + uint[] zthresh = [26, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21]; + short[] expectedOutput = [9, 21, 7, -5, 4, -23, 24, 0, -5, 4, 2, -2, -3, -1, 3, 2]; int expectedResult = 1; Vp8Matrix vp8Matrix = default; for (int i = 0; i < 16; i++) @@ -44,7 +45,7 @@ public class QuantEncTests public void QuantizeBlock_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.AllowAll); [Fact] - public void QuantizeBlock_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableSSE2); + public void QuantizeBlock_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void QuantizeBlock_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableAVX2); diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8EncodingTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8EncodingTests.cs index dab071692..c0b14cdd7 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8EncodingTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8EncodingTests.cs @@ -12,12 +12,14 @@ public class Vp8EncodingTests private static void RunFTransform2Test() { // arrange - byte[] src = { 154, 154, 151, 151, 149, 148, 151, 157, 163, 163, 154, 132, 102, 98, 104, 108, 107, 104, 104, 103, 101, 106, 123, 119, 170, 171, 172, 171, 168, 175, 171, 173, 151, 151, 149, 150, 147, 147, 146, 159, 164, 165, 154, 129, 92, 90, 101, 105, 104, 103, 104, 101, 100, 105, 123, 117, 172, 172, 172, 168, 170, 177, 170, 175, 151, 149, 150, 150, 147, 147, 156, 161, 161, 161, 151, 126, 93, 90, 102, 107, 104, 103, 104, 101, 104, 104, 122, 117, 172, 172, 170, 168, 170, 177, 172, 175, 150, 149, 152, 151, 148, 151, 160, 159, 157, 157, 148, 133, 96, 90, 103, 107, 104, 104, 101, 100, 102, 102, 121, 117, 170, 170, 169, 171, 171, 179, 173, 175 }; - byte[] reference = { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 }; + byte[] src = [154, 154, 151, 151, 149, 148, 151, 157, 163, 163, 154, 132, 102, 98, 104, 108, 107, 104, 104, 103, 101, 106, 123, 119, 170, 171, 172, 171, 168, 175, 171, 173, 151, 151, 149, 150, 147, 147, 146, 159, 164, 165, 154, 129, 92, 90, 101, 105, 104, 103, 104, 101, 100, 105, 123, 117, 172, 172, 172, 168, 170, 177, 170, 175, 151, 149, 150, 150, 147, 147, 156, 161, 161, 161, 151, 126, 93, 90, 102, 107, 104, 103, 104, 101, 104, 104, 122, 117, 172, 172, 170, 168, 170, 177, 172, 175, 150, 149, 152, 151, 148, 151, 160, 159, 157, 157, 148, 133, 96, 90, 103, 107, 104, 104, 101, 100, 102, 102, 121, 117, 170, 170, 169, 171, 171, 179, 173, 175 + ]; + byte[] reference = [128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 + ]; short[] actualOutput1 = new short[16]; short[] actualOutput2 = new short[16]; - short[] expectedOutput1 = { 182, 4, 1, 1, 6, 7, -1, -4, 5, 0, -2, 1, 2, 1, 1, 1 }; - short[] expectedOutput2 = { 192, -34, 10, 1, -11, 8, 10, -7, 6, 3, -8, 4, 5, -3, -2, 6 }; + short[] expectedOutput1 = [182, 4, 1, 1, 6, 7, -1, -4, 5, 0, -2, 1, 2, 1, 1, 1]; + short[] expectedOutput2 = [192, -34, 10, 1, -11, 8, 10, -7, 6, 3, -8, 4, 5, -3, -2, 6]; // act Vp8Encoding.FTransform2(src, reference, actualOutput1, actualOutput2, new int[16]); @@ -31,7 +33,7 @@ public class Vp8EncodingTests { // arrange byte[] src = - { + [ 154, 154, 151, 151, 149, 148, 151, 157, 163, 163, 154, 132, 102, 98, 104, 108, 107, 104, 104, 103, 101, 106, 123, 119, 170, 171, 172, 171, 168, 175, 171, 173, 151, 151, 149, 150, 147, 147, 146, 159, 164, 165, 154, 129, 92, 90, 101, 105, 104, 103, 104, 101, 100, 105, 123, 117, 172, 172, 172, 168, @@ -39,9 +41,9 @@ public class Vp8EncodingTests 104, 103, 104, 101, 104, 104, 122, 117, 172, 172, 170, 168, 170, 177, 172, 175, 150, 149, 152, 151, 148, 151, 160, 159, 157, 157, 148, 133, 96, 90, 103, 107, 104, 104, 101, 100, 102, 102, 121, 117, 170, 170, 169, 171, 171, 179, 173, 175 - }; + ]; byte[] reference = - { + [ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, @@ -49,9 +51,9 @@ public class Vp8EncodingTests 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 - }; + ]; short[] actualOutput = new short[16]; - short[] expectedOutput = { 182, 4, 1, 1, 6, 7, -1, -4, 5, 0, -2, 1, 2, 1, 1, 1 }; + short[] expectedOutput = [182, 4, 1, 1, 6, 7, -1, -4, 5, 0, -2, 1, 2, 1, 1, 1]; // act Vp8Encoding.FTransform(src, reference, actualOutput, new int[16]); @@ -64,7 +66,7 @@ public class Vp8EncodingTests { // arrange byte[] reference = - { + [ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, @@ -72,17 +74,18 @@ public class Vp8EncodingTests 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 - }; - short[] input = { 1, 216, -48, 0, 96, -24, -48, 24, 0, -24, 24, 0, 0, 0, 0, 0, 38, -240, -72, -24, 0, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + ]; + short[] input = [1, 216, -48, 0, 96, -24, -48, 24, 0, -24, 24, 0, 0, 0, 0, 0, 38, -240, -72, -24, 0, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; byte[] dst = new byte[128]; byte[] expected = - { + [ 161, 160, 149, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 160, 133, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 147, 109, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 128, 87, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; + ]; int[] scratch = new int[16]; // act @@ -96,7 +99,7 @@ public class Vp8EncodingTests { // arrange byte[] reference = - { + [ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, @@ -104,17 +107,18 @@ public class Vp8EncodingTests 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129 - }; - short[] input = { 1, 216, -48, 0, 96, -24, -48, 24, 0, -24, 24, 0, 0, 0, 0, 0, 38, -240, -72, -24, 0, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + ]; + short[] input = [1, 216, -48, 0, 96, -24, -48, 24, 0, -24, 24, 0, 0, 0, 0, 0, 38, -240, -72, -24, 0, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; byte[] dst = new byte[128]; byte[] expected = - { + [ 161, 160, 149, 105, 78, 127, 156, 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 160, 133, 85, 81, 129, 155, 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 147, 109, 76, 85, 130, 153, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 128, 87, 83, 88, 132, 152, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; + ]; int[] scratch = new int[16]; // act diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs index a18eff73c..990c58385 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8HistogramTests.cs @@ -13,7 +13,7 @@ public class Vp8HistogramTests { get { - var result = new List(); + List result = new(); result.Add(new object[] { new byte[] @@ -69,7 +69,7 @@ public class Vp8HistogramTests private static void RunCollectHistogramTest() { // arrange - var histogram = new Vp8Histogram(); + Vp8Histogram histogram = new(); byte[] reference = { @@ -172,7 +172,7 @@ public class Vp8HistogramTests public void GetAlpha_WithEmptyHistogram_Works() { // arrange - var histogram = new Vp8Histogram(); + Vp8Histogram histogram = new(); // act int alpha = histogram.GetAlpha(); @@ -186,7 +186,7 @@ public class Vp8HistogramTests public void GetAlpha_Works(byte[] reference, byte[] pred) { // arrange - var histogram = new Vp8Histogram(); + Vp8Histogram histogram = new(); histogram.CollectHistogram(reference, pred, 0, 1); // act @@ -201,9 +201,9 @@ public class Vp8HistogramTests public void Merge_Works(byte[] reference, byte[] pred) { // arrange - var histogram1 = new Vp8Histogram(); + Vp8Histogram histogram1 = new(); histogram1.CollectHistogram(reference, pred, 0, 1); - var histogram2 = new Vp8Histogram(); + Vp8Histogram histogram2 = new(); histogram1.Merge(histogram2); // act diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8LHistogramTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8LHistogramTests.cs index cfe79e49e..8d8bcb57c 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8LHistogramTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8LHistogramTests.cs @@ -14,7 +14,7 @@ public class Vp8LHistogramTests { // arrange uint[] pixelData = - { + [ 4278191104, 4278191104, 4278191104, 4278191104, 4278191104, 4278191104, 4278191104, 4294577152, 4294707200, 4294707200, 4294707200, 4294707200, 4294837248, 4294837248, 4293926912, 4294316544, 4278191104, 4278191104, 4294837248, 4294837248, 4280287232, 4280350720, 4294447104, 4294707200, @@ -47,10 +47,10 @@ public class Vp8LHistogramTests 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4279503872, 4279503872, 4280288256, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232, 4280287232 - }; + ]; uint[] literals = - { + [ 198, 0, 14, 0, 46, 0, 22, 0, 36, 0, 24, 0, 12, 0, 10, 0, 10, 0, 2, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -59,25 +59,21 @@ public class Vp8LHistogramTests 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 6, 0, 2, 0, 2, 0, 2, 0, 0, 0, 8, 0, 2, 0, 38, 0, 4 - }; + ]; uint[] expectedLiterals = new uint[1305]; // All remaining values are expected to be zero. literals.AsSpan().CopyTo(expectedLiterals); - Vp8LBackwardRefs backwardRefs = new(pixelData.Length); + MemoryAllocator memoryAllocator = Configuration.Default.MemoryAllocator; + + using Vp8LBackwardRefs backwardRefs = new(memoryAllocator, pixelData.Length); for (int i = 0; i < pixelData.Length; i++) { - backwardRefs.Add(new PixOrCopy() - { - BgraOrDistance = pixelData[i], - Len = 1, - Mode = PixOrCopyMode.Literal - }); + backwardRefs.Add(PixOrCopy.CreateLiteral(pixelData[i])); } - MemoryAllocator memoryAllocator = Configuration.Default.MemoryAllocator; using OwnedVp8LHistogram histogram0 = OwnedVp8LHistogram.Create(memoryAllocator, backwardRefs, 3); using OwnedVp8LHistogram histogram1 = OwnedVp8LHistogram.Create(memoryAllocator, backwardRefs, 3); for (int i = 0; i < 5; i++) diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs index 0b85ececb..ded637967 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8ModeScoreTests.cs @@ -11,7 +11,7 @@ public class Vp8ModeScoreTests [Fact] public void InitScore_Works() { - var score = new Vp8ModeScore(); + Vp8ModeScore score = new(); score.InitScore(); Assert.Equal(0, score.D); Assert.Equal(0, score.SD); @@ -25,7 +25,7 @@ public class Vp8ModeScoreTests public void CopyScore_Works() { // arrange - var score1 = new Vp8ModeScore + Vp8ModeScore score1 = new() { Score = 123, Nz = 1, @@ -36,7 +36,7 @@ public class Vp8ModeScoreTests R = 6, SD = 7 }; - var score2 = new Vp8ModeScore(); + Vp8ModeScore score2 = new(); score2.InitScore(); // act @@ -55,7 +55,7 @@ public class Vp8ModeScoreTests public void AddScore_Works() { // arrange - var score1 = new Vp8ModeScore + Vp8ModeScore score1 = new() { Score = 123, Nz = 1, @@ -66,7 +66,7 @@ public class Vp8ModeScoreTests R = 6, SD = 7 }; - var score2 = new Vp8ModeScore + Vp8ModeScore score2 = new() { Score = 123, Nz = 1, diff --git a/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs b/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs index 4982929c2..2a0821108 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs @@ -239,7 +239,7 @@ public class Vp8ResidualTests { // arrange Vp8Residual residual = new(); - short[] coeffs = { 110, 0, -2, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0 }; + short[] coeffs = [110, 0, -2, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0]; // act residual.SetCoeffs(coeffs); @@ -252,5 +252,5 @@ public class Vp8ResidualTests public void SetCoeffsTest_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.AllowAll); [Fact] - public void SetCoeffsTest_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.DisableSSE2); + public void SetCoeffsTest_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.DisableHWIntrinsic); } diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs index 1491cd13c..3962d4f37 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs @@ -23,7 +23,7 @@ public class WebpCommonUtilsTests [Fact] public void CheckNonOpaque_WithOpaquePixels_WithoutSse2_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithOpaquePixelsTest, HwIntrinsics.DisableSSE2); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithOpaquePixelsTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void CheckNonOpaque_WithOpaquePixels_WithoutAvx2_Works() @@ -35,7 +35,7 @@ public class WebpCommonUtilsTests [Fact] public void CheckNonOpaque_WithNoneOpaquePixels_WithoutSse2_Works() - => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithNoneOpaquePixelsTest, HwIntrinsics.DisableSSE2); + => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithNoneOpaquePixelsTest, HwIntrinsics.DisableHWIntrinsic); [Fact] public void CheckNonOpaque_WithNoneOpaquePixels_WithoutAvx2_Works() @@ -45,7 +45,7 @@ public class WebpCommonUtilsTests { // arrange byte[] rowBytes = - { + [ 122, 120, 101, 255, 171, 165, 151, 255, 209, 208, 210, 255, @@ -104,8 +104,8 @@ public class WebpCommonUtilsTests 171, 165, 151, 0, 209, 208, 210, 100, 174, 183, 189, 255, - 148, 158, 158, 255, - }; + 148, 158, 158, 255 + ]; ReadOnlySpan row = MemoryMarshal.Cast(rowBytes); bool noneOpaque; @@ -127,7 +127,7 @@ public class WebpCommonUtilsTests { // arrange byte[] rowBytes = - { + [ 122, 120, 101, 255, 171, 165, 151, 255, 209, 208, 210, 255, @@ -186,8 +186,8 @@ public class WebpCommonUtilsTests 171, 165, 151, 255, 209, 208, 210, 255, 174, 183, 189, 255, - 148, 158, 158, 255, - }; + 148, 158, 158, 255 + ]; ReadOnlySpan row = MemoryMarshal.Cast(rowBytes); bool noneOpaque; diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs index 660ab2e66..a3e3b81cf 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs @@ -5,6 +5,7 @@ using System.Runtime.Intrinsics.X86; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Webp; using SixLabors.ImageSharp.Metadata; +using SixLabors.ImageSharp.Metadata.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Tests.TestUtilities; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; @@ -313,6 +314,21 @@ public class WebpDecoderTests Assert.Equal(12, image.Frames.Count); } + [Theory] + [InlineData(Lossless.Animated)] + public void Info_AnimatedLossless_VerifyAllFrames(string imagePath) + { + TestFile testFile = TestFile.Create(imagePath); + using MemoryStream stream = new(testFile.Bytes, false); + ImageInfo image = WebpDecoder.Instance.Identify(DecoderOptions.Default, stream); + WebpMetadata webpMetaData = image.Metadata.GetWebpMetadata(); + WebpFrameMetadata frameMetaData = image.FrameMetadataCollection[0].GetWebpMetadata(); + + Assert.Equal(0, webpMetaData.RepeatCount); + Assert.Equal(150U, frameMetaData.FrameDelay); + Assert.Equal(12, image.FrameCount); + } + [Theory] [WithFile(Lossy.Animated, PixelTypes.Rgba32)] public void Decode_AnimatedLossy_VerifyAllFrames(TestImageProvider provider) @@ -330,6 +346,21 @@ public class WebpDecoderTests Assert.Equal(12, image.Frames.Count); } + [Theory] + [InlineData(Lossy.Animated)] + public void Info_AnimatedLossy_VerifyAllFrames(string imagePath) + { + TestFile testFile = TestFile.Create(imagePath); + using MemoryStream stream = new(testFile.Bytes, false); + ImageInfo image = WebpDecoder.Instance.Identify(DecoderOptions.Default, stream); + WebpMetadata webpMetaData = image.Metadata.GetWebpMetadata(); + WebpFrameMetadata frameMetaData = image.FrameMetadataCollection[0].GetWebpMetadata(); + + Assert.Equal(0, webpMetaData.RepeatCount); + Assert.Equal(150U, frameMetaData.FrameDelay); + Assert.Equal(12, image.FrameCount); + } + [Theory] [WithFile(Lossless.Animated, PixelTypes.Rgba32)] public void Decode_AnimatedLossless_WithFrameDecodingModeFirst_OnlyDecodesOneFrame(TestImageProvider provider) @@ -348,7 +379,7 @@ public class WebpDecoderTests WebpDecoderOptions options = new() { BackgroundColorHandling = BackgroundColorHandling.Ignore, - GeneralOptions = new DecoderOptions() + GeneralOptions = new DecoderOptions { MaxFrames = 1 } @@ -387,7 +418,7 @@ public class WebpDecoderTests { DecoderOptions options = new() { - TargetSize = new() { Width = 150, Height = 150 } + TargetSize = new Size { Width = 150, Height = 150 } }; using Image image = provider.GetImage(WebpDecoder.Instance, options); @@ -459,7 +490,7 @@ public class WebpDecoderTests // Web using Image image = provider.GetImage( WebpDecoder.Instance, - new WebpDecoderOptions() { BackgroundColorHandling = BackgroundColorHandling.Ignore }); + new WebpDecoderOptions { BackgroundColorHandling = BackgroundColorHandling.Ignore }); // We can't use the reference decoder here. // It creates frames of different size without blending the frames. @@ -559,4 +590,35 @@ public class WebpDecoderTests image.DebugSave(provider); image.CompareToOriginal(provider, ReferenceDecoder); } + + [Theory] + [WithFile(Lossy.Issue2906, PixelTypes.Rgba32)] + public void WebpDecoder_CanDecode_Issue2906(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(WebpDecoder.Instance); + + ExifProfile exifProfile = image.Metadata.ExifProfile; + IExifValue comment = exifProfile.GetValue(ExifTag.UserComment); + + Assert.NotNull(comment); + Assert.Equal(EncodedString.CharacterCode.Unicode, comment.Value.Code); + Assert.StartsWith("1girl, pariya, ", comment.Value.Text); + + image.DebugSave(provider); + image.CompareToOriginal(provider, ReferenceDecoder); + } + + [Theory] + [WithFile(Icc.Perceptual, PixelTypes.Rgba32)] + [WithFile(Icc.PerceptualcLUTOnly, PixelTypes.Rgba32)] + public void Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(WebpDecoder.Instance, new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert }); + + image.DebugSave(provider); + image.CompareToReferenceOutput(provider); + Assert.Null(image.Metadata.IccProfile); + } } diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs index af6f7eea1..f9836ffb1 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs @@ -139,14 +139,14 @@ public class WebpEncoderTests }; provider.Utility.SaveTestOutputFile(image, "gif", gifEncoder, "octree"); - gifEncoder = new GifEncoder() + gifEncoder = new GifEncoder { Quantizer = new WuQuantizer(options) }; provider.Utility.SaveTestOutputFile(image, "gif", gifEncoder, "wu"); // Now clone and quantize the image using the same quantizers without alpha thresholding and save as webp. - options = new() + options = new QuantizerOptions { TransparencyThreshold = 0 }; diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs index ab8fef60f..020b42f37 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs @@ -103,9 +103,9 @@ public class WebpMetaDataTests public void Encode_WritesExifWithPadding(WebpFileFormatType fileFormatType) { // arrange - using var input = new Image(25, 25); - using var memoryStream = new MemoryStream(); - var expectedExif = new ExifProfile(); + using Image input = new(25, 25); + using MemoryStream memoryStream = new(); + ExifProfile expectedExif = new(); string expectedSoftware = "ImageSharp"; expectedExif.SetValue(ExifTag.Software, expectedSoftware); input.Metadata.ExifProfile = expectedExif; @@ -115,7 +115,7 @@ public class WebpMetaDataTests memoryStream.Position = 0; // assert - using var image = Image.Load(memoryStream); + using Image image = Image.Load(memoryStream); ExifProfile actualExif = image.Metadata.ExifProfile; Assert.NotNull(actualExif); Assert.Equal(expectedExif.Values.Count, actualExif.Values.Count); @@ -129,7 +129,7 @@ public class WebpMetaDataTests { // arrange using Image input = provider.GetImage(WebpDecoder.Instance); - using var memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new(); ExifProfile expectedExif = input.Metadata.ExifProfile; // act @@ -137,7 +137,7 @@ public class WebpMetaDataTests memoryStream.Position = 0; // assert - using var image = Image.Load(memoryStream); + using Image image = Image.Load(memoryStream); ExifProfile actualExif = image.Metadata.ExifProfile; Assert.NotNull(actualExif); Assert.Equal(expectedExif.Values.Count, actualExif.Values.Count); @@ -150,7 +150,7 @@ public class WebpMetaDataTests { // arrange using Image input = provider.GetImage(WebpDecoder.Instance); - using var memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new(); ExifProfile expectedExif = input.Metadata.ExifProfile; // act @@ -158,7 +158,7 @@ public class WebpMetaDataTests memoryStream.Position = 0; // assert - using var image = Image.Load(memoryStream); + using Image image = Image.Load(memoryStream); ExifProfile actualExif = image.Metadata.ExifProfile; Assert.NotNull(actualExif); Assert.Equal(expectedExif.Values.Count, actualExif.Values.Count); @@ -174,14 +174,14 @@ public class WebpMetaDataTests ImageSharp.Metadata.Profiles.Icc.IccProfile expectedProfile = input.Metadata.IccProfile; byte[] expectedProfileBytes = expectedProfile.ToByteArray(); - using var memStream = new MemoryStream(); + using MemoryStream memStream = new(); input.Save(memStream, new WebpEncoder() { FileFormat = fileFormat }); memStream.Position = 0; - using var output = Image.Load(memStream); + using Image output = Image.Load(memStream); ImageSharp.Metadata.Profiles.Icc.IccProfile actualProfile = output.Metadata.IccProfile; byte[] actualProfileBytes = actualProfile.ToByteArray(); diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpVp8XTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpVp8XTests.cs new file mode 100644 index 000000000..78be0bf9f --- /dev/null +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpVp8XTests.cs @@ -0,0 +1,26 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using SixLabors.ImageSharp.Formats.Webp.Chunks; + +namespace SixLabors.ImageSharp.Tests.Formats.WebP; + +[Trait("Format", "Webp")] +public class WebpVp8XTests +{ + [Fact] + public void WebpVp8X_WriteTo_Writes_Reserved_Bytes() + { + // arrange + WebpVp8X header = new(false, false, false, false, false, 10, 40); + MemoryStream ms = new(); + byte[] expected = [86, 80, 56, 88, 10, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 39, 0, 0]; + + // act + header.WriteTo(ms); + + // assert + byte[] actual = ms.ToArray(); + Assert.Equal(expected, actual); + } +} diff --git a/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs b/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs index f50bc8933..482c41b25 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs @@ -19,7 +19,7 @@ public class YuvConversionTests public static void RunUpSampleYuvToRgbTest() { - var provider = TestImageProvider.File(TestImageLossyFullPath); + TestImageProvider provider = TestImageProvider.File(TestImageLossyFullPath); using Image image = provider.GetImage(WebpDecoder.Instance); image.DebugSave(provider); image.CompareToOriginal(provider, ReferenceDecoder); @@ -32,7 +32,7 @@ public class YuvConversionTests public void UpSampleYuvToRgb_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.AllowAll); [Fact] - public void UpSampleYuvToRgb_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.DisableSSE2); + public void UpSampleYuvToRgb_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.DisableHWIntrinsic); [Theory] [WithFile(TestImages.Webp.Yuv, PixelTypes.Rgba32)] @@ -52,7 +52,7 @@ public class YuvConversionTests Span u = uBuffer.GetSpan(); Span v = vBuffer.GetSpan(); byte[] expectedY = - { + [ 82, 82, 82, 82, 128, 135, 134, 129, 167, 179, 176, 172, 192, 201, 200, 204, 188, 172, 175, 177, 168, 151, 154, 154, 153, 152, 151, 151, 152, 160, 160, 160, 160, 82, 82, 82, 82, 140, 137, 135, 116, 174, 183, 176, 162, 196, 199, 199, 210, 188, 166, 176, 181, 170, 145, 155, 154, 153, 154, 151, 151, 150, @@ -106,9 +106,9 @@ public class YuvConversionTests 86, 75, 72, 77, 106, 96, 97, 96, 97, 100, 100, 100, 160, 160, 160, 159, 169, 170, 168, 170, 129, 115, 117, 123, 90, 71, 76, 79, 62, 51, 51, 47, 59, 79, 75, 74, 81, 100, 97, 98, 98, 100, 100, 100, 100 - }; + ]; byte[] expectedU = - { + [ 90, 90, 59, 63, 36, 38, 23, 20, 34, 35, 47, 48, 70, 82, 104, 121, 121, 90, 90, 61, 69, 37, 42, 22, 18, 33, 32, 47, 47, 67, 75, 97, 113, 120, 59, 61, 30, 37, 22, 20, 38, 36, 50, 50, 78, 83, 113, 122, 142, 166, 164, 63, 69, 37, 43, 20, 18, 34, 32, 48, 47, 70, 73, 102, 110, 136, 166, 166, 36, 37, 22, @@ -123,9 +123,9 @@ public class YuvConversionTests 184, 212, 208, 227, 228, 227, 229, 218, 214, 196, 185, 188, 121, 113, 166, 166, 197, 191, 220, 217, 232, 237, 223, 222, 211, 208, 185, 173, 172, 121, 120, 164, 166, 193, 194, 217, 219, 232, 235, 224, 220, 212, 207, 188, 172, 172 - }; + ]; byte[] expectedV = - { + [ 240, 240, 201, 206, 172, 174, 136, 136, 92, 90, 55, 50, 37, 30, 26, 23, 23, 240, 240, 204, 213, 173, 179, 141, 141, 96, 98, 56, 54, 38, 31, 27, 25, 23, 201, 204, 164, 172, 129, 135, 82, 87, 46, 47, 33, 29, 25, 23, 20, 16, 16, 206, 213, 172, 180, 137, 141, 93, 99, 54, 54, 36, 31, 26, 25, 21, 17, 16, @@ -139,7 +139,7 @@ public class YuvConversionTests 118, 151, 164, 188, 205, 206, 26, 27, 20, 21, 43, 39, 74, 69, 103, 102, 138, 143, 174, 188, 204, 216, 218, 23, 25, 16, 17, 55, 48, 85, 81, 117, 118, 159, 164, 195, 205, 216, 227, 227, 23, 23, 16, 16, 51, 52, 81, 83, 116, 122, 157, 168, 194, 206, 218, 227, 227 - }; + ]; // act YuvConversion.ConvertRgbToYuv(image.Frames.RootFrame.PixelBuffer.GetRegion(), config, memoryAllocator, y, u, v); @@ -169,7 +169,7 @@ public class YuvConversionTests Span u = uBuffer.GetSpan(); Span v = vBuffer.GetSpan(); byte[] expectedY = - { + [ 16, 16, 16, 16, 16, 235, 235, 235, 235, 235, 16, 16, 16, 16, 16, 152, 41, 41, 152, 152, 41, 41, 152, 152, 41, 41, 152, 152, 41, 41, 152, 16, 16, 16, 16, 16, 235, 235, 235, 235, 235, 16, 16, 16, 16, 16, 152, 41, 41, 152, 152, 41, 41, 152, 152, 41, 41, 152, 152, 41, 41, 152, 16, 16, 16, 16, 16, 235, @@ -213,9 +213,9 @@ public class YuvConversionTests 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 29, 106, 183, 66, 143, 130, 78, 90, 168, 116, 103, 180, 63, 140, 152, 75, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 93, 171, 53, 131, 118, 66, 78, 155, 103, 90, 167, 50, 128, 140, 63, 75 - }; + ]; byte[] expectedU = - { + [ 128, 128, 128, 128, 128, 128, 128, 139, 240, 139, 240, 139, 240, 139, 240, 139, 128, 128, 128, 128, 128, 128, 128, 139, 240, 139, 240, 139, 240, 139, 240, 139, 128, 128, 128, 128, 128, 128, 128, 139, 240, 139, 240, 139, 240, 139, 240, 139, 128, 128, 128, 128, 128, 128, 128, 139, 240, 139, 240, 139, @@ -229,9 +229,9 @@ public class YuvConversionTests 159, 159, 159, 159, 159, 159, 159, 161, 112, 113, 138, 87, 143, 112, 88, 161, 240, 240, 240, 240, 240, 240, 240, 137, 110, 162, 110, 140, 158, 104, 159, 137, 240, 240, 240, 240, 240, 240, 240, 109, 150, 108, 140, 161, 80, 157, 162, 128 - }; + ]; byte[] expectedV = - { + [ 128, 128, 128, 128, 128, 128, 128, 189, 110, 189, 110, 189, 110, 189, 110, 189, 128, 128, 128, 128, 128, 128, 128, 189, 110, 189, 110, 189, 110, 189, 110, 189, 128, 128, 128, 128, 128, 128, 128, 189, 110, 189, 110, 189, 110, 189, 110, 189, 128, 128, 128, 128, 128, 128, 128, 189, 110, 189, 110, 189, @@ -245,7 +245,7 @@ public class YuvConversionTests 141, 165, 126, 147, 173, 101, 101, 101, 101, 101, 101, 101, 135, 109, 129, 122, 124, 107, 108, 128, 138, 110, 110, 110, 110, 110, 110, 110, 117, 137, 151, 127, 114, 131, 139, 142, 120, 110, 110, 110, 110, 110, 110, 110, 142, 156, 119, 137, 167, 141, 151, 66, 85 - }; + ]; // act YuvConversion.ConvertRgbToYuv(image.Frames.RootFrame.PixelBuffer.GetRegion(), config, memoryAllocator, y, u, v); diff --git a/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs b/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs index d663a803b..682f5373d 100644 --- a/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs +++ b/tests/ImageSharp.Tests/GraphicOptionsDefaultsExtensionsTests.cs @@ -12,9 +12,9 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void SetDefaultOptionsOnProcessingContext() { - var option = new GraphicsOptions(); - var config = new Configuration(); - var context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + GraphicsOptions option = new(); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.SetGraphicsOptions(option); @@ -26,12 +26,12 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void UpdateDefaultOptionsOnProcessingContext_AlwaysNewInstance() { - var option = new GraphicsOptions() + GraphicsOptions option = new() { BlendPercentage = 0.9f }; - var config = new Configuration(); - var context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.SetGraphicsOptions(option); context.SetGraphicsOptions(o => @@ -40,7 +40,7 @@ public class GraphicOptionsDefaultsExtensionsTests o.BlendPercentage = 0.4f; }); - var returnedOption = context.GetGraphicsOptions(); + GraphicsOptions returnedOption = context.GetGraphicsOptions(); Assert.Equal(0.4f, returnedOption.BlendPercentage); Assert.Equal(0.9f, option.BlendPercentage); // hasn't been mutated } @@ -48,8 +48,8 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void SetDefaultOptionsOnConfiguration() { - var option = new GraphicsOptions(); - var config = new Configuration(); + GraphicsOptions option = new(); + Configuration config = new(); config.SetGraphicsOptions(option); @@ -59,11 +59,11 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void UpdateDefaultOptionsOnConfiguration_AlwaysNewInstance() { - var option = new GraphicsOptions() + GraphicsOptions option = new() { BlendPercentage = 0.9f }; - var config = new Configuration(); + Configuration config = new(); config.SetGraphicsOptions(option); config.SetGraphicsOptions(o => @@ -72,7 +72,7 @@ public class GraphicOptionsDefaultsExtensionsTests o.BlendPercentage = 0.4f; }); - var returnedOption = config.GetGraphicsOptions(); + GraphicsOptions returnedOption = config.GetGraphicsOptions(); Assert.Equal(0.4f, returnedOption.BlendPercentage); Assert.Equal(0.9f, option.BlendPercentage); // hasn't been mutated } @@ -80,13 +80,13 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromConfiguration_SettingNullThenReturnsNewInstance() { - var config = new Configuration(); + Configuration config = new(); - var options = config.GetGraphicsOptions(); + GraphicsOptions options = config.GetGraphicsOptions(); Assert.NotNull(options); config.SetGraphicsOptions((GraphicsOptions)null); - var options2 = config.GetGraphicsOptions(); + GraphicsOptions options2 = config.GetGraphicsOptions(); Assert.NotNull(options2); // we set it to null should now be a new instance @@ -96,10 +96,10 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromConfiguration_IgnoreIncorectlyTypesDictionEntry() { - var config = new Configuration(); + Configuration config = new(); config.Properties[typeof(GraphicsOptions)] = "wronge type"; - var options = config.GetGraphicsOptions(); + GraphicsOptions options = config.GetGraphicsOptions(); Assert.NotNull(options); Assert.IsType(options); } @@ -107,63 +107,63 @@ public class GraphicOptionsDefaultsExtensionsTests [Fact] public void GetDefaultOptionsFromConfiguration_AlwaysReturnsInstance() { - var config = new Configuration(); + Configuration config = new(); Assert.DoesNotContain(typeof(GraphicsOptions), config.Properties.Keys); - var options = config.GetGraphicsOptions(); + GraphicsOptions options = config.GetGraphicsOptions(); Assert.NotNull(options); } [Fact] public void GetDefaultOptionsFromConfiguration_AlwaysReturnsSameValue() { - var config = new Configuration(); + Configuration config = new(); - var options = config.GetGraphicsOptions(); - var options2 = config.GetGraphicsOptions(); + GraphicsOptions options = config.GetGraphicsOptions(); + GraphicsOptions options2 = config.GetGraphicsOptions(); Assert.Equal(options, options2); } [Fact] public void GetDefaultOptionsFromProcessingContext_AlwaysReturnsInstance() { - var config = new Configuration(); - var context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); - var ctxOptions = context.GetGraphicsOptions(); + GraphicsOptions ctxOptions = context.GetGraphicsOptions(); Assert.NotNull(ctxOptions); } [Fact] public void GetDefaultOptionsFromProcessingContext_AlwaysReturnsInstanceEvenIfSetToNull() { - var config = new Configuration(); - var context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.SetGraphicsOptions((GraphicsOptions)null); - var ctxOptions = context.GetGraphicsOptions(); + GraphicsOptions ctxOptions = context.GetGraphicsOptions(); Assert.NotNull(ctxOptions); } [Fact] public void GetDefaultOptionsFromProcessingContext_FallbackToConfigsInstance() { - var option = new GraphicsOptions(); - var config = new Configuration(); + GraphicsOptions option = new(); + Configuration config = new(); config.SetGraphicsOptions(option); - var context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); - var ctxOptions = context.GetGraphicsOptions(); + GraphicsOptions ctxOptions = context.GetGraphicsOptions(); Assert.Equal(option, ctxOptions); } [Fact] public void GetDefaultOptionsFromProcessingContext_IgnoreIncorectlyTypesDictionEntry() { - var config = new Configuration(); - var context = new FakeImageOperationsProvider.FakeImageOperations(config, null, true); + Configuration config = new(); + FakeImageOperationsProvider.FakeImageOperations context = new(config, null, true); context.Properties[typeof(GraphicsOptions)] = "wronge type"; - var options = context.GetGraphicsOptions(); + GraphicsOptions options = context.GetGraphicsOptions(); Assert.NotNull(options); Assert.IsType(options); } diff --git a/tests/ImageSharp.Tests/GraphicsOptionsTests.cs b/tests/ImageSharp.Tests/GraphicsOptionsTests.cs index 353159986..0ccb80d3f 100644 --- a/tests/ImageSharp.Tests/GraphicsOptionsTests.cs +++ b/tests/ImageSharp.Tests/GraphicsOptionsTests.cs @@ -8,8 +8,8 @@ namespace SixLabors.ImageSharp.Tests; public class GraphicsOptionsTests { - private static readonly GraphicsOptionsComparer GraphicsOptionsComparer = new GraphicsOptionsComparer(); - private readonly GraphicsOptions newGraphicsOptions = new GraphicsOptions(); + private static readonly GraphicsOptionsComparer GraphicsOptionsComparer = new(); + private readonly GraphicsOptions newGraphicsOptions = new(); private readonly GraphicsOptions cloneGraphicsOptions = new GraphicsOptions().DeepClone(); [Fact] @@ -57,7 +57,7 @@ public class GraphicsOptionsTests [Fact] public void NonDefaultClone() { - var expected = new GraphicsOptions + GraphicsOptions expected = new() { AlphaCompositionMode = PixelAlphaCompositionMode.DestAtop, Antialias = false, @@ -74,7 +74,7 @@ public class GraphicsOptionsTests [Fact] public void CloneIsDeep() { - var expected = new GraphicsOptions(); + GraphicsOptions expected = new(); GraphicsOptions actual = expected.DeepClone(); actual.AlphaCompositionMode = PixelAlphaCompositionMode.DestAtop; diff --git a/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs b/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs index 4c06d0cd5..1bf137f34 100644 --- a/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs +++ b/tests/ImageSharp.Tests/Helpers/ColorNumericsTests.cs @@ -15,7 +15,7 @@ public class ColorNumericsTests public void GetBT709Luminance_WithVector4(float x, float y, float z, int luminanceLevels, int expected) { // arrange - var vector = new Vector4(x, y, z, 0.0f); + Vector4 vector = new(x, y, z, 0.0f); // act int actual = ColorNumerics.GetBT709Luminance(ref vector, luminanceLevels); diff --git a/tests/ImageSharp.Tests/Helpers/NumericsTests.cs b/tests/ImageSharp.Tests/Helpers/NumericsTests.cs index 75f988a4c..1106144c4 100644 --- a/tests/ImageSharp.Tests/Helpers/NumericsTests.cs +++ b/tests/ImageSharp.Tests/Helpers/NumericsTests.cs @@ -9,7 +9,7 @@ public class NumericsTests { private delegate void SpanAction(Span span, TArg arg, TArg1 arg1); - private readonly ApproximateFloatComparer approximateFloatComparer = new ApproximateFloatComparer(1e-6f); + private readonly ApproximateFloatComparer approximateFloatComparer = new(1e-6f); [Theory] [InlineData(0)] @@ -162,7 +162,7 @@ public class NumericsTests [InlineData(63)] public void PremultiplyVectorSpan(int length) { - var rnd = new Random(42); + Random rnd = new(42); Vector4[] source = rnd.GenerateRandomVectorArray(length, 0, 1); Vector4[] expected = source.Select(v => { @@ -182,7 +182,7 @@ public class NumericsTests [InlineData(63)] public void UnPremultiplyVectorSpan(int length) { - var rnd = new Random(42); + Random rnd = new(42); Vector4[] source = rnd.GenerateRandomVectorArray(length, 0, 1); Vector4[] expected = source.Select(v => { @@ -280,7 +280,7 @@ public class NumericsTests { Span actual = new T[length]; - var r = new Random(); + Random r = new(); for (int i = 0; i < length; i++) { actual[i] = (T)Convert.ChangeType(r.Next(byte.MinValue, byte.MaxValue), typeof(T)); diff --git a/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs b/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs index c13a30052..983c3cc2b 100644 --- a/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs +++ b/tests/ImageSharp.Tests/Helpers/ParallelExecutionSettingsTests.cs @@ -28,7 +28,7 @@ public class ParallelExecutionSettingsTests } else { - var parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, Configuration.Default.MemoryAllocator); Assert.Equal(maxDegreeOfParallelism, parallelSettings.MaxDegreeOfParallelism); diff --git a/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs b/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs index d393850d6..4b06f877f 100644 --- a/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs +++ b/tests/ImageSharp.Tests/Helpers/ParallelRowIteratorTests.cs @@ -26,7 +26,7 @@ public class ParallelRowIteratorTests /// maxDegreeOfParallelism, minY, maxY, expectedStepLength, expectedLastStepLength /// public static TheoryData IterateRows_OverMinimumPixelsLimit_Data = - new TheoryData + new() { { 1, 0, 100, -1, 100, 1 }, { 2, 0, 9, 5, 4, 2 }, @@ -52,12 +52,12 @@ public class ParallelRowIteratorTests int expectedLastStepLength, int expectedNumberOfSteps) { - var parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, 1, Configuration.Default.MemoryAllocator); - var rectangle = new Rectangle(0, minY, 10, maxY - minY); + Rectangle rectangle = new(0, minY, 10, maxY - minY); int actualNumberOfSteps = 0; @@ -73,7 +73,7 @@ public class ParallelRowIteratorTests Assert.Equal(expected, step); } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ParallelRowIterator.IterateRowIntervals( rectangle, @@ -93,15 +93,15 @@ public class ParallelRowIteratorTests int expectedLastStepLength, int expectedNumberOfSteps) { - var parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, 1, Configuration.Default.MemoryAllocator); - var rectangle = new Rectangle(0, minY, 10, maxY - minY); + Rectangle rectangle = new(0, minY, 10, maxY - minY); int[] expectedData = Enumerable.Repeat(0, minY).Concat(Enumerable.Range(minY, maxY - minY)).ToArray(); - var actualData = new int[maxY]; + int[] actualData = new int[maxY]; void RowAction(RowInterval rows) { @@ -111,7 +111,7 @@ public class ParallelRowIteratorTests } } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ParallelRowIterator.IterateRowIntervals( rectangle, @@ -131,12 +131,12 @@ public class ParallelRowIteratorTests int expectedLastStepLength, int expectedNumberOfSteps) { - var parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, 1, Configuration.Default.MemoryAllocator); - var rectangle = new Rectangle(0, minY, 10, maxY - minY); + Rectangle rectangle = new(0, minY, 10, maxY - minY); int actualNumberOfSteps = 0; @@ -152,7 +152,7 @@ public class ParallelRowIteratorTests Assert.Equal(expected, step); } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ParallelRowIterator.IterateRowIntervals, Vector4>( rectangle, @@ -172,15 +172,15 @@ public class ParallelRowIteratorTests int expectedLastStepLength, int expectedNumberOfSteps) { - var parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, 1, Configuration.Default.MemoryAllocator); - var rectangle = new Rectangle(0, minY, 10, maxY - minY); + Rectangle rectangle = new(0, minY, 10, maxY - minY); int[] expectedData = Enumerable.Repeat(0, minY).Concat(Enumerable.Range(minY, maxY - minY)).ToArray(); - var actualData = new int[maxY]; + int[] actualData = new int[maxY]; void RowAction(RowInterval rows, Span buffer) { @@ -190,7 +190,7 @@ public class ParallelRowIteratorTests } } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ParallelRowIterator.IterateRowIntervals, Vector4>( rectangle, @@ -201,7 +201,7 @@ public class ParallelRowIteratorTests } public static TheoryData IterateRows_WithEffectiveMinimumPixelsLimit_Data = - new TheoryData + new() { { 2, 200, 50, 2, 1, -1, 2 }, { 2, 200, 200, 1, 1, -1, 1 }, @@ -223,12 +223,12 @@ public class ParallelRowIteratorTests int expectedStepLength, int expectedLastStepLength) { - var parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, minimumPixelsProcessedPerTask, Configuration.Default.MemoryAllocator); - var rectangle = new Rectangle(0, 0, width, height); + Rectangle rectangle = new(0, 0, width, height); int actualNumberOfSteps = 0; @@ -244,7 +244,7 @@ public class ParallelRowIteratorTests Assert.Equal(expected, step); } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ParallelRowIterator.IterateRowIntervals( rectangle, @@ -265,12 +265,12 @@ public class ParallelRowIteratorTests int expectedStepLength, int expectedLastStepLength) { - var parallelSettings = new ParallelExecutionSettings( + ParallelExecutionSettings parallelSettings = new( maxDegreeOfParallelism, minimumPixelsProcessedPerTask, Configuration.Default.MemoryAllocator); - var rectangle = new Rectangle(0, 0, width, height); + Rectangle rectangle = new(0, 0, width, height); int actualNumberOfSteps = 0; @@ -286,7 +286,7 @@ public class ParallelRowIteratorTests Assert.Equal(expected, step); } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ParallelRowIterator.IterateRowIntervals, Vector4>( rectangle, @@ -297,7 +297,7 @@ public class ParallelRowIteratorTests } public static readonly TheoryData IterateRectangularBuffer_Data = - new TheoryData + new() { { 8, 582, 453, 10, 10, 291, 226 }, // boundary data from DetectEdgesTest.DetectEdges_InBox { 2, 582, 453, 10, 10, 291, 226 }, @@ -322,7 +322,7 @@ public class ParallelRowIteratorTests using (Buffer2D expected = memoryAllocator.Allocate2D(bufferWidth, bufferHeight, AllocationOptions.Clean)) using (Buffer2D actual = memoryAllocator.Allocate2D(bufferWidth, bufferHeight, AllocationOptions.Clean)) { - var rect = new Rectangle(rectX, rectY, rectWidth, rectHeight); + Rectangle rect = new(rectX, rectY, rectWidth, rectHeight); void FillRow(int y, Buffer2D buffer) { @@ -339,7 +339,7 @@ public class ParallelRowIteratorTests } // Fill actual data using IterateRows: - var settings = new ParallelExecutionSettings(maxDegreeOfParallelism, memoryAllocator); + ParallelExecutionSettings settings = new(maxDegreeOfParallelism, memoryAllocator); void RowAction(RowInterval rows) { @@ -350,7 +350,7 @@ public class ParallelRowIteratorTests } } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ParallelRowIterator.IterateRowIntervals( rect, @@ -369,15 +369,15 @@ public class ParallelRowIteratorTests [InlineData(10, -10)] public void IterateRowsRequiresValidRectangle(int width, int height) { - var parallelSettings = default(ParallelExecutionSettings); + ParallelExecutionSettings parallelSettings = default(ParallelExecutionSettings); - var rect = new Rectangle(0, 0, width, height); + Rectangle rect = new(0, 0, width, height); void RowAction(RowInterval rows) { } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ArgumentOutOfRangeException ex = Assert.Throws( () => ParallelRowIterator.IterateRowIntervals(rect, in parallelSettings, in operation)); @@ -392,15 +392,15 @@ public class ParallelRowIteratorTests [InlineData(10, -10)] public void IterateRowsWithTempBufferRequiresValidRectangle(int width, int height) { - var parallelSettings = default(ParallelExecutionSettings); + ParallelExecutionSettings parallelSettings = default(ParallelExecutionSettings); - var rect = new Rectangle(0, 0, width, height); + Rectangle rect = new(0, 0, width, height); void RowAction(RowInterval rows, Span memory) { } - var operation = new TestRowIntervalOperation(RowAction); + TestRowIntervalOperation operation = new(RowAction); ArgumentOutOfRangeException ex = Assert.Throws( () => ParallelRowIterator.IterateRowIntervals, Rgba32>(rect, in parallelSettings, in operation)); @@ -434,7 +434,7 @@ public class ParallelRowIteratorTests { } - public StrongBox MaxY { get; } = new StrongBox(); + public StrongBox MaxY { get; } = new(); public void Invoke(int y) { diff --git a/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs b/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs index 95f1d4e28..215cd58bc 100644 --- a/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs +++ b/tests/ImageSharp.Tests/Helpers/RowIntervalTests.cs @@ -10,7 +10,7 @@ public class RowIntervalTests [Fact] public void Slice1() { - var rowInterval = new RowInterval(10, 20); + RowInterval rowInterval = new(10, 20); RowInterval sliced = rowInterval.Slice(5); Assert.Equal(15, sliced.Min); @@ -20,7 +20,7 @@ public class RowIntervalTests [Fact] public void Slice2() { - var rowInterval = new RowInterval(10, 20); + RowInterval rowInterval = new(10, 20); RowInterval sliced = rowInterval.Slice(3, 5); Assert.Equal(13, sliced.Min); @@ -30,8 +30,8 @@ public class RowIntervalTests [Fact] public void Equality_WhenTrue() { - var a = new RowInterval(42, 123); - var b = new RowInterval(42, 123); + RowInterval a = new(42, 123); + RowInterval b = new(42, 123); Assert.True(a.Equals(b)); Assert.True(a.Equals((object)b)); @@ -42,9 +42,9 @@ public class RowIntervalTests [Fact] public void Equality_WhenFalse() { - var a = new RowInterval(42, 123); - var b = new RowInterval(42, 125); - var c = new RowInterval(40, 123); + RowInterval a = new(42, 123); + RowInterval b = new(42, 125); + RowInterval c = new(40, 123); Assert.False(a.Equals(b)); Assert.False(c.Equals(a)); diff --git a/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs b/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs index 64f79840c..0cacbdc87 100644 --- a/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs +++ b/tests/ImageSharp.Tests/Helpers/TolerantMathTests.cs @@ -7,7 +7,7 @@ namespace SixLabors.ImageSharp.Tests.Helpers; public class TolerantMathTests { - private readonly TolerantMath tolerantMath = new TolerantMath(0.1); + private readonly TolerantMath tolerantMath = new(0.1); [Theory] [InlineData(0)] diff --git a/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs b/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs index 390170cfe..89256507e 100644 --- a/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs +++ b/tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs @@ -47,14 +47,14 @@ public class ChunkedMemoryStreamTests ChunkedMemoryStream ms2 = new(this.allocator); Assert.Throws(() => ms2.Read(null, 0, 0)); - Assert.Throws(() => ms2.Read(new byte[] { 1 }, -1, 0)); - Assert.Throws(() => ms2.Read(new byte[] { 1 }, 0, -1)); - Assert.Throws(() => ms2.Read(new byte[] { 1 }, 2, 0)); - Assert.Throws(() => ms2.Read(new byte[] { 1 }, 0, 2)); + Assert.Throws(() => ms2.Read([1], -1, 0)); + Assert.Throws(() => ms2.Read([1], 0, -1)); + Assert.Throws(() => ms2.Read([1], 2, 0)); + Assert.Throws(() => ms2.Read([1], 0, 2)); ms2.Dispose(); - Assert.Throws(() => ms2.Read(new byte[] { 1 }, 0, 1)); + Assert.Throws(() => ms2.Read([1], 0, 1)); } [Theory] @@ -229,7 +229,7 @@ public class ChunkedMemoryStreamTests { using ChunkedMemoryStream ms2 = new(this.allocator); byte[] bytArrRet; - byte[] bytArr = new byte[] { byte.MinValue, byte.MaxValue, 1, 2, 3, 4, 5, 6, 128, 250 }; + byte[] bytArr = [byte.MinValue, byte.MaxValue, 1, 2, 3, 4, 5, 6, 128, 250]; for (int i = 0; i < bytArr.Length; i++) { @@ -254,7 +254,7 @@ public class ChunkedMemoryStreamTests using ChunkedMemoryStream ms2 = new(this.allocator); Assert.Throws(() => ms2.WriteTo(null)); - ms2.Write(new byte[] { 1 }, 0, 1); + ms2.Write([1], 0, 1); MemoryStream readonlyStream = new(new byte[1028], false); Assert.Throws(() => ms2.WriteTo(readonlyStream)); @@ -313,7 +313,7 @@ public class ChunkedMemoryStreamTests IEnumerable allImageFiles = Directory.EnumerateFiles(TestEnvironment.InputImagesDirectoryFullPath, "*.*", SearchOption.AllDirectories) .Where(s => !s.EndsWith("txt", StringComparison.OrdinalIgnoreCase)); - List result = new(); + List result = []; foreach (string path in allImageFiles) { result.Add(path[TestEnvironment.InputImagesDirectoryFullPath.Length..]); @@ -396,22 +396,22 @@ public class ChunkedMemoryStreamTests public static IEnumerable CopyToData() { // Stream is positioned @ beginning of data - byte[] data1 = new byte[] { 1, 2, 3 }; + byte[] data1 = [1, 2, 3]; MemoryStream stream1 = new(data1); - yield return new object[] { stream1, data1 }; + yield return [stream1, data1]; // Stream is positioned in the middle of data - byte[] data2 = new byte[] { 0xff, 0xf3, 0xf0 }; + byte[] data2 = [0xff, 0xf3, 0xf0]; MemoryStream stream2 = new(data2) { Position = 1 }; - yield return new object[] { stream2, new byte[] { 0xf3, 0xf0 } }; + yield return [stream2, new byte[] { 0xf3, 0xf0 }]; // Stream is positioned after end of data byte[] data3 = data2; MemoryStream stream3 = new(data3) { Position = data3.Length + 1 }; - yield return new object[] { stream3, Array.Empty() }; + yield return [stream3, Array.Empty()]; } private byte[] CreateTestBuffer(int length) diff --git a/tests/ImageSharp.Tests/Image/ImageCloneTests.cs b/tests/ImageSharp.Tests/Image/ImageCloneTests.cs index 25674e6a8..0680c9a82 100644 --- a/tests/ImageSharp.Tests/Image/ImageCloneTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageCloneTests.cs @@ -10,7 +10,7 @@ public class ImageCloneTests [Fact] public void CloneAs_WhenDisposed_Throws() { - var image = new Image(5, 5); + Image image = new(5, 5); image.Dispose(); Assert.Throws(() => image.CloneAs()); @@ -19,7 +19,7 @@ public class ImageCloneTests [Fact] public void Clone_WhenDisposed_Throws() { - var image = new Image(5, 5); + Image image = new(5, 5); image.Dispose(); Assert.Throws(() => image.Clone()); diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs index 71c9e07fc..d7f2c7d28 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs @@ -102,7 +102,7 @@ public abstract partial class ImageFrameCollectionTests using ImageFrame imageFrame2 = new(Configuration.Default, 1, 1); new ImageFrameCollection( this.Image, - new[] { imageFrame1, imageFrame2 }); + [imageFrame1, imageFrame2]); }); Assert.StartsWith("Frame must have the same dimensions as the image.", ex.Message); @@ -114,7 +114,7 @@ public abstract partial class ImageFrameCollectionTests using ImageFrame imageFrame = new(Configuration.Default, 10, 10); ImageFrameCollection collection = new( this.Image, - new[] { imageFrame }); + [imageFrame]); InvalidOperationException ex = Assert.Throws( () => collection.RemoveFrame(0)); @@ -128,7 +128,7 @@ public abstract partial class ImageFrameCollectionTests using ImageFrame imageFrame2 = new(Configuration.Default, 10, 10); ImageFrameCollection collection = new( this.Image, - new[] { imageFrame1, imageFrame2 }); + [imageFrame1, imageFrame2]); collection.RemoveFrame(0); Assert.Equal(1, collection.Count); @@ -141,7 +141,7 @@ public abstract partial class ImageFrameCollectionTests using ImageFrame imageFrame2 = new(Configuration.Default, 10, 10); ImageFrameCollection collection = new( this.Image, - new[] { imageFrame1, imageFrame2 }); + [imageFrame1, imageFrame2]); Assert.Equal(collection.RootFrame, collection[0]); } @@ -153,7 +153,7 @@ public abstract partial class ImageFrameCollectionTests using ImageFrame imageFrame2 = new(Configuration.Default, 10, 10); ImageFrameCollection collection = new( this.Image, - new[] { imageFrame1, imageFrame2 }); + [imageFrame1, imageFrame2]); Assert.Equal(2, collection.Count); } @@ -165,7 +165,7 @@ public abstract partial class ImageFrameCollectionTests using ImageFrame imageFrame2 = new(Configuration.Default, 10, 10); ImageFrameCollection collection = new( this.Image, - new[] { imageFrame1, imageFrame2 }); + [imageFrame1, imageFrame2]); collection.Dispose(); @@ -179,7 +179,7 @@ public abstract partial class ImageFrameCollectionTests using ImageFrame imageFrame2 = new(Configuration.Default, 10, 10); ImageFrameCollection collection = new( this.Image, - new[] { imageFrame1, imageFrame2 }); + [imageFrame1, imageFrame2]); IPixelSource[] framesSnapShot = collection.OfType>().ToArray(); diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs index f70623f51..cd1213c23 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs @@ -247,7 +247,7 @@ public abstract partial class ImageFrameCollectionTests { Image image = new(Configuration.Default, 10, 10); ImageFrameCollection frameCollection = image.Frames; - Rgba32[] rgba32Array = Array.Empty(); + Rgba32[] rgba32Array = []; image.Dispose(); // this should invalidate underlying collection as well diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs index 14c38d1f7..887a67dd3 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Globalization; using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Tests; @@ -14,7 +15,7 @@ public abstract partial class ImageFrameCollectionTests : IDisposable public ImageFrameCollectionTests() { // Needed to get English exception messages, which are checked in several tests. - System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); + System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); this.Image = new Image(10, 10); this.Collection = new ImageFrameCollection(this.Image, 10, 10, default(Rgba32)); diff --git a/tests/ImageSharp.Tests/Image/ImageFrameTests.cs b/tests/ImageSharp.Tests/Image/ImageFrameTests.cs index ef5b5f4de..f8146363c 100644 --- a/tests/ImageSharp.Tests/Image/ImageFrameTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageFrameTests.cs @@ -16,7 +16,7 @@ public class ImageFrameTests private void LimitBufferCapacity(int bufferCapacityInBytes) { - var allocator = new TestMemoryAllocator(); + TestMemoryAllocator allocator = new(); allocator.BufferCapacityInBytes = bufferCapacityInBytes; this.configuration.MemoryAllocator = allocator; } @@ -31,7 +31,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using var image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; Rgba32 val = frame[3, 4]; Assert.Equal(default(Rgba32), val); @@ -40,7 +40,7 @@ public class ImageFrameTests Assert.Equal(Color.Red.ToPixel(), val); } - public static TheoryData OutOfRangeData = new TheoryData() + public static TheoryData OutOfRangeData = new() { { false, -1 }, { false, 10 }, @@ -57,7 +57,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using var image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; ArgumentOutOfRangeException ex = Assert.Throws(() => _ = frame[x, 3]); Assert.Equal("x", ex.ParamName); @@ -72,7 +72,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using var image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; ArgumentOutOfRangeException ex = Assert.Throws(() => frame[x, 3] = default); Assert.Equal("x", ex.ParamName); @@ -87,7 +87,7 @@ public class ImageFrameTests this.LimitBufferCapacity(100); } - using var image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); ImageFrame frame = image.Frames.RootFrame; ArgumentOutOfRangeException ex = Assert.Throws(() => frame[3, y] = default); Assert.Equal("y", ex.ParamName); @@ -105,7 +105,7 @@ public class ImageFrameTests this.LimitBufferCapacity(20); } - using var image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); if (disco) { Assert.True(image.GetPixelMemoryGroup().Count > 1); @@ -131,7 +131,7 @@ public class ImageFrameTests [InlineData(true)] public void CopyPixelDataTo_DestinationTooShort_Throws(bool byteSpan) { - using var image = new Image(this.configuration, 10, 10); + using Image image = new(this.configuration, 10, 10); Assert.ThrowsAny(() => { @@ -173,7 +173,7 @@ public class ImageFrameTests [Fact] public void NullReference_Throws() { - using var img = new Image(1, 1); + using Image img = new(1, 1); ImageFrame frame = img.Frames.RootFrame; Assert.Throws(() => frame.ProcessPixelRows(null)); diff --git a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs index f9c01ab56..e2f3c6337 100644 --- a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs @@ -32,7 +32,7 @@ public class ImageSaveTests : IDisposable this.encoderNotInFormat = new Mock(); this.fileSystem = new Mock(); - var config = new Configuration + Configuration config = new() { FileSystem = this.fileSystem.Object }; diff --git a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs index f9a68c8bf..178f5375f 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.DetectFormat.cs @@ -50,6 +50,10 @@ public partial class ImageTests Assert.Equal(this.LocalImageFormat, format); } + [Fact] + public void FromBytes_EmptySpan_Throws() + => Assert.Throws(() => Image.DetectFormat([])); + [Fact] public void FromFileSystemPath_GlobalConfiguration() { @@ -114,7 +118,7 @@ public partial class ImageTests { DecoderOptions options = new() { - Configuration = new() + Configuration = new Configuration() }; Assert.Throws(() => Image.DetectFormat(options, this.DataStream)); @@ -145,7 +149,7 @@ public partial class ImageTests { DecoderOptions options = new() { - Configuration = new() + Configuration = new Configuration() }; return Assert.ThrowsAsync(async () => await Image.DetectFormatAsync(options, new AsyncStreamWrapper(this.DataStream, () => false))); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs b/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs index 7f6651d90..433a1e101 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Identify.cs @@ -38,6 +38,10 @@ public partial class ImageTests Assert.Equal(ExpectedGlobalFormat, info.Metadata.DecodedImageFormat); } + [Fact] + public void FromBytes_EmptySpan_Throws() + => Assert.Throws(() => Image.Identify([])); + [Fact] public void FromBytes_CustomConfiguration() { @@ -131,7 +135,7 @@ public partial class ImageTests [Fact] public void WhenNoMatchingFormatFound_Throws_UnknownImageFormatException() { - DecoderOptions options = new() { Configuration = new() }; + DecoderOptions options = new() { Configuration = new Configuration() }; Assert.Throws(() => Image.Identify(options, this.DataStream)); } @@ -141,9 +145,8 @@ public partial class ImageTests { // https://github.com/SixLabors/ImageSharp/issues/1903 using ZipArchive zipFile = new(new MemoryStream( - new byte[] - { - 0x50, 0x4B, 0x03, 0x04, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xAF, 0x94, 0x53, 0x00, 0x00, + [ + 0x50, 0x4B, 0x03, 0x04, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xAF, 0x94, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6D, 0x79, 0x73, 0x74, 0x65, 0x72, 0x79, 0x50, 0x4B, 0x01, 0x02, 0x3F, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xAF, 0x94, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -153,7 +156,7 @@ public partial class ImageTests 0xF9, 0x91, 0x27, 0xF6, 0xD7, 0x01, 0x55, 0xA1, 0xF9, 0x91, 0x27, 0xF6, 0xD7, 0x01, 0x50, 0x4B, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x59, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00 - })); + ])); using Stream stream = zipFile.Entries[0].Open(); Assert.Throws(() => Image.Identify(stream)); @@ -210,9 +213,8 @@ public partial class ImageTests { // https://github.com/SixLabors/ImageSharp/issues/1903 using ZipArchive zipFile = new(new MemoryStream( - new byte[] - { - 0x50, 0x4B, 0x03, 0x04, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xAF, 0x94, 0x53, 0x00, 0x00, + [ + 0x50, 0x4B, 0x03, 0x04, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xAF, 0x94, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6D, 0x79, 0x73, 0x74, 0x65, 0x72, 0x79, 0x50, 0x4B, 0x01, 0x02, 0x3F, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xAF, 0x94, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -222,7 +224,7 @@ public partial class ImageTests 0xF9, 0x91, 0x27, 0xF6, 0xD7, 0x01, 0x55, 0xA1, 0xF9, 0x91, 0x27, 0xF6, 0xD7, 0x01, 0x50, 0x4B, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x59, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00 - })); + ])); using Stream stream = zipFile.Entries[0].Open(); await Assert.ThrowsAsync(async () => await Image.IdentifyAsync(stream)); @@ -279,7 +281,7 @@ public partial class ImageTests [Fact] public Task WhenNoMatchingFormatFoundAsync_Throws_UnknownImageFormatException() { - DecoderOptions options = new() { Configuration = new() }; + DecoderOptions options = new() { Configuration = new Configuration() }; AsyncStreamWrapper asyncStream = new(this.DataStream, () => false); return Assert.ThrowsAsync(async () => await Image.IdentifyAsync(options, asyncStream)); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs b/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs index 51e2a01a2..b0875a1e6 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.ImageLoadTestBase.cs @@ -35,7 +35,7 @@ public partial class ImageTests public Configuration LocalConfiguration { get; } - public TestFormat TestFormat { get; } = new TestFormat(); + public TestFormat TestFormat { get; } = new(); /// /// Gets the top-level configuration in the context of this test case. @@ -58,7 +58,7 @@ public partial class ImageTests // TODO: Remove all this mocking. It's too complicated and we can now use fakes. this.localStreamReturnImageRgba32 = new Image(1, 1); this.localStreamReturnImageAgnostic = new Image(1, 1); - this.LocalImageInfo = new(new(1, 1), new ImageMetadata() { DecodedImageFormat = PngFormat.Instance }); + this.LocalImageInfo = new ImageInfo(new Size(1, 1), new ImageMetadata { DecodedImageFormat = PngFormat.Instance }); this.localImageFormatMock = new Mock(); diff --git a/tests/ImageSharp.Tests/Image/ImageTests.LoadPixelData.cs b/tests/ImageSharp.Tests/Image/ImageTests.LoadPixelData.cs index 5762264d2..47ae0daf7 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.LoadPixelData.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.LoadPixelData.cs @@ -15,7 +15,8 @@ public partial class ImageTests [ValidateDisposedMemoryAllocations] public void FromPixels(bool useSpan) { - Rgba32[] data = { Color.Black.ToPixel(), Color.White.ToPixel(), Color.White.ToPixel(), Color.Black.ToPixel(), }; + Rgba32[] data = [Color.Black.ToPixel(), Color.White.ToPixel(), Color.White.ToPixel(), Color.Black.ToPixel() + ]; using Image img = useSpan ? Image.LoadPixelData(data.AsSpan(), 2, 2) @@ -34,12 +35,12 @@ public partial class ImageTests public void FromBytes(bool useSpan) { byte[] data = - { + [ 0, 0, 0, 255, // 0,0 255, 255, 255, 255, // 0,1 255, 255, 255, 255, // 1,0 - 0, 0, 0, 255, // 1,1 - }; + 0, 0, 0, 255 // 1,1 + ]; using Image img = useSpan ? Image.LoadPixelData(data.AsSpan(), 2, 2) diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs index 3a47a0ea7..600bed010 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_PassLocalConfiguration.cs @@ -79,5 +79,16 @@ public partial class ImageTests this.TestFormat.VerifyAgnosticDecodeCall(this.Marker, this.TopLevelConfiguration); } + + [Fact] + public void FromBytes_EmptySpan_Throws() + { + DecoderOptions options = new() + { + Configuration = this.TopLevelConfiguration + }; + + Assert.Throws(() => Image.Load(options, [])); + } } } diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs index 00ec985ac..a0ce1e5d8 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromBytes_UseGlobalConfiguration.cs @@ -45,5 +45,9 @@ public partial class ImageTests VerifyDecodedImage(img); Assert.IsType(img.Metadata.DecodedImageFormat); } + + [Fact] + public void FromBytes_EmptySpan_Throws() + => Assert.ThrowsAny(() => Image.Load([])); } } diff --git a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs index 9b9f968bb..c2609545d 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.Load_FromStream_ThrowsRightException.cs @@ -10,9 +10,9 @@ public partial class ImageTests { public class Load_FromStream_Throws : IDisposable { - private static readonly byte[] Data = new byte[] { 0x01 }; + private static readonly byte[] Data = [0x01]; - private MemoryStream Stream { get; } = new MemoryStream(Data); + private MemoryStream Stream { get; } = new(Data); [Fact] public void Image_Load_Throws_UnknownImageFormatException() @@ -32,6 +32,17 @@ public partial class ImageTests } }); - public void Dispose() => this.Stream?.Dispose(); + [Fact] + public void FromStream_Empty_Throws() + { + using MemoryStream ms = new(); + Assert.Throws(() => Image.Load(DecoderOptions.Default, ms)); + } + + public void Dispose() + { + this.Stream?.Dispose(); + GC.SuppressFinalize(this); + } } } diff --git a/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs b/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs index e3c4a7df1..6322e65aa 100644 --- a/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs +++ b/tests/ImageSharp.Tests/Image/ImageTests.WrapMemory.cs @@ -39,7 +39,7 @@ public partial class ImageTests } this.bitmap = bitmap; - var rectangle = new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height); + System.Drawing.Rectangle rectangle = new(0, 0, bitmap.Width, bitmap.Height); this.bmpData = bitmap.LockBits(rectangle, ImageLockMode.ReadWrite, bitmap.PixelFormat); this.length = bitmap.Width * bitmap.Height; } @@ -124,13 +124,13 @@ public partial class ImageTests [Fact] public void WrapMemory_CreatedImageIsCorrect() { - var cfg = Configuration.CreateDefaultInstance(); - var metaData = new ImageMetadata(); + Configuration cfg = Configuration.CreateDefaultInstance(); + ImageMetadata metaData = new(); - var array = new Rgba32[25]; - var memory = new Memory(array); + Rgba32[] array = new Rgba32[25]; + Memory memory = new(array); - using (var image = Image.WrapMemory(cfg, memory, 5, 5, metaData)) + using (Image image = Image.WrapMemory(cfg, memory, 5, 5, metaData)) { Assert.True(image.DangerousTryGetSinglePixelMemory(out Memory imageMem)); ref Rgba32 pixel0 = ref imageMem.Span[0]; @@ -149,22 +149,22 @@ public partial class ImageTests return; } - using (var bmp = new Bitmap(51, 23)) + using (Bitmap bmp = new(51, 23)) { - using (var memoryManager = new BitmapMemoryManager(bmp)) + using (BitmapMemoryManager memoryManager = new(bmp)) { Memory memory = memoryManager.Memory; Bgra32 bg = Color.Red.ToPixel(); Bgra32 fg = Color.Green.ToPixel(); - using (var image = Image.WrapMemory(memory, bmp.Width, bmp.Height)) + using (Image image = Image.WrapMemory(memory, bmp.Width, bmp.Height)) { Assert.Equal(memory, image.GetRootFramePixelBuffer().DangerousGetSingleMemory()); image.GetPixelMemoryGroup().Fill(bg); image.ProcessPixelRows(accessor => { - for (var i = 10; i < 20; i++) + for (int i = 10; i < 20; i++) { accessor.GetRowSpan(i).Slice(10, 10).Fill(fg); } @@ -195,19 +195,19 @@ public partial class ImageTests return; } - using (var bmp = new Bitmap(51, 23)) + using (Bitmap bmp = new(51, 23)) { - var memoryManager = new BitmapMemoryManager(bmp); + BitmapMemoryManager memoryManager = new(bmp); Bgra32 bg = Color.Red.ToPixel(); Bgra32 fg = Color.Green.ToPixel(); - using (var image = Image.WrapMemory(memoryManager, bmp.Width, bmp.Height)) + using (Image image = Image.WrapMemory(memoryManager, bmp.Width, bmp.Height)) { Assert.Equal(memoryManager.Memory, image.GetRootFramePixelBuffer().DangerousGetSingleMemory()); image.GetPixelMemoryGroup().Fill(bg); image.ProcessPixelRows(accessor => { - for (var i = 10; i < 20; i++) + for (int i = 10; i < 20; i++) { accessor.GetRowSpan(i).Slice(10, 10).Fill(fg); } @@ -227,13 +227,13 @@ public partial class ImageTests [Fact] public void WrapMemory_FromBytes_CreatedImageIsCorrect() { - var cfg = Configuration.CreateDefaultInstance(); - var metaData = new ImageMetadata(); + Configuration cfg = Configuration.CreateDefaultInstance(); + ImageMetadata metaData = new(); - var array = new byte[25 * Unsafe.SizeOf()]; - var memory = new Memory(array); + byte[] array = new byte[25 * Unsafe.SizeOf()]; + Memory memory = new(array); - using (var image = Image.WrapMemory(cfg, memory, 5, 5, metaData)) + using (Image image = Image.WrapMemory(cfg, memory, 5, 5, metaData)) { Assert.True(image.DangerousTryGetSinglePixelMemory(out Memory imageMem)); ref Rgba32 pixel0 = ref imageMem.Span[0]; @@ -252,16 +252,16 @@ public partial class ImageTests return; } - using (var bmp = new Bitmap(51, 23)) + using (Bitmap bmp = new(51, 23)) { - using (var memoryManager = new BitmapMemoryManager(bmp)) + using (BitmapMemoryManager memoryManager = new(bmp)) { Memory pixelMemory = memoryManager.Memory; Memory byteMemory = new CastMemoryManager(pixelMemory).Memory; Bgra32 bg = Color.Red.ToPixel(); Bgra32 fg = Color.Green.ToPixel(); - using (var image = Image.WrapMemory(byteMemory, bmp.Width, bmp.Height)) + using (Image image = Image.WrapMemory(byteMemory, bmp.Width, bmp.Height)) { Span pixelSpan = pixelMemory.Span; Span imageSpan = image.GetRootFramePixelBuffer().DangerousGetSingleMemory().Span; @@ -276,7 +276,7 @@ public partial class ImageTests image.GetPixelMemoryGroup().Fill(bg); image.ProcessPixelRows(accessor => { - for (var i = 10; i < 20; i++) + for (int i = 10; i < 20; i++) { accessor.GetRowSpan(i).Slice(10, 10).Fill(fg); } @@ -300,16 +300,16 @@ public partial class ImageTests [InlineData(65536, 65537, 65536)] public unsafe void WrapMemory_Throws_OnTooLessWrongSize(int size, int width, int height) { - var cfg = Configuration.CreateDefaultInstance(); - var metaData = new ImageMetadata(); + Configuration cfg = Configuration.CreateDefaultInstance(); + ImageMetadata metaData = new(); - var array = new Rgba32[size]; + Rgba32[] array = new Rgba32[size]; Exception thrownException = null; fixed (void* ptr = array) { try { - using var image = Image.WrapMemory(cfg, ptr, size * sizeof(Rgba32), width, height, metaData); + using Image image = Image.WrapMemory(cfg, ptr, size * sizeof(Rgba32), width, height, metaData); } catch (Exception e) { @@ -328,14 +328,14 @@ public partial class ImageTests [InlineData(2048, 32, 32)] public unsafe void WrapMemory_FromPointer_CreatedImageIsCorrect(int size, int width, int height) { - var cfg = Configuration.CreateDefaultInstance(); - var metaData = new ImageMetadata(); + Configuration cfg = Configuration.CreateDefaultInstance(); + ImageMetadata metaData = new(); - var array = new Rgba32[size]; + Rgba32[] array = new Rgba32[size]; fixed (void* ptr = array) { - using (var image = Image.WrapMemory(cfg, ptr, size * sizeof(Rgba32), width, height, metaData)) + using (Image image = Image.WrapMemory(cfg, ptr, size * sizeof(Rgba32), width, height, metaData)) { Assert.True(image.DangerousTryGetSinglePixelMemory(out Memory imageMem)); Span imageSpan = imageMem.Span; @@ -359,9 +359,9 @@ public partial class ImageTests return; } - using (var bmp = new Bitmap(51, 23)) + using (Bitmap bmp = new(51, 23)) { - using (var memoryManager = new BitmapMemoryManager(bmp)) + using (BitmapMemoryManager memoryManager = new(bmp)) { Memory pixelMemory = memoryManager.Memory; Bgra32 bg = Color.Red.ToPixel(); @@ -369,7 +369,7 @@ public partial class ImageTests fixed (void* p = pixelMemory.Span) { - using (var image = Image.WrapMemory(p, pixelMemory.Length, bmp.Width, bmp.Height)) + using (Image image = Image.WrapMemory(p, pixelMemory.Length, bmp.Width, bmp.Height)) { Span pixelSpan = pixelMemory.Span; Span imageSpan = image.GetRootFramePixelBuffer().DangerousGetSingleMemory().Span; @@ -381,7 +381,7 @@ public partial class ImageTests image.GetPixelMemoryGroup().Fill(bg); image.ProcessPixelRows(accessor => { - for (var i = 10; i < 20; i++) + for (int i = 10; i < 20; i++) { accessor.GetRowSpan(i).Slice(10, 10).Fill(fg); } @@ -407,8 +407,8 @@ public partial class ImageTests [InlineData(65536, 65537, 65536)] public void WrapMemory_MemoryOfT_InvalidSize(int size, int height, int width) { - var array = new Rgba32[size]; - var memory = new Memory(array); + Rgba32[] array = new Rgba32[size]; + Memory memory = new(array); Assert.Throws(() => Image.WrapMemory(memory, height, width)); } @@ -421,8 +421,8 @@ public partial class ImageTests [InlineData(2048, 32, 32)] public void WrapMemory_MemoryOfT_ValidSize(int size, int height, int width) { - var array = new Rgba32[size]; - var memory = new Memory(array); + Rgba32[] array = new Rgba32[size]; + Memory memory = new(array); Image.WrapMemory(memory, height, width); } @@ -443,8 +443,8 @@ public partial class ImageTests [InlineData(65536, 65537, 65536)] public void WrapMemory_IMemoryOwnerOfT_InvalidSize(int size, int height, int width) { - var array = new Rgba32[size]; - var memory = new TestMemoryOwner { Memory = array }; + Rgba32[] array = new Rgba32[size]; + TestMemoryOwner memory = new() { Memory = array }; Assert.Throws(() => Image.WrapMemory(memory, height, width)); } @@ -457,10 +457,10 @@ public partial class ImageTests [InlineData(2048, 32, 32)] public void WrapMemory_IMemoryOwnerOfT_ValidSize(int size, int height, int width) { - var array = new Rgba32[size]; - var memory = new TestMemoryOwner { Memory = array }; + Rgba32[] array = new Rgba32[size]; + TestMemoryOwner memory = new() { Memory = array }; - using (var img = Image.WrapMemory(memory, width, height)) + using (Image img = Image.WrapMemory(memory, width, height)) { Assert.Equal(width, img.Width); Assert.Equal(height, img.Height); @@ -469,7 +469,7 @@ public partial class ImageTests { for (int i = 0; i < height; ++i) { - var arrayIndex = width * i; + int arrayIndex = width * i; Span rowSpan = accessor.GetRowSpan(i); ref Rgba32 r0 = ref rowSpan[0]; @@ -490,8 +490,8 @@ public partial class ImageTests [InlineData(65536, 65537, 65536)] public void WrapMemory_IMemoryOwnerOfByte_InvalidSize(int size, int height, int width) { - var array = new byte[size * Unsafe.SizeOf()]; - var memory = new TestMemoryOwner { Memory = array }; + byte[] array = new byte[size * Unsafe.SizeOf()]; + TestMemoryOwner memory = new() { Memory = array }; Assert.Throws(() => Image.WrapMemory(memory, height, width)); } @@ -504,11 +504,11 @@ public partial class ImageTests [InlineData(2048, 32, 32)] public void WrapMemory_IMemoryOwnerOfByte_ValidSize(int size, int height, int width) { - var pixelSize = Unsafe.SizeOf(); - var array = new byte[size * pixelSize]; - var memory = new TestMemoryOwner { Memory = array }; + int pixelSize = Unsafe.SizeOf(); + byte[] array = new byte[size * pixelSize]; + TestMemoryOwner memory = new() { Memory = array }; - using (var img = Image.WrapMemory(memory, width, height)) + using (Image img = Image.WrapMemory(memory, width, height)) { Assert.Equal(width, img.Width); Assert.Equal(height, img.Height); @@ -517,7 +517,7 @@ public partial class ImageTests { for (int i = 0; i < height; ++i) { - var arrayIndex = pixelSize * width * i; + int arrayIndex = pixelSize * width * i; Span rowSpan = acccessor.GetRowSpan(i); ref Rgba32 r0 = ref rowSpan[0]; @@ -538,8 +538,8 @@ public partial class ImageTests [InlineData(65536, 65537, 65536)] public void WrapMemory_MemoryOfByte_InvalidSize(int size, int height, int width) { - var array = new byte[size * Unsafe.SizeOf()]; - var memory = new Memory(array); + byte[] array = new byte[size * Unsafe.SizeOf()]; + Memory memory = new(array); Assert.Throws(() => Image.WrapMemory(memory, height, width)); } @@ -552,8 +552,8 @@ public partial class ImageTests [InlineData(2048, 32, 32)] public void WrapMemory_MemoryOfByte_ValidSize(int size, int height, int width) { - var array = new byte[size * Unsafe.SizeOf()]; - var memory = new Memory(array); + byte[] array = new byte[size * Unsafe.SizeOf()]; + Memory memory = new(array); Image.WrapMemory(memory, height, width); } diff --git a/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs b/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs index 12caa6e7a..8d1b54658 100644 --- a/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs +++ b/tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs @@ -31,7 +31,7 @@ public class LargeImageIntegrationTests Configuration configuration = Configuration.Default.Clone(); configuration.PreferContiguousImageBuffers = true; - using var image = new Image(configuration, 2048, 2048); + using Image image = new(configuration, 2048, 2048); Assert.True(image.DangerousTryGetSinglePixelMemory(out Memory mem)); Assert.Equal(2048 * 2048, mem.Length); } @@ -69,7 +69,7 @@ public class LargeImageIntegrationTests Configuration = configuration }; - using var image = Image.Load(options, path); + using Image image = Image.Load(options, path); File.Delete(path); Assert.Equal(1, image.GetPixelMemoryGroup().Count); } diff --git a/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs b/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs index 27cbe1a7e..27e42f84e 100644 --- a/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs +++ b/tests/ImageSharp.Tests/Image/ProcessPixelRowsTestBase.cs @@ -32,7 +32,7 @@ public abstract class ProcessPixelRowsTestBase [Fact] public void PixelAccessorDimensionsAreCorrect() { - using var image = new Image(123, 456); + using Image image = new(123, 456); this.ProcessPixelRowsImpl(image, accessor => { Assert.Equal(123, accessor.Width); @@ -43,7 +43,7 @@ public abstract class ProcessPixelRowsTestBase [Fact] public void WriteImagePixels_SingleImage() { - using var image = new Image(256, 256); + using Image image = new(256, 256); this.ProcessPixelRowsImpl(image, accessor => { for (int y = 0; y < accessor.Height; y++) @@ -71,7 +71,7 @@ public abstract class ProcessPixelRowsTestBase [Fact] public void WriteImagePixels_MultiImage2() { - using var img1 = new Image(256, 256); + using Image img1 = new(256, 256); Buffer2D buffer = img1.Frames.RootFrame.PixelBuffer; for (int y = 0; y < 256; y++) { @@ -82,7 +82,7 @@ public abstract class ProcessPixelRowsTestBase } } - using var img2 = new Image(256, 256); + using Image img2 = new(256, 256); this.ProcessPixelRowsImpl(img1, img2, (accessor1, accessor2) => { @@ -109,7 +109,7 @@ public abstract class ProcessPixelRowsTestBase [Fact] public void WriteImagePixels_MultiImage3() { - using var img1 = new Image(256, 256); + using Image img1 = new(256, 256); Buffer2D buffer2 = img1.Frames.RootFrame.PixelBuffer; for (int y = 0; y < 256; y++) { @@ -120,8 +120,8 @@ public abstract class ProcessPixelRowsTestBase } } - using var img2 = new Image(256, 256); - using var img3 = new Image(256, 256); + using Image img2 = new(256, 256); + using Image img3 = new(256, 256); this.ProcessPixelRowsImpl(img1, img2, img3, (accessor1, accessor2, accessor3) => { @@ -154,8 +154,8 @@ public abstract class ProcessPixelRowsTestBase [Fact] public void Disposed_ThrowsObjectDisposedException() { - using var nonDisposed = new Image(1, 1); - var disposed = new Image(1, 1); + using Image nonDisposed = new(1, 1); + Image disposed = new(1, 1); disposed.Dispose(); Assert.Throws(() => this.ProcessPixelRowsImpl(disposed, _ => { })); @@ -178,11 +178,11 @@ public abstract class ProcessPixelRowsTestBase static void RunTest(string testTypeName, string throwExceptionStr) { bool throwExceptionInner = bool.Parse(throwExceptionStr); - var buffer = UnmanagedBuffer.Allocate(100); - var allocator = new MockUnmanagedMemoryAllocator(buffer); + UnmanagedBuffer buffer = UnmanagedBuffer.Allocate(100); + MockUnmanagedMemoryAllocator allocator = new(buffer); Configuration.Default.MemoryAllocator = allocator; - var image = new Image(10, 10); + Image image = new(10, 10); Assert.Equal(1, UnmanagedMemoryHandle.TotalOutstandingHandles); try @@ -215,13 +215,13 @@ public abstract class ProcessPixelRowsTestBase static void RunTest(string testTypeName, string throwExceptionStr) { bool throwExceptionInner = bool.Parse(throwExceptionStr); - var buffer1 = UnmanagedBuffer.Allocate(100); - var buffer2 = UnmanagedBuffer.Allocate(100); - var allocator = new MockUnmanagedMemoryAllocator(buffer1, buffer2); + UnmanagedBuffer buffer1 = UnmanagedBuffer.Allocate(100); + UnmanagedBuffer buffer2 = UnmanagedBuffer.Allocate(100); + MockUnmanagedMemoryAllocator allocator = new(buffer1, buffer2); Configuration.Default.MemoryAllocator = allocator; - var image1 = new Image(10, 10); - var image2 = new Image(10, 10); + Image image1 = new(10, 10); + Image image2 = new(10, 10); Assert.Equal(2, UnmanagedMemoryHandle.TotalOutstandingHandles); try @@ -255,15 +255,15 @@ public abstract class ProcessPixelRowsTestBase static void RunTest(string testTypeName, string throwExceptionStr) { bool throwExceptionInner = bool.Parse(throwExceptionStr); - var buffer1 = UnmanagedBuffer.Allocate(100); - var buffer2 = UnmanagedBuffer.Allocate(100); - var buffer3 = UnmanagedBuffer.Allocate(100); - var allocator = new MockUnmanagedMemoryAllocator(buffer1, buffer2, buffer3); + UnmanagedBuffer buffer1 = UnmanagedBuffer.Allocate(100); + UnmanagedBuffer buffer2 = UnmanagedBuffer.Allocate(100); + UnmanagedBuffer buffer3 = UnmanagedBuffer.Allocate(100); + MockUnmanagedMemoryAllocator allocator = new(buffer1, buffer2, buffer3); Configuration.Default.MemoryAllocator = allocator; - var image1 = new Image(10, 10); - var image2 = new Image(10, 10); - var image3 = new Image(10, 10); + Image image1 = new(10, 10); + Image image2 = new(10, 10); + Image image3 = new(10, 10); Assert.Equal(3, UnmanagedMemoryHandle.TotalOutstandingHandles); try diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj index ce391fad2..a1d5b0ee2 100644 --- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj +++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj @@ -12,7 +12,7 @@ - net8.0;net9.0 + net8.0;net10.0 diff --git a/tests/ImageSharp.Tests/Issues/Issue594.cs b/tests/ImageSharp.Tests/Issues/Issue594.cs index 7f976a373..36308edae 100644 --- a/tests/ImageSharp.Tests/Issues/Issue594.cs +++ b/tests/ImageSharp.Tests/Issues/Issue594.cs @@ -40,7 +40,7 @@ public class Issue594 const float z = 0.5f; const float w = -0.7f; - pixel = new(x, y, z, w); + pixel = new NormalizedByte4(x, y, z, w); Assert.Equal(0xA740DA0D, pixel.PackedValue); NormalizedByte4 n = NormalizedByte4.FromRgba32(pixel.ToRgba32()); Assert.Equal(0xA740DA0D, n.PackedValue); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs b/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs index 33950c469..c4cef5d93 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/BufferTestSuite.cs @@ -58,7 +58,7 @@ public abstract class BufferTestSuite } } - public static readonly TheoryData LengthValues = new TheoryData { 0, 1, 7, 1023, 1024 }; + public static readonly TheoryData LengthValues = new() { 0, 1, 7, 1023, 1024 }; [Theory] [MemberData(nameof(LengthValues))] @@ -172,7 +172,7 @@ public abstract class BufferTestSuite { using (IMemoryOwner buffer = this.MemoryAllocator.Allocate(desiredLength)) { - var expectedVals = new T[buffer.Length()]; + T[] expectedVals = new T[buffer.Length()]; for (int i = 0; i < buffer.Length(); i++) { @@ -213,7 +213,7 @@ public abstract class BufferTestSuite private T TestIndexOutOfRangeShouldThrow(int desiredLength) where T : struct, IEquatable { - var dummy = default(T); + T dummy = default(T); using (IMemoryOwner buffer = this.MemoryAllocator.Allocate(desiredLength)) { diff --git a/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs index b8dd4be8d..c4b75b5cf 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/MemoryDiagnosticsTests.cs @@ -27,7 +27,7 @@ public class MemoryDiagnosticsTests int leakCounter = 0; MemoryDiagnostics.UndisposedAllocation += _ => Interlocked.Increment(ref leakCounter); - List buffers = new(); + List buffers = []; Assert.Equal(0, MemoryDiagnostics.TotalUndisposedAllocationCount); for (int length = 1024; length <= 64 * OneMb; length *= 2) diff --git a/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs index 517eda707..8eb364828 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/RefCountedLifetimeGuardTests.cs @@ -14,7 +14,7 @@ public class RefCountedLifetimeGuardTests [InlineData(3)] public void Dispose_ResultsInSingleRelease(int disposeCount) { - var guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); Assert.Equal(0, guard.ReleaseInvocationCount); for (int i = 0; i < disposeCount; i++) @@ -45,7 +45,7 @@ public class RefCountedLifetimeGuardTests [InlineData(3)] public void AddRef_PreventsReleaseOnDispose(int addRefCount) { - var guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); for (int i = 0; i < addRefCount; i++) { @@ -80,7 +80,7 @@ public class RefCountedLifetimeGuardTests [Fact] public void AddRefReleaseRefMisuse_DoesntLeadToMultipleReleases() { - var guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); guard.Dispose(); guard.AddRef(); guard.ReleaseRef(); @@ -91,8 +91,8 @@ public class RefCountedLifetimeGuardTests [Fact] public void UnmanagedBufferLifetimeGuard_Handle_IsReturnedByRef() { - var h = UnmanagedMemoryHandle.Allocate(10); - using var guard = new UnmanagedBufferLifetimeGuard.FreeHandle(h); + UnmanagedMemoryHandle h = UnmanagedMemoryHandle.Allocate(10); + using UnmanagedBufferLifetimeGuard.FreeHandle guard = new(h); Assert.True(guard.Handle.IsValid); guard.Handle.Free(); Assert.False(guard.Handle.IsValid); @@ -101,7 +101,7 @@ public class RefCountedLifetimeGuardTests [MethodImpl(MethodImplOptions.NoInlining)] private static void LeakGuard(bool addRef) { - var guard = new MockLifetimeGuard(); + MockLifetimeGuard guard = new(); if (addRef) { guard.AddRef(); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs index a956190cd..72b90c238 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/SharedArrayPoolBufferTests.cs @@ -16,7 +16,7 @@ public class SharedArrayPoolBufferTests static void RunTest() { - using (var buffer = new SharedArrayPoolBuffer(900)) + using (SharedArrayPoolBuffer buffer = new(900)) { Assert.Equal(900, buffer.GetSpan().Length); buffer.GetSpan().Fill(42); @@ -36,7 +36,7 @@ public class SharedArrayPoolBufferTests static void RunTest() { - var buffer = new SharedArrayPoolBuffer(900); + SharedArrayPoolBuffer buffer = new(900); Span span = buffer.GetSpan(); buffer.AddRef(); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs index 665f34a34..0e791c5d9 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/SimpleGcMemoryAllocatorTests.cs @@ -17,7 +17,7 @@ public class SimpleGcMemoryAllocatorTests } } - protected SimpleGcMemoryAllocator MemoryAllocator { get; } = new SimpleGcMemoryAllocator(); + protected SimpleGcMemoryAllocator MemoryAllocator { get; } = new(); public static TheoryData InvalidLengths { get; set; } = new() { diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs index fd8b6af59..fd9760f48 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs @@ -24,8 +24,8 @@ public partial class UniformUnmanagedMemoryPoolTests RemoteExecutor.Invoke(RunTest).Dispose(); static void RunTest() { - var trimSettings = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 5_000 }; - var pool = new UniformUnmanagedMemoryPool(128, 256, trimSettings); + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { TrimPeriodMilliseconds = 5_000 }; + UniformUnmanagedMemoryPool pool = new(128, 256, trimSettings); UnmanagedMemoryHandle[] a = pool.Rent(64); UnmanagedMemoryHandle[] b = pool.Rent(64); @@ -77,11 +77,11 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest() { - var trimSettings1 = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 6_000 }; - var pool1 = new UniformUnmanagedMemoryPool(128, 256, trimSettings1); + UniformUnmanagedMemoryPool.TrimSettings trimSettings1 = new() { TrimPeriodMilliseconds = 6_000 }; + UniformUnmanagedMemoryPool pool1 = new(128, 256, trimSettings1); Thread.Sleep(8_000); // Let some callbacks fire already - var trimSettings2 = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 3_000 }; - var pool2 = new UniformUnmanagedMemoryPool(128, 256, trimSettings2); + UniformUnmanagedMemoryPool.TrimSettings trimSettings2 = new() { TrimPeriodMilliseconds = 3_000 }; + UniformUnmanagedMemoryPool pool2 = new(128, 256, trimSettings2); pool1.Return(pool1.Rent(64)); pool2.Return(pool2.Rent(64)); @@ -104,14 +104,14 @@ public partial class UniformUnmanagedMemoryPoolTests [MethodImpl(MethodImplOptions.NoInlining)] static void LeakPoolInstance() { - var trimSettings = new UniformUnmanagedMemoryPool.TrimSettings { TrimPeriodMilliseconds = 4_000 }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { TrimPeriodMilliseconds = 4_000 }; _ = new UniformUnmanagedMemoryPool(128, 256, trimSettings); } } } public static readonly bool Is32BitProcess = !Environment.Is64BitProcess; - private static readonly List PressureArrays = new(); + private static readonly List PressureArrays = []; [Fact] public static void GC_Collect_OnHighLoad_TrimsEntirePool() @@ -129,13 +129,13 @@ public partial class UniformUnmanagedMemoryPoolTests Assert.False(Environment.Is64BitProcess); const int oneMb = 1 << 20; - var trimSettings = new UniformUnmanagedMemoryPool.TrimSettings { HighPressureThresholdRate = 0.2f }; + UniformUnmanagedMemoryPool.TrimSettings trimSettings = new() { HighPressureThresholdRate = 0.2f }; GCMemoryInfo memInfo = GC.GetGCMemoryInfo(); int highLoadThreshold = (int)(memInfo.HighMemoryLoadThresholdBytes / oneMb); highLoadThreshold = (int)(trimSettings.HighPressureThresholdRate * highLoadThreshold); - var pool = new UniformUnmanagedMemoryPool(oneMb, 16, trimSettings); + UniformUnmanagedMemoryPool pool = new(oneMb, 16, trimSettings); pool.Return(pool.Rent(16)); Assert.Equal(16, UnmanagedMemoryHandle.TotalOutstandingHandles); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs index 69fc1a5f7..ec79d91c3 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs @@ -55,7 +55,7 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(7, 4)] public void Constructor_InitializesProperties(int arrayLength, int capacity) { - var pool = new UniformUnmanagedMemoryPool(arrayLength, capacity); + UniformUnmanagedMemoryPool pool = new(arrayLength, capacity); Assert.Equal(arrayLength, pool.BufferLength); Assert.Equal(capacity, pool.Capacity); } @@ -65,8 +65,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(8, 10)] public void Rent_SingleBuffer_ReturnsCorrectBuffer(int length, int capacity) { - var pool = new UniformUnmanagedMemoryPool(length, capacity); - using var cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(length, capacity); + using CleanupUtil cleanup = new(pool); for (int i = 0; i < capacity; i++) { @@ -83,7 +83,7 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest() { - var pool = new UniformUnmanagedMemoryPool(16, 16); + UniformUnmanagedMemoryPool pool = new(16, 16); UnmanagedMemoryHandle a = pool.Rent(); UnmanagedMemoryHandle[] b = pool.Rent(2); @@ -105,7 +105,7 @@ public partial class UniformUnmanagedMemoryPoolTests Assert.True(span.SequenceEqual(expected)); } - private static unsafe Span GetSpan(UnmanagedMemoryHandle h, int length) => new Span(h.Pointer, length); + private static unsafe Span GetSpan(UnmanagedMemoryHandle h, int length) => new(h.Pointer, length); [Theory] [InlineData(1, 1)] @@ -114,8 +114,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(5, 10)] public void Rent_MultiBuffer_ReturnsCorrectBuffers(int length, int bufferCount) { - var pool = new UniformUnmanagedMemoryPool(length, 10); - using var cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(length, 10); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] handles = pool.Rent(bufferCount); cleanup.Register(handles); @@ -131,8 +131,8 @@ public partial class UniformUnmanagedMemoryPoolTests [Fact] public void Rent_MultipleTimesWithoutReturn_ReturnsDifferentHandles() { - var pool = new UniformUnmanagedMemoryPool(128, 10); - using var cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(128, 10); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] a = pool.Rent(2); cleanup.Register(a); UnmanagedMemoryHandle b = pool.Rent(); @@ -149,10 +149,10 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(12, 4, 12)] public void RentReturnRent_SameBuffers(int totalCount, int rentUnit, int capacity) { - var pool = new UniformUnmanagedMemoryPool(128, capacity); - using var cleanup = new CleanupUtil(pool); - var allHandles = new HashSet(); - var handleUnits = new List(); + UniformUnmanagedMemoryPool pool = new(128, capacity); + using CleanupUtil cleanup = new(pool); + HashSet allHandles = new(); + List handleUnits = new(); UnmanagedMemoryHandle[] handles; for (int i = 0; i < totalCount; i += rentUnit) @@ -197,8 +197,8 @@ public partial class UniformUnmanagedMemoryPoolTests [Fact] public void Rent_SingleBuffer_OverCapacity_ReturnsInvalidBuffer() { - var pool = new UniformUnmanagedMemoryPool(7, 1000); - using var cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(7, 1000); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] initial = pool.Rent(1000); Assert.NotNull(initial); cleanup.Register(initial); @@ -212,8 +212,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(4, 7, 10)] public void Rent_MultiBuffer_OverCapacity_ReturnsNull(int initialRent, int attempt, int capacity) { - var pool = new UniformUnmanagedMemoryPool(128, capacity); - using var cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(128, capacity); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] initial = pool.Rent(initialRent); Assert.NotNull(initial); cleanup.Register(initial); @@ -228,8 +228,8 @@ public partial class UniformUnmanagedMemoryPoolTests [InlineData(3, 3, 7)] public void Rent_MultiBuff_BelowCapacity_Succeeds(int initialRent, int attempt, int capacity) { - var pool = new UniformUnmanagedMemoryPool(128, capacity); - using var cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(128, capacity); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle[] b0 = pool.Rent(initialRent); Assert.NotNull(b0); cleanup.Register(b0); @@ -250,8 +250,8 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest(string multipleInner) { - var pool = new UniformUnmanagedMemoryPool(16, 16); - using var cleanup = new CleanupUtil(pool); + UniformUnmanagedMemoryPool pool = new(16, 16); + using CleanupUtil cleanup = new(pool); UnmanagedMemoryHandle b0 = pool.Rent(); IntPtr h0 = b0.Handle; UnmanagedMemoryHandle b1 = pool.Rent(); @@ -290,7 +290,7 @@ public partial class UniformUnmanagedMemoryPoolTests static void RunTest() { - var pool = new UniformUnmanagedMemoryPool(16, 16); + UniformUnmanagedMemoryPool pool = new(16, 16); UnmanagedMemoryHandle a = pool.Rent(); UnmanagedMemoryHandle[] b = pool.Rent(2); pool.Return(a); @@ -306,13 +306,13 @@ public partial class UniformUnmanagedMemoryPoolTests public void RentReturn_IsThreadSafe() { int count = Environment.ProcessorCount * 200; - var pool = new UniformUnmanagedMemoryPool(8, count); - using var cleanup = new CleanupUtil(pool); - var rnd = new Random(0); + UniformUnmanagedMemoryPool pool = new(8, count); + using CleanupUtil cleanup = new(pool); + Random rnd = new(0); Parallel.For(0, Environment.ProcessorCount, (int i) => { - var allHandles = new List(); + List allHandles = new(); int pauseAt = rnd.Next(100); for (int j = 0; j < 100; j++) { @@ -359,7 +359,7 @@ public partial class UniformUnmanagedMemoryPoolTests [MethodImpl(MethodImplOptions.NoInlining)] static void LeakPoolInstance(bool withGuardedBuffers) { - var pool = new UniformUnmanagedMemoryPool(16, 128); + UniformUnmanagedMemoryPool pool = new(16, 128); if (withGuardedBuffers) { UnmanagedMemoryHandle h = pool.Rent(); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs index aa34a5c10..c1f5b44bf 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Buffers; +using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Microsoft.DotNet.RemoteExecutor; @@ -44,7 +45,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests } public static TheoryData AllocateData = - new TheoryData() + new() { { default(S4), 16, 256, 256, 1024, 64, 64, 1, -1, 64 }, { default(S4), 16, 256, 256, 1024, 256, 256, 1, -1, 256 }, @@ -69,7 +70,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests int expectedSizeOfLastBuffer) where T : struct { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator( + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new( sharedArrayPoolThresholdInBytes, maxContiguousPoolBufferInBytes, maxPoolSizeInBytes, @@ -86,13 +87,13 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [Fact] public void AllocateGroup_MultipleTimes_ExceedPoolLimit() { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator( + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new( 64, 128, 1024, 1024); - var groups = new List>(); + List> groups = []; for (int i = 0; i < 16; i++) { int lengthInElements = 128 / Unsafe.SizeOf(); @@ -110,7 +111,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [Fact] public void AllocateGroup_SizeInBytesOverLongMaxValue_ThrowsInvalidMemoryOperationException() { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(null); + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(null); Assert.Throws(() => allocator.AllocateGroup(int.MaxValue * (long)int.MaxValue, int.MaxValue)); } @@ -128,7 +129,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [Fact] public unsafe void Allocate_MemoryIsPinnableMultipleTimes() { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(null); + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(null); using IMemoryOwner memoryOwner = allocator.Allocate(100); using (MemoryHandle pin = memoryOwner.Memory.Pin()) @@ -149,7 +150,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests static void RunTest() { - var allocator = MemoryAllocator.Create(); + MemoryAllocator allocator = MemoryAllocator.Create(); long sixteenMegabytes = 16 * (1 << 20); // Should allocate 4 times 4MB discontiguos blocks: @@ -165,7 +166,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests static void RunTest() { - var allocator = MemoryAllocator.Create(new MemoryAllocatorOptions() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { MaximumPoolSizeMegabytes = 8 }); @@ -205,7 +206,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests static void RunTest(string sharedStr) { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(512, 1024, 16 * 1024, 1024); + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(512, 1024, 16 * 1024, 1024); IMemoryOwner buffer0 = allocator.Allocate(bool.Parse(sharedStr) ? 300 : 600); buffer0.GetSpan()[0] = 42; buffer0.Dispose(); @@ -223,7 +224,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests static void RunTest(string sharedStr) { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(512, 1024, 16 * 1024, 1024); + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(512, 1024, 16 * 1024, 1024); MemoryGroup g0 = allocator.AllocateGroup(bool.Parse(sharedStr) ? 300 : 600, 100); g0.Single().Span[0] = 42; g0.Dispose(); @@ -238,7 +239,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests RemoteExecutor.Invoke(RunTest).Dispose(); static void RunTest() { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(128, 512, 16 * 512, 1024); + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(128, 512, 16 * 512, 1024); MemoryGroup g = allocator.AllocateGroup(2048, 128); g.Dispose(); Assert.Equal(4, UnmanagedMemoryHandle.TotalOutstandingHandles); @@ -253,7 +254,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests RemoteExecutor.Invoke(RunTest).Dispose(); static void RunTest() { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(128, 512, 16 * 512, 1024); + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(128, 512, 16 * 512, 1024); IMemoryOwner b = allocator.Allocate(256); MemoryGroup g = allocator.AllocateGroup(2048, 128); Assert.Equal(5, UnmanagedMemoryHandle.TotalOutstandingHandles); @@ -273,67 +274,75 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [InlineData(1200)] // Group of two UniformUnmanagedMemoryPool buffers public void AllocateMemoryGroup_Finalization_ReturnsToPool(int length) { - if (TestEnvironment.IsMacOS) - { - // Skip on macOS: https://github.com/SixLabors/ImageSharp/issues/1887 - return; - } - - if (TestEnvironment.OSArchitecture == Architecture.Arm64) - { - // Skip on ARM64: https://github.com/SixLabors/ImageSharp/issues/2342 - return; - } - - if (!TestEnvironment.RunsOnCI) - { - // This may fail in local runs resulting in high memory load. - // Remove the condition for local debugging! - return; - } - - // RunTest(length.ToString()); - RemoteExecutor.Invoke(RunTest, length.ToString()).Dispose(); + RemoteExecutor.Invoke(RunTest, length.ToString(CultureInfo.InvariantCulture)).Dispose(); static void RunTest(string lengthStr) { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(512, 1024, 16 * 1024, 1024); - int lengthInner = int.Parse(lengthStr); - + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(512, 1024, 16 * 1024, 1024); + int lengthInner = int.Parse(lengthStr, CultureInfo.InvariantCulture); + + // We want to verify that a leaked (not disposed) `MemoryGroup` still returns its + // unmanaged handles into the pool when it is finalized. + // + // We intentionally do NOT validate this by checking the contents of the re-rented memory + // (contents are not guaranteed to be preserved) nor by comparing pointer values + // (the pool may return a different handle while still correctly pooling). + // + // Instead, we validate that after a forced GC+finalization cycle, a subsequent allocation + // of the same size does not cause the number of outstanding unmanaged handles to *increase* + // compared to a known baseline. + + // Establish a baseline: create one allocation and dispose it so the pool is initialized. + // (This ensures subsequent observations are not biased by first-time pool growth.) + allocator.AllocateGroup(lengthInner, 100).Dispose(); + int baselineHandles = UnmanagedMemoryHandle.TotalOutstandingHandles; + + // Leak one allocation and force finalization. AllocateGroupAndForget(allocator, lengthInner); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); - AllocateGroupAndForget(allocator, lengthInner, true); - GC.Collect(); - GC.WaitForPendingFinalizers(); - GC.Collect(); - GC.WaitForPendingFinalizers(); - - using MemoryGroup g = allocator.AllocateGroup(lengthInner, 100); - Assert.Equal(42, g.First().Span[0]); + // Allocate again. If the leaked group was finalized correctly and returned to the pool, + // this should not require additional unmanaged allocations (ie, the handle count must not grow). + allocator.AllocateGroup(lengthInner, 100).Dispose(); + + // Note: we use "<=" instead of "==" here. + // + // After we record the baseline, the pool is allowed to legitimately *decrease* + // `UnmanagedMemoryHandle.TotalOutstandingHandles` by trimming retained buffers + // (eg. via the pool's trim timer/GC callbacks/high-pressure logic). + // + // What must not happen is the opposite: the leaked (non-disposed) group should be finalized + // and its handles returned to the pool such that allocating again does NOT require creating + // additional unmanaged handles. Therefore the only invariant we can reliably assert here is + // "no growth" relative to the baseline. + Assert.True(UnmanagedMemoryHandle.TotalOutstandingHandles <= baselineHandles); } } - private static void AllocateGroupAndForget(UniformUnmanagedMemoryPoolMemoryAllocator allocator, int length, bool check = false) + [MethodImpl(MethodImplOptions.NoInlining)] + private static void AllocateGroupAndForget(UniformUnmanagedMemoryPoolMemoryAllocator allocator, int length) { + // Allocate a group and drop the reference without disposing. + // The test relies on the group's finalizer to return the rented memory to the pool. MemoryGroup g = allocator.AllocateGroup(length, 100); - if (check) - { - Assert.Equal(42, g.First().Span[0]); - } - g.First().Span[0] = 42; + // Touch the memory to ensure the buffer is actually materialized/usable. + g[0].Span[0] = 42; if (length < 512) { - // For ArrayPool.Shared, first array will be returned to the TLS storage of the finalizer thread, - // repeat rental to make sure per-core buckets are also utilized. + // For ArrayPool.Shared, the first rented array may be stored in TLS on the finalizer thread. + // Repeat rental to increase the chance that per-core buckets are involved when length + // is small and allocations go through ArrayPool. MemoryGroup g1 = allocator.AllocateGroup(length, 100); - g1.First().Span[0] = 42; + g1[0].Span[0] = 42; + g1 = null; } + + g = null; } [Theory] @@ -341,69 +350,63 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [InlineData(600)] // Group of single UniformUnmanagedMemoryPool buffer public void AllocateSingleMemoryOwner_Finalization_ReturnsToPool(int length) { - if (TestEnvironment.IsMacOS) - { - // Skip on macOS: https://github.com/SixLabors/ImageSharp/issues/1887 - return; - } - - if (TestEnvironment.OSArchitecture == Architecture.Arm64) - { - // Skip on ARM64: https://github.com/SixLabors/ImageSharp/issues/2342 - return; - } - - if (!TestEnvironment.RunsOnCI) - { - // This may fail in local runs resulting in high memory load. - // Remove the condition for local debugging! - return; - } - - // RunTest(length.ToString()); - RemoteExecutor.Invoke(RunTest, length.ToString()).Dispose(); + RemoteExecutor.Invoke(RunTest, length.ToString(CultureInfo.InvariantCulture)).Dispose(); static void RunTest(string lengthStr) { - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator(512, 1024, 16 * 1024, 1024); - int lengthInner = int.Parse(lengthStr); - + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new(512, 1024, 16 * 1024, 1024); + int lengthInner = int.Parse(lengthStr, CultureInfo.InvariantCulture); + + // This test verifies pooling behavior when an `IMemoryOwner` is leaked (not disposed) + // and must be returned to the pool by finalization. + // + // We do NOT use a sentinel byte value to prove reuse because the contents of pooled buffers + // are not required to be preserved across rentals. + // + // Instead, we assert that after forcing GC+finalization, renting the same size again does not + // increase `UnmanagedMemoryHandle.TotalOutstandingHandles` above a baseline. + + // Establish a baseline: allocate+dispose once so the pool has a chance to materialize/retain buffers. + allocator.Allocate(lengthInner).Dispose(); + int baselineHandles = UnmanagedMemoryHandle.TotalOutstandingHandles; + + // Leak one allocation and force finalization. AllocateSingleAndForget(allocator, lengthInner); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); - AllocateSingleAndForget(allocator, lengthInner, true); - GC.Collect(); - GC.WaitForPendingFinalizers(); - GC.Collect(); - GC.WaitForPendingFinalizers(); + // Allocate again. If the leaked owner was finalized correctly and returned to the pool, + // this should not require additional unmanaged allocations (ie, the handle count must not grow). + allocator.Allocate(lengthInner).Dispose(); - using IMemoryOwner g = allocator.Allocate(lengthInner); - Assert.Equal(42, g.GetSpan()[0]); - GC.KeepAlive(allocator); + // Note: we use "<=" rather than "==". The pool may legitimately trim and free retained buffers, + // reducing the handle count between baseline and check. The invariant is "no growth". + Assert.True(UnmanagedMemoryHandle.TotalOutstandingHandles <= baselineHandles); } } [MethodImpl(MethodImplOptions.NoInlining)] - private static void AllocateSingleAndForget(UniformUnmanagedMemoryPoolMemoryAllocator allocator, int length, bool check = false) + private static void AllocateSingleAndForget(UniformUnmanagedMemoryPoolMemoryAllocator allocator, int length) { + // Allocate and intentionally do not dispose. IMemoryOwner g = allocator.Allocate(length); - if (check) - { - Assert.Equal(42, g.GetSpan()[0]); - } + // Touch the memory to ensure the buffer is actually materialized/usable. g.GetSpan()[0] = 42; if (length < 512) { - // For ArrayPool.Shared, first array will be returned to the TLS storage of the finalizer thread, - // repeat rental to make sure per-core buckets are also utilized. + // For ArrayPool.Shared, the first rented array may be stored in TLS on the finalizer thread. + // Repeat rental to increase the chance that per-core buckets are involved when length + // is small and allocations go through ArrayPool. IMemoryOwner g1 = allocator.Allocate(length); g1.GetSpan()[0] = 42; + g1 = null; } + + g = null; } [Fact] @@ -422,7 +425,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [Fact] public void Allocate_OverLimit_ThrowsInvalidMemoryOperationException() { - MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { AllocationLimitMegabytes = 4 }); @@ -434,7 +437,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests [Fact] public void AllocateGroup_OverLimit_ThrowsInvalidMemoryOperationException() { - MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { AllocationLimitMegabytes = 4 }); @@ -450,7 +453,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests static void RunTest() { const long threeGB = 3L * (1 << 30); - MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions() + MemoryAllocator allocator = MemoryAllocator.Create(new MemoryAllocatorOptions { AllocationLimitMegabytes = (int)(threeGB / 1024) }); diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs index d0a5cfa9a..3b33eae5e 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedBufferTests.cs @@ -21,7 +21,7 @@ public class UnmanagedBufferTests [Fact] public void Allocate_CreatesValidBuffer() { - using var buffer = UnmanagedBuffer.Allocate(10); + using UnmanagedBuffer buffer = UnmanagedBuffer.Allocate(10); Span span = buffer.GetSpan(); Assert.Equal(10, span.Length); span[9] = 123; @@ -35,7 +35,7 @@ public class UnmanagedBufferTests static void RunTest() { - var buffer = UnmanagedBuffer.Allocate(10); + UnmanagedBuffer buffer = UnmanagedBuffer.Allocate(10); Assert.Equal(1, UnmanagedMemoryHandle.TotalOutstandingHandles); Span span = buffer.GetSpan(); @@ -76,10 +76,10 @@ public class UnmanagedBufferTests static List> FillList(int countInner) { - var l = new List>(); + List> l = new(); for (int i = 0; i < countInner; i++) { - var h = UnmanagedBuffer.Allocate(42); + UnmanagedBuffer h = UnmanagedBuffer.Allocate(42); l.Add(h); } diff --git a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs index 7a0736b54..59b793e01 100644 --- a/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs +++ b/tests/ImageSharp.Tests/Memory/Allocators/UnmanagedMemoryHandleTests.cs @@ -11,7 +11,7 @@ public class UnmanagedMemoryHandleTests [Fact] public unsafe void Allocate_AllocatesReadWriteMemory() { - var h = UnmanagedMemoryHandle.Allocate(128); + UnmanagedMemoryHandle h = UnmanagedMemoryHandle.Allocate(128); Assert.False(h.IsInvalid); Assert.True(h.IsValid); byte* ptr = (byte*)h.Handle; @@ -31,7 +31,7 @@ public class UnmanagedMemoryHandleTests [Fact] public void Free_ClosesHandle() { - var h = UnmanagedMemoryHandle.Allocate(128); + UnmanagedMemoryHandle h = UnmanagedMemoryHandle.Allocate(128); h.Free(); Assert.True(h.IsInvalid); Assert.Equal(IntPtr.Zero, h.Handle); @@ -47,11 +47,11 @@ public class UnmanagedMemoryHandleTests static void RunTest(string countStr) { int countInner = int.Parse(countStr); - var l = new List(); + List l = new(); for (int i = 0; i < countInner; i++) { Assert.Equal(i, UnmanagedMemoryHandle.TotalOutstandingHandles); - var h = UnmanagedMemoryHandle.Allocate(42); + UnmanagedMemoryHandle h = UnmanagedMemoryHandle.Allocate(42); Assert.Equal(i + 1, UnmanagedMemoryHandle.TotalOutstandingHandles); l.Add(h); } @@ -68,7 +68,7 @@ public class UnmanagedMemoryHandleTests [Fact] public void Equality_WhenTrue() { - var h1 = UnmanagedMemoryHandle.Allocate(10); + UnmanagedMemoryHandle h1 = UnmanagedMemoryHandle.Allocate(10); UnmanagedMemoryHandle h2 = h1; Assert.True(h1.Equals(h2)); @@ -82,8 +82,8 @@ public class UnmanagedMemoryHandleTests [Fact] public void Equality_WhenFalse() { - var h1 = UnmanagedMemoryHandle.Allocate(10); - var h2 = UnmanagedMemoryHandle.Allocate(10); + UnmanagedMemoryHandle h1 = UnmanagedMemoryHandle.Allocate(10); + UnmanagedMemoryHandle h2 = UnmanagedMemoryHandle.Allocate(10); Assert.False(h1.Equals(h2)); Assert.False(h2.Equals(h1)); diff --git a/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs b/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs index 88c05fdd0..e17c8c46f 100644 --- a/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs +++ b/tests/ImageSharp.Tests/Memory/Buffer2DTests.SwapOrCopyContent.cs @@ -10,7 +10,7 @@ public partial class Buffer2DTests { public class SwapOrCopyContent { - private readonly TestMemoryAllocator memoryAllocator = new TestMemoryAllocator(); + private readonly TestMemoryAllocator memoryAllocator = new(); [Fact] public void SwapOrCopyContent_WhenBothAllocated() @@ -40,8 +40,8 @@ public partial class Buffer2DTests [Fact] public void SwapOrCopyContent_WhenDestinationIsOwned_ShouldNotSwapInDisposedSourceBuffer() { - using var destData = MemoryGroup.Wrap(new int[100]); - using var dest = new Buffer2D(destData, 10, 10); + using MemoryGroup destData = MemoryGroup.Wrap(new int[100]); + using Buffer2D dest = new(destData, 10, 10); using (Buffer2D source = this.memoryAllocator.Allocate2D(10, 10, AllocationOptions.Clean)) { @@ -112,11 +112,11 @@ public partial class Buffer2DTests [InlineData(true)] public void WhenDestIsNotAllocated_SameSize_ShouldCopy(bool sourceIsAllocated) { - var data = new Rgba32[21]; - var color = new Rgba32(1, 2, 3, 4); + Rgba32[] data = new Rgba32[21]; + Rgba32 color = new(1, 2, 3, 4); - using var destOwner = new TestMemoryManager(data); - using var dest = new Buffer2D(MemoryGroup.Wrap(destOwner.Memory), 21, 1); + using TestMemoryManager destOwner = new(data); + using Buffer2D dest = new(MemoryGroup.Wrap(destOwner.Memory), 21, 1); using Buffer2D source = this.memoryAllocator.Allocate2D(21, 1); @@ -136,11 +136,11 @@ public partial class Buffer2DTests [InlineData(true)] public void WhenDestIsNotMemoryOwner_DifferentSize_Throws(bool sourceIsOwner) { - var data = new Rgba32[21]; - var color = new Rgba32(1, 2, 3, 4); + Rgba32[] data = new Rgba32[21]; + Rgba32 color = new(1, 2, 3, 4); - using var destOwner = new TestMemoryManager(data); - using var dest = new Buffer2D(MemoryGroup.Wrap(destOwner.Memory), 21, 1); + using TestMemoryManager destOwner = new(data); + using Buffer2D dest = new(MemoryGroup.Wrap(destOwner.Memory), 21, 1); using Buffer2D source = this.memoryAllocator.Allocate2D(22, 1); diff --git a/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs b/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs index 8ba3bf70a..6dfdd294c 100644 --- a/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs +++ b/tests/ImageSharp.Tests/Memory/Buffer2DTests.cs @@ -24,7 +24,7 @@ public partial class Buffer2DTests } } - private TestMemoryAllocator MemoryAllocator { get; } = new TestMemoryAllocator(); + private TestMemoryAllocator MemoryAllocator { get; } = new(); private const int Big = 99999; @@ -147,7 +147,7 @@ public partial class Buffer2DTests const int unpooledBufferSize = 8_000; int elementSize = sizeof(TestStructs.Foo); - var allocator = new UniformUnmanagedMemoryPoolMemoryAllocator( + UniformUnmanagedMemoryPoolMemoryAllocator allocator = new( sharedPoolThreshold * elementSize, poolBufferSize * elementSize, maxPoolSize * elementSize, @@ -155,7 +155,7 @@ public partial class Buffer2DTests using Buffer2D buffer = allocator.Allocate2D(width, height); - var rnd = new Random(42); + Random rnd = new(42); for (int y = 0; y < buffer.Height; y++) { @@ -208,7 +208,7 @@ public partial class Buffer2DTests } } - public static TheoryData GetRowSpanY_OutOfRange_Data = new TheoryData() + public static TheoryData GetRowSpanY_OutOfRange_Data = new() { { Big, 10, 8, -1 }, { Big, 10, 8, 8 }, @@ -227,7 +227,7 @@ public partial class Buffer2DTests Assert.True(ex is ArgumentOutOfRangeException || ex is IndexOutOfRangeException); } - public static TheoryData Indexer_OutOfRange_Data = new TheoryData() + public static TheoryData Indexer_OutOfRange_Data = new() { { Big, 10, 8, 1, -1 }, { Big, 10, 8, 1, 8 }, @@ -284,7 +284,7 @@ public partial class Buffer2DTests [InlineData(5, 1, 1, 3, 2)] public void CopyColumns(int width, int height, int startIndex, int destIndex, int columnCount) { - var rnd = new Random(123); + Random rnd = new(123); using (Buffer2D b = this.MemoryAllocator.Allocate2D(width, height)) { rnd.RandomFill(b.DangerousGetSingleSpan(), 0, 1); @@ -306,7 +306,7 @@ public partial class Buffer2DTests [Fact] public void CopyColumns_InvokeMultipleTimes() { - var rnd = new Random(123); + Random rnd = new(123); using (Buffer2D b = this.MemoryAllocator.Allocate2D(100, 100)) { rnd.RandomFill(b.DangerousGetSingleSpan(), 0, 1); @@ -341,9 +341,9 @@ public partial class Buffer2DTests public static TheoryData InvalidLengths { get; set; } = new() { - { new(-1, -1) }, - { new(32768, 32769) }, - { new(32769, 32768) } + { new Size(-1, -1) }, + { new Size(32768, 32769) }, + { new Size(32769, 32768) } }; [Theory] diff --git a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs index 46907b9c0..be7edbacc 100644 --- a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs +++ b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs @@ -7,14 +7,14 @@ namespace SixLabors.ImageSharp.Tests.Memory; public class BufferAreaTests { - private readonly TestMemoryAllocator memoryAllocator = new TestMemoryAllocator(); + private readonly TestMemoryAllocator memoryAllocator = new(); [Fact] public void Construct() { using Buffer2D buffer = this.memoryAllocator.Allocate2D(10, 20); - var rectangle = new Rectangle(3, 2, 5, 6); - var area = new Buffer2DRegion(buffer, rectangle); + Rectangle rectangle = new(3, 2, 5, 6); + Buffer2DRegion area = new(buffer, rectangle); Assert.Equal(buffer, area.Buffer); Assert.Equal(rectangle, area.Rectangle); @@ -43,7 +43,7 @@ public class BufferAreaTests { this.memoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity; using Buffer2D buffer = this.CreateTestBuffer(20, 30); - var r = new Rectangle(rx, ry, 5, 6); + Rectangle r = new(rx, ry, 5, 6); Buffer2DRegion region = buffer.GetRegion(r); @@ -62,7 +62,7 @@ public class BufferAreaTests this.memoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity; using Buffer2D buffer = this.CreateTestBuffer(20, 30); - var r = new Rectangle(rx, ry, w, h); + Rectangle r = new(rx, ry, w, h); Buffer2DRegion region = buffer.GetRegion(r); @@ -87,7 +87,7 @@ public class BufferAreaTests Buffer2DRegion area1 = area0.GetSubRegion(4, 4, 5, 5); - var expectedRect = new Rectangle(10, 12, 5, 5); + Rectangle expectedRect = new(10, 12, 5, 5); Assert.Equal(buffer, area1.Buffer); Assert.Equal(expectedRect, area1.Rectangle); @@ -120,7 +120,7 @@ public class BufferAreaTests this.memoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity; using Buffer2D buffer = this.CreateTestBuffer(22, 13); - var emptyRow = new int[22]; + int[] emptyRow = new int[22]; buffer.GetRegion().Clear(); for (int y = 0; y < 13; y++) diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs index a49ab7778..4e67df53b 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupIndexTests.cs @@ -8,8 +8,8 @@ public class MemoryGroupIndexTests [Fact] public void Equal() { - var a = new MemoryGroupIndex(10, 1, 3); - var b = new MemoryGroupIndex(10, 1, 3); + MemoryGroupIndex a = new(10, 1, 3); + MemoryGroupIndex b = new(10, 1, 3); Assert.True(a.Equals(b)); Assert.True(a == b); @@ -21,8 +21,8 @@ public class MemoryGroupIndexTests [Fact] public void SmallerBufferIndex() { - var a = new MemoryGroupIndex(10, 3, 3); - var b = new MemoryGroupIndex(10, 5, 3); + MemoryGroupIndex a = new(10, 3, 3); + MemoryGroupIndex b = new(10, 5, 3); Assert.False(a == b); Assert.True(a != b); @@ -33,8 +33,8 @@ public class MemoryGroupIndexTests [Fact] public void SmallerElementIndex() { - var a = new MemoryGroupIndex(10, 3, 3); - var b = new MemoryGroupIndex(10, 3, 9); + MemoryGroupIndex a = new(10, 3, 3); + MemoryGroupIndex b = new(10, 3, 9); Assert.False(a == b); Assert.True(a != b); @@ -45,7 +45,7 @@ public class MemoryGroupIndexTests [Fact] public void Increment() { - var a = new MemoryGroupIndex(10, 3, 3); + MemoryGroupIndex a = new(10, 3, 3); a += 1; Assert.Equal(new MemoryGroupIndex(10, 3, 4), a); } @@ -53,8 +53,8 @@ public class MemoryGroupIndexTests [Fact] public void Increment_OverflowBuffer() { - var a = new MemoryGroupIndex(10, 5, 3); - var b = new MemoryGroupIndex(10, 5, 9); + MemoryGroupIndex a = new(10, 5, 3); + MemoryGroupIndex b = new(10, 5, 9); a += 8; b += 1; diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs index 4c7de5412..678a089a8 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.Allocate.cs @@ -59,7 +59,7 @@ public partial class MemoryGroupTests this.MemoryAllocator.BufferCapacityInBytes = bufferCapacity; // Act: - using var g = MemoryGroup.Allocate(this.MemoryAllocator, totalLength, bufferAlignment); + using MemoryGroup g = MemoryGroup.Allocate(this.MemoryAllocator, totalLength, bufferAlignment); // Assert: ValidateAllocateMemoryGroup(expectedNumberOfBuffers, expectedBufferSize, expectedSizeOfLastBuffer, g); @@ -83,7 +83,7 @@ public partial class MemoryGroupTests return; } - var pool = new UniformUnmanagedMemoryPool(bufferCapacity, expectedNumberOfBuffers); + UniformUnmanagedMemoryPool pool = new(bufferCapacity, expectedNumberOfBuffers); // Act: Assert.True(MemoryGroup.TryAllocate(pool, totalLength, bufferAlignment, AllocationOptions.None, out MemoryGroup g)); @@ -98,7 +98,7 @@ public partial class MemoryGroupTests [InlineData(AllocationOptions.Clean)] public unsafe void Allocate_FromPool_AllocationOptionsAreApplied(AllocationOptions options) { - var pool = new UniformUnmanagedMemoryPool(10, 5); + UniformUnmanagedMemoryPool pool = new(10, 5); UnmanagedMemoryHandle[] buffers = pool.Rent(5); foreach (UnmanagedMemoryHandle b in buffers) { @@ -128,7 +128,7 @@ public partial class MemoryGroupTests int requestBytes, bool shouldSucceed) { - var pool = new UniformUnmanagedMemoryPool(bufferCapacityBytes, poolCapacity); + UniformUnmanagedMemoryPool pool = new(bufferCapacityBytes, poolCapacity); int alignmentElements = alignmentBytes / Unsafe.SizeOf(); int requestElements = requestBytes / Unsafe.SizeOf(); @@ -194,7 +194,7 @@ public partial class MemoryGroupTests HashSet bufferHashes; int expectedBlockCount = 5; - using (var g = MemoryGroup.Allocate(this.MemoryAllocator, 500, 100, allocationOptions)) + using (MemoryGroup g = MemoryGroup.Allocate(this.MemoryAllocator, 500, 100, allocationOptions)) { IReadOnlyList allocationLog = this.MemoryAllocator.AllocationLog; Assert.Equal(expectedBlockCount, allocationLog.Count); diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.CopyTo.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.CopyTo.cs index 23aaf3c55..c140571fc 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.CopyTo.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.CopyTo.cs @@ -50,7 +50,7 @@ public partial class MemoryGroupTests public void GroupToSpan_Success(long totalLength, int bufferLength, int spanLength) { using MemoryGroup src = this.CreateTestGroup(totalLength, bufferLength, true); - var trg = new int[spanLength]; + int[] trg = new int[spanLength]; src.CopyTo(trg); int expected = 1; @@ -67,7 +67,7 @@ public partial class MemoryGroupTests public void GroupToSpan_OutOfRange(long totalLength, int bufferLength, int spanLength) { using MemoryGroup src = this.CreateTestGroup(totalLength, bufferLength, true); - var trg = new int[spanLength]; + int[] trg = new int[spanLength]; Assert.ThrowsAny(() => src.CopyTo(trg)); } @@ -78,7 +78,7 @@ public partial class MemoryGroupTests [InlineData(0, 3, 0)] public void SpanToGroup_Success(long totalLength, int bufferLength, int spanLength) { - var src = new int[spanLength]; + int[] src = new int[spanLength]; for (int i = 0; i < src.Length; i++) { src[i] = i + 1; @@ -100,7 +100,7 @@ public partial class MemoryGroupTests [InlineData(0, 3, 1)] public void SpanToGroup_OutOfRange(long totalLength, int bufferLength, int spanLength) { - var src = new int[spanLength]; + int[] src = new int[spanLength]; using MemoryGroup trg = this.CreateTestGroup(totalLength, bufferLength, true); Assert.ThrowsAny(() => src.AsSpan().CopyTo(trg)); } diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs index 316150c30..fe1867f20 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTests.cs @@ -12,7 +12,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase [Fact] public void IsValid_TrueAfterCreation() { - using var g = MemoryGroup.Allocate(this.MemoryAllocator, 10, 100); + using MemoryGroup g = MemoryGroup.Allocate(this.MemoryAllocator, 10, 100); Assert.True(g.IsValid); } @@ -20,7 +20,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase [Fact] public void IsValid_FalseAfterDisposal() { - using var g = MemoryGroup.Allocate(this.MemoryAllocator, 10, 100); + using MemoryGroup g = MemoryGroup.Allocate(this.MemoryAllocator, 10, 100); g.Dispose(); Assert.False(g.IsValid); @@ -28,7 +28,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase #pragma warning disable SA1509 private static readonly TheoryData CopyAndTransformData = - new TheoryData() + new() { { 20, 10, 20, 10 }, { 20, 5, 20, 4 }, @@ -102,10 +102,10 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase int[] data0 = { 1, 2, 3, 4 }; int[] data1 = { 5, 6, 7, 8 }; int[] data2 = { 9, 10 }; - using var mgr0 = new TestMemoryManager(data0); - using var mgr1 = new TestMemoryManager(data1); + using TestMemoryManager mgr0 = new(data0); + using TestMemoryManager mgr1 = new(data1); - using var group = MemoryGroup.Wrap(mgr0.Memory, mgr1.Memory, data2); + using MemoryGroup group = MemoryGroup.Wrap(mgr0.Memory, mgr1.Memory, data2); Assert.Equal(3, group.Count); Assert.Equal(4, group.BufferLength); @@ -124,7 +124,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase } } - public static TheoryData GetBoundedSlice_SuccessData = new TheoryData() + public static TheoryData GetBoundedSlice_SuccessData = new() { { 300, 100, 110, 80 }, { 300, 100, 100, 100 }, @@ -153,7 +153,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase } } - public static TheoryData GetBoundedSlice_ErrorData = new TheoryData() + public static TheoryData GetBoundedSlice_ErrorData = new() { { 300, 100, -1, 91 }, { 300, 100, 110, 91 }, @@ -217,7 +217,7 @@ public partial class MemoryGroupTests : MemoryGroupTestsBase using MemoryGroup group = this.CreateTestGroup(100, 10, true); group.Clear(); - var expectedRow = new int[10]; + int[] expectedRow = new int[10]; foreach (Memory memory in group) { Assert.True(memory.Span.SequenceEqual(expectedRow)); diff --git a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs index 8fe6ef3dd..0eaebbfef 100644 --- a/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs +++ b/tests/ImageSharp.Tests/Memory/DiscontiguousBuffers/MemoryGroupTestsBase.cs @@ -7,7 +7,7 @@ namespace SixLabors.ImageSharp.Tests.Memory.DiscontiguousBuffers; public abstract class MemoryGroupTestsBase { - internal readonly TestMemoryAllocator MemoryAllocator = new TestMemoryAllocator(); + internal readonly TestMemoryAllocator MemoryAllocator = new(); /// /// Create a group, either uninitialized or filled with incrementing numbers starting with 1. @@ -15,7 +15,7 @@ public abstract class MemoryGroupTestsBase internal MemoryGroup CreateTestGroup(long totalLength, int bufferLength, bool fillSequence = false) { this.MemoryAllocator.BufferCapacityInBytes = bufferLength * sizeof(int); - var g = MemoryGroup.Allocate(this.MemoryAllocator, totalLength, bufferLength); + MemoryGroup g = MemoryGroup.Allocate(this.MemoryAllocator, totalLength, bufferLength); if (!fillSequence) { diff --git a/tests/ImageSharp.Tests/Memory/TestStructs.cs b/tests/ImageSharp.Tests/Memory/TestStructs.cs index ccbee5bd5..bb6a07ec9 100644 --- a/tests/ImageSharp.Tests/Memory/TestStructs.cs +++ b/tests/ImageSharp.Tests/Memory/TestStructs.cs @@ -19,7 +19,7 @@ public static class TestStructs internal static Foo[] CreateArray(int size) { - var result = new Foo[size]; + Foo[] result = new Foo[size]; for (int i = 0; i < size; i++) { result[i] = new Foo(i + 1, i + 1); @@ -70,7 +70,7 @@ public static class TestStructs internal static AlignedFoo[] CreateArray(int size) { - var result = new AlignedFoo[size]; + AlignedFoo[] result = new AlignedFoo[size]; for (int i = 0; i < size; i++) { result[i] = new AlignedFoo(i + 1, i + 1); diff --git a/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs b/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs index 252784a7c..6c8dd2618 100644 --- a/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs +++ b/tests/ImageSharp.Tests/MemoryAllocatorValidator.cs @@ -20,25 +20,18 @@ public static class MemoryAllocatorValidator private static void MemoryDiagnostics_MemoryReleased() { TestMemoryDiagnostics backing = LocalInstance.Value; - if (backing != null) - { - backing.TotalRemainingAllocated--; - } + backing?.OnReleased(); } private static void MemoryDiagnostics_MemoryAllocated() { TestMemoryDiagnostics backing = LocalInstance.Value; - if (backing != null) - { - backing.TotalAllocated++; - backing.TotalRemainingAllocated++; - } + backing?.OnAllocated(); } public static TestMemoryDiagnostics MonitorAllocations() { - var diag = new TestMemoryDiagnostics(); + TestMemoryDiagnostics diag = new(); LocalInstance.Value = diag; return diag; } @@ -48,11 +41,23 @@ public static class MemoryAllocatorValidator public static void ValidateAllocations(int expectedAllocationCount = 0) => LocalInstance.Value?.Validate(expectedAllocationCount); - public class TestMemoryDiagnostics : IDisposable + public sealed class TestMemoryDiagnostics : IDisposable { - public int TotalAllocated { get; set; } + private int totalAllocated; + private int totalRemainingAllocated; + + public int TotalAllocated => Volatile.Read(ref this.totalAllocated); + + public int TotalRemainingAllocated => Volatile.Read(ref this.totalRemainingAllocated); + + internal void OnAllocated() + { + Interlocked.Increment(ref this.totalAllocated); + Interlocked.Increment(ref this.totalRemainingAllocated); + } - public int TotalRemainingAllocated { get; set; } + internal void OnReleased() + => Interlocked.Decrement(ref this.totalRemainingAllocated); public void Validate(int expectedAllocationCount) { diff --git a/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs b/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs index cdd6f0cc4..e50d0b617 100644 --- a/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs +++ b/tests/ImageSharp.Tests/Metadata/ImageFrameMetadataTests.cs @@ -45,10 +45,10 @@ public class ImageFrameMetadataTests ExifProfile exifProfile = new(); exifProfile.SetValue(ExifTag.Software, "UnitTest"); exifProfile.SetValue(ExifTag.Artist, "UnitTest"); - XmpProfile xmpProfile = new(Array.Empty()); + XmpProfile xmpProfile = new([]); IccProfile iccProfile = new() { - Header = new IccProfileHeader() + Header = new IccProfileHeader { CmmType = "Unittest" } @@ -74,7 +74,7 @@ public class ImageFrameMetadataTests Assert.False(metaData.ExifProfile.Equals(clone.ExifProfile)); Assert.True(metaData.ExifProfile.Values.Count == clone.ExifProfile.Values.Count); Assert.False(ReferenceEquals(metaData.XmpProfile, clone.XmpProfile)); - Assert.True(metaData.XmpProfile.Data.Equals(clone.XmpProfile.Data)); + Assert.False(ReferenceEquals(metaData.XmpProfile.Data, clone.XmpProfile.Data)); Assert.False(metaData.GetGifMetadata().Equals(clone.GetGifMetadata())); Assert.False(metaData.IccProfile.Equals(clone.IccProfile)); Assert.False(metaData.IptcProfile.Equals(clone.IptcProfile)); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs index 76e2d35c4..ff8b034c5 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/CICP/CicpProfileTests.cs @@ -25,10 +25,10 @@ public class CicpProfileTests public void WritingPng_PreservesCicpProfile() { // arrange - using var image = new Image(1, 1); - var original = CreateCicpProfile(); + using Image image = new(1, 1); + CicpProfile original = CreateCicpProfile(); image.Metadata.CicpProfile = original; - var encoder = new PngEncoder(); + PngEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -49,7 +49,7 @@ public class CicpProfileTests private static CicpProfile CreateCicpProfile() { - var profile = new CicpProfile() + CicpProfile profile = new() { ColorPrimaries = CicpColorPrimaries.ItuRBt2020_2, TransferCharacteristics = CicpTransferCharacteristics.SmpteSt2084, @@ -70,7 +70,7 @@ public class CicpProfileTests private static Image WriteAndRead(Image image, IImageEncoder encoder) { - using (var memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { image.Save(memStream, encoder); image.Dispose(); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs index 8072bebd7..c098ace09 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs @@ -82,13 +82,13 @@ public class ExifProfileTests public void ConstructorEmpty() { new ExifProfile(null); - new ExifProfile(Array.Empty()); + new ExifProfile([]); } [Fact] public void EmptyWriter() { - var profile = new ExifProfile() { Parts = ExifParts.GpsTags }; + ExifProfile profile = new() { Parts = ExifParts.GpsTags }; profile.SetValue(ExifTag.Copyright, "Copyright text"); byte[] bytes = profile.ToByteArray(); @@ -120,14 +120,14 @@ public class ExifProfileTests [InlineData(TestImageWriteFormat.WebpLossy)] public void WriteFraction(TestImageWriteFormat imageFormat) { - using var memStream = new MemoryStream(); + using MemoryStream memStream = new(); double exposureTime = 1.0 / 1600; ExifProfile profile = GetExifProfile(); profile.SetValue(ExifTag.ExposureTime, new Rational(exposureTime)); - var image = new Image(1, 1); + Image image = new(1, 1); image.Metadata.ExifProfile = profile; image = WriteAndRead(image, imageFormat); @@ -231,7 +231,7 @@ public class ExifProfileTests IExifValue referenceBlackWhite = image.Metadata.ExifProfile.GetValue(ExifTag.ReferenceBlackWhite); Assert.Null(referenceBlackWhite.Value); - var expectedLatitude = new Rational[] { new Rational(12.3), new Rational(4.56), new Rational(789.0) }; + Rational[] expectedLatitude = [new(12.3), new(4.56), new(789.0)]; image.Metadata.ExifProfile.SetValue(ExifTag.GPSLatitude, expectedLatitude); IExifValue latitude = image.Metadata.ExifProfile.GetValue(ExifTag.GPSLatitude); @@ -308,11 +308,11 @@ public class ExifProfileTests [Fact] public void Syncs() { - var exifProfile = new ExifProfile(); + ExifProfile exifProfile = new(); exifProfile.SetValue(ExifTag.XResolution, new Rational(200)); exifProfile.SetValue(ExifTag.YResolution, new Rational(300)); - var metaData = new ImageMetadata + ImageMetadata metaData = new() { ExifProfile = exifProfile, HorizontalResolution = 200, @@ -362,19 +362,19 @@ public class ExifProfileTests [Fact] public void ReadWriteLargeProfileJpg() { - ExifTag[] tags = { ExifTag.Software, ExifTag.Copyright, ExifTag.Model, ExifTag.ImageDescription }; + ExifTag[] tags = [ExifTag.Software, ExifTag.Copyright, ExifTag.Model, ExifTag.ImageDescription]; foreach (ExifTag tag in tags) { // Arrange - var junk = new StringBuilder(); + StringBuilder junk = new(); for (int i = 0; i < 65600; i++) { junk.Append('a'); } - var image = new Image(100, 100); + Image image = new(100, 100); ExifProfile expectedProfile = CreateExifProfile(); - var expectedProfileTags = expectedProfile.Values.Select(x => x.Tag).ToList(); + List expectedProfileTags = expectedProfile.Values.Select(x => x.Tag).ToList(); expectedProfile.SetValue(tag, junk.ToString()); image.Metadata.ExifProfile = expectedProfile; @@ -437,7 +437,7 @@ public class ExifProfileTests byte[] bytes = profile.ToByteArray(); Assert.Equal(531, bytes.Length); - var profile2 = new ExifProfile(bytes); + ExifProfile profile2 = new(bytes); Assert.Equal(25, profile2.Values.Count); } @@ -449,7 +449,7 @@ public class ExifProfileTests public void WritingImagePreservesExifProfile(TestImageWriteFormat imageFormat) { // Arrange - var image = new Image(1, 1); + Image image = new(1, 1); image.Metadata.ExifProfile = CreateExifProfile(); // Act @@ -472,11 +472,11 @@ public class ExifProfileTests // Arrange byte[] exifBytesWithoutExifCode = ExifConstants.LittleEndianByteOrderMarker.ToArray(); ExifProfile expectedProfile = CreateExifProfile(); - var expectedProfileTags = expectedProfile.Values.Select(x => x.Tag).ToList(); + List expectedProfileTags = expectedProfile.Values.Select(x => x.Tag).ToList(); // Act byte[] actualBytes = expectedProfile.ToByteArray(); - var actualProfile = new ExifProfile(actualBytes); + ExifProfile actualProfile = new(actualBytes); // Assert Assert.NotNull(actualBytes); @@ -492,7 +492,7 @@ public class ExifProfileTests private static ExifProfile CreateExifProfile() { - var profile = new ExifProfile(); + ExifProfile profile = new(); foreach (KeyValuePair exifProfileValue in TestProfileValues) { @@ -505,7 +505,7 @@ public class ExifProfileTests [Fact] public void IfdStructure() { - var exif = new ExifProfile(); + ExifProfile exif = new(); exif.SetValue(ExifTag.XPAuthor, "Dan Petitt"); Span actualBytes = exif.ToByteArray(); @@ -547,7 +547,7 @@ public class ExifProfileTests private static Image WriteAndReadJpeg(Image image) { - using var memStream = new MemoryStream(); + using MemoryStream memStream = new(); image.SaveAsJpeg(memStream); image.Dispose(); @@ -557,7 +557,7 @@ public class ExifProfileTests private static Image WriteAndReadPng(Image image) { - using var memStream = new MemoryStream(); + using MemoryStream memStream = new(); image.SaveAsPng(memStream); image.Dispose(); @@ -567,8 +567,8 @@ public class ExifProfileTests private static Image WriteAndReadWebp(Image image, WebpFileFormatType fileFormat) { - using var memStream = new MemoryStream(); - image.SaveAsWebp(memStream, new WebpEncoder() { FileFormat = fileFormat }); + using MemoryStream memStream = new(); + image.SaveAsWebp(memStream, new WebpEncoder { FileFormat = fileFormat }); image.Dispose(); memStream.Position = 0; diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs index 8fe19b37d..983ff4493 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifReaderTests.cs @@ -11,7 +11,7 @@ public class ExifReaderTests [Fact] public void Read_DataIsEmpty_ReturnsEmptyCollection() { - var reader = new ExifReader(Array.Empty()); + ExifReader reader = new(Array.Empty()); IList result = reader.ReadValues(); @@ -21,7 +21,7 @@ public class ExifReaderTests [Fact] public void Read_DataIsMinimal_ReturnsEmptyCollection() { - var reader = new ExifReader(new byte[] { 69, 120, 105, 102, 0, 0 }); + ExifReader reader = new(new byte[] { 69, 120, 105, 102, 0, 0 }); IList result = reader.ReadValues(); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs index 1154b3439..3f13afa6f 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifTagDescriptionAttributeTests.cs @@ -12,7 +12,7 @@ public class ExifTagDescriptionAttributeTests [Fact] public void TestExifTag() { - var exifProfile = new ExifProfile(); + ExifProfile exifProfile = new(); exifProfile.SetValue(ExifTag.ResolutionUnit, (ushort)1); IExifValue value = exifProfile.GetValue(ExifTag.ResolutionUnit); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs index 99cafa896..d7d6741ba 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/Exif/Values/ExifValuesTests.cs @@ -9,14 +9,14 @@ namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Exif.Values; [Trait("Profile", "Exif")] public class ExifValuesTests { - public static TheoryData ByteTags => new TheoryData + public static TheoryData ByteTags => new() { { ExifTag.FaxProfile }, { ExifTag.ModeNumber }, { ExifTag.GPSAltitudeRef } }; - public static TheoryData ByteArrayTags => new TheoryData + public static TheoryData ByteArrayTags => new() { { ExifTag.ClipPath }, { ExifTag.VersionYear }, @@ -26,7 +26,7 @@ public class ExifValuesTests { ExifTag.GPSVersionID }, }; - public static TheoryData DoubleArrayTags => new TheoryData + public static TheoryData DoubleArrayTags => new() { { ExifTag.PixelScale }, { ExifTag.IntergraphMatrix }, @@ -34,7 +34,7 @@ public class ExifValuesTests { ExifTag.ModelTransform } }; - public static TheoryData LongTags => new TheoryData + public static TheoryData LongTags => new() { { ExifTag.SubfileType }, { ExifTag.SubIFDOffset }, @@ -59,7 +59,7 @@ public class ExifValuesTests { ExifTag.ImageNumber }, }; - public static TheoryData LongArrayTags => new TheoryData + public static TheoryData LongArrayTags => new() { { ExifTag.FreeOffsets }, { ExifTag.FreeByteCounts }, @@ -73,7 +73,7 @@ public class ExifValuesTests { ExifTag.IntergraphRegisters } }; - public static TheoryData NumberTags => new TheoryData + public static TheoryData NumberTags => new() { { ExifTag.ImageWidth }, { ExifTag.ImageLength }, @@ -85,7 +85,7 @@ public class ExifValuesTests { ExifTag.PixelYDimension } }; - public static TheoryData NumberArrayTags => new TheoryData + public static TheoryData NumberArrayTags => new() { { ExifTag.StripOffsets }, { ExifTag.StripByteCounts }, @@ -94,7 +94,7 @@ public class ExifValuesTests { ExifTag.ImageLayer } }; - public static TheoryData RationalTags => new TheoryData + public static TheoryData RationalTags => new() { { ExifTag.XPosition }, { ExifTag.YPosition }, @@ -131,7 +131,7 @@ public class ExifValuesTests { ExifTag.GPSHPositioningError }, }; - public static TheoryData RationalArrayTags => new TheoryData + public static TheoryData RationalArrayTags => new() { { ExifTag.WhitePoint }, { ExifTag.PrimaryChromaticities }, @@ -145,7 +145,7 @@ public class ExifValuesTests { ExifTag.LensSpecification } }; - public static TheoryData ShortTags => new TheoryData + public static TheoryData ShortTags => new() { { ExifTag.OldSubfileType }, { ExifTag.Compression }, @@ -196,7 +196,7 @@ public class ExifValuesTests { ExifTag.GPSDifferential } }; - public static TheoryData ShortArrayTags => new TheoryData + public static TheoryData ShortArrayTags => new() { { ExifTag.BitsPerSample }, { ExifTag.MinSampleValue }, @@ -220,7 +220,7 @@ public class ExifValuesTests { ExifTag.SubjectLocation } }; - public static TheoryData SignedRationalTags => new TheoryData + public static TheoryData SignedRationalTags => new() { { ExifTag.ShutterSpeedValue }, { ExifTag.BrightnessValue }, @@ -230,17 +230,17 @@ public class ExifValuesTests { ExifTag.CameraElevationAngle } }; - public static TheoryData SignedRationalArrayTags => new TheoryData + public static TheoryData SignedRationalArrayTags => new() { { ExifTag.Decode } }; - public static TheoryData SignedShortArrayTags => new TheoryData + public static TheoryData SignedShortArrayTags => new() { { ExifTag.TimeZoneOffset } }; - public static TheoryData StringTags => new TheoryData + public static TheoryData StringTags => new() { { ExifTag.ImageDescription }, { ExifTag.Make }, @@ -298,13 +298,13 @@ public class ExifValuesTests { ExifTag.GPSDateStamp }, }; - public static TheoryData UndefinedTags => new TheoryData + public static TheoryData UndefinedTags => new() { { ExifTag.FileSource }, { ExifTag.SceneType } }; - public static TheoryData UndefinedArrayTags => new TheoryData + public static TheoryData UndefinedArrayTags => new() { { ExifTag.JPEGTables }, { ExifTag.OECF }, @@ -320,14 +320,14 @@ public class ExifValuesTests { ExifTag.ImageSourceData }, }; - public static TheoryData EncodedStringTags => new TheoryData + public static TheoryData EncodedStringTags => new() { { ExifTag.UserComment }, { ExifTag.GPSProcessingMethod }, { ExifTag.GPSAreaInformation } }; - public static TheoryData Ucs2StringTags => new TheoryData + public static TheoryData Ucs2StringTags => new() { { ExifTag.XPTitle }, { ExifTag.XPComment }, @@ -347,7 +347,7 @@ public class ExifValuesTests Assert.True(value.TrySetValue((int)expected)); Assert.True(value.TrySetValue(expected)); - var typed = (ExifByte)value; + ExifByte typed = (ExifByte)value; Assert.Equal(expected, typed.Value); } @@ -355,13 +355,13 @@ public class ExifValuesTests [MemberData(nameof(ByteArrayTags))] public void ExifByteArrayTests(ExifTag tag) { - byte[] expected = new[] { byte.MaxValue }; + byte[] expected = [byte.MaxValue]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifByteArray)value; + ExifByteArray typed = (ExifByteArray)value; Assert.Equal(expected, typed.Value); } @@ -369,13 +369,13 @@ public class ExifValuesTests [MemberData(nameof(DoubleArrayTags))] public void ExifDoubleArrayTests(ExifTag tag) { - double[] expected = new[] { double.MaxValue }; + double[] expected = [double.MaxValue]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifDoubleArray)value; + ExifDoubleArray typed = (ExifDoubleArray)value; Assert.Equal(expected, typed.Value); } @@ -389,7 +389,7 @@ public class ExifValuesTests Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifLong)value; + ExifLong typed = (ExifLong)value; Assert.Equal(expected, typed.Value); } @@ -397,13 +397,13 @@ public class ExifValuesTests [MemberData(nameof(LongArrayTags))] public void ExifLongArrayTests(ExifTag tag) { - uint[] expected = new[] { uint.MaxValue }; + uint[] expected = [uint.MaxValue]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifLongArray)value; + ExifLongArray typed = (ExifLongArray)value; Assert.Equal(expected, typed.Value); } @@ -447,7 +447,7 @@ public class ExifValuesTests Assert.True(value.TrySetValue((int)expected)); Assert.True(value.TrySetValue(expected)); - var typed = (ExifNumber)value; + ExifNumber typed = (ExifNumber)value; Assert.Equal(expected, typed.Value); typed.Value = ushort.MaxValue + 1; @@ -458,13 +458,13 @@ public class ExifValuesTests [MemberData(nameof(NumberArrayTags))] public void ExifNumberArrayTests(ExifTag tag) { - Number[] expected = new[] { new Number(uint.MaxValue) }; + Number[] expected = [new Number(uint.MaxValue)]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifNumberArray)value; + ExifNumberArray typed = (ExifNumberArray)value; Assert.Equal(expected, typed.Value); Assert.True(value.TrySetValue(int.MaxValue)); @@ -481,14 +481,14 @@ public class ExifValuesTests [MemberData(nameof(RationalTags))] public void ExifRationalTests(ExifTag tag) { - var expected = new Rational(21, 42); + Rational expected = new(21, 42); ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(new SignedRational(expected.ToDouble()))); Assert.True(value.TrySetValue(expected)); - var typed = (ExifRational)value; + ExifRational typed = (ExifRational)value; Assert.Equal(expected, typed.Value); } @@ -496,13 +496,13 @@ public class ExifValuesTests [MemberData(nameof(RationalArrayTags))] public void ExifRationalArrayTests(ExifTag tag) { - Rational[] expected = new[] { new Rational(21, 42) }; + Rational[] expected = [new Rational(21, 42)]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifRationalArray)value; + ExifRationalArray typed = (ExifRationalArray)value; Assert.Equal(expected, typed.Value); } @@ -518,7 +518,7 @@ public class ExifValuesTests Assert.True(value.TrySetValue((short)expected)); Assert.True(value.TrySetValue(expected)); - var typed = (ExifShort)value; + ExifShort typed = (ExifShort)value; Assert.Equal(expected, typed.Value); } @@ -526,13 +526,13 @@ public class ExifValuesTests [MemberData(nameof(ShortArrayTags))] public void ExifShortArrayTests(ExifTag tag) { - ushort[] expected = new[] { ushort.MaxValue }; + ushort[] expected = [ushort.MaxValue]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifShortArray)value; + ExifShortArray typed = (ExifShortArray)value; Assert.Equal(expected, typed.Value); } @@ -540,13 +540,13 @@ public class ExifValuesTests [MemberData(nameof(SignedRationalTags))] public void ExifSignedRationalTests(ExifTag tag) { - var expected = new SignedRational(21, 42); + SignedRational expected = new(21, 42); ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifSignedRational)value; + ExifSignedRational typed = (ExifSignedRational)value; Assert.Equal(expected, typed.Value); } @@ -554,13 +554,13 @@ public class ExifValuesTests [MemberData(nameof(SignedRationalArrayTags))] public void ExifSignedRationalArrayTests(ExifTag tag) { - SignedRational[] expected = new[] { new SignedRational(21, 42) }; + SignedRational[] expected = [new SignedRational(21, 42)]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifSignedRationalArray)value; + ExifSignedRationalArray typed = (ExifSignedRationalArray)value; Assert.Equal(expected, typed.Value); } @@ -569,13 +569,13 @@ public class ExifValuesTests [MemberData(nameof(SignedShortArrayTags))] public void ExifSignedShortArrayTests(ExifTag tag) { - short[] expected = new short[] { 21, 42 }; + short[] expected = [21, 42]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifSignedShortArray)value; + ExifSignedShortArray typed = (ExifSignedShortArray)value; Assert.Equal(expected, typed.Value); } @@ -589,7 +589,7 @@ public class ExifValuesTests Assert.False(value.TrySetValue(0M)); Assert.True(value.TrySetValue(expected)); - var typed = (ExifString)value; + ExifString typed = (ExifString)value; Assert.Equal(expected, typed.Value); } @@ -604,7 +604,7 @@ public class ExifValuesTests Assert.True(value.TrySetValue((int)expected)); Assert.True(value.TrySetValue(expected)); - var typed = (ExifByte)value; + ExifByte typed = (ExifByte)value; Assert.Equal(expected, typed.Value); } @@ -612,13 +612,13 @@ public class ExifValuesTests [MemberData(nameof(UndefinedArrayTags))] public void ExifUndefinedArrayTests(ExifTag tag) { - byte[] expected = new[] { byte.MaxValue }; + byte[] expected = [byte.MaxValue]; ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(expected.ToString())); Assert.True(value.TrySetValue(expected)); - var typed = (ExifByteArray)value; + ExifByteArray typed = (ExifByteArray)value; Assert.Equal(expected, typed.Value); } @@ -628,18 +628,18 @@ public class ExifValuesTests { foreach (object code in Enum.GetValues(typeof(EncodedString.CharacterCode))) { - var charCode = (EncodedString.CharacterCode)code; + EncodedString.CharacterCode charCode = (EncodedString.CharacterCode)code; Assert.Equal(ExifEncodedStringHelpers.CharacterCodeBytesLength, ExifEncodedStringHelpers.GetCodeBytes(charCode).Length); const string expectedText = "test string"; - var expected = new EncodedString(charCode, expectedText); + EncodedString expected = new(charCode, expectedText); ExifValue value = ExifValues.Create(tag); Assert.False(value.TrySetValue(123)); Assert.True(value.TrySetValue(expected)); - var typed = (ExifEncodedString)value; + ExifEncodedString typed = (ExifEncodedString)value; Assert.Equal(expected, typed.Value); Assert.Equal(expectedText, (string)typed.Value); Assert.Equal(charCode, typed.Value.Code); @@ -656,7 +656,7 @@ public class ExifValuesTests Assert.False(value.TrySetValue(123)); Assert.True(value.TrySetValue(expected)); - var typed = (ExifUcs2String)value; + ExifUcs2String typed = (ExifUcs2String)value; Assert.Equal(expected, typed.Value); Assert.True(value.TrySetValue(Encoding.GetEncoding("UCS-2").GetBytes(expected))); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs index f6ac8517d..79578f1ad 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs @@ -81,5 +81,5 @@ public class IccDataWriterCurvesTests Assert.Equal(expected, output); } - private static IccDataWriter CreateWriter() => new IccDataWriter(); + private static IccDataWriter CreateWriter() => new(); } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs index 8f696e99d..27db7e4e6 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs @@ -81,5 +81,5 @@ public class IccDataWriterLutTests Assert.Equal(expected, output); } - private static IccDataWriter CreateWriter() => new IccDataWriter(); + private static IccDataWriter CreateWriter() => new(); } diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs index 9c4abfe3e..27ce0ffa8 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs @@ -22,7 +22,7 @@ public class IccProfileTests public void CalculateHash_WithByteArray_DoesNotModifyData() { byte[] data = IccTestDataProfiles.ProfileRandomArray; - var copy = new byte[data.Length]; + byte[] copy = new byte[data.Length]; Buffer.BlockCopy(data, 0, copy, 0, data.Length); IccProfile.CalculateHash(data); @@ -34,7 +34,7 @@ public class IccProfileTests [MemberData(nameof(IccTestDataProfiles.ProfileValidityTestData), MemberType = typeof(IccTestDataProfiles))] public void CheckIsValid_WithProfiles_ReturnsValidity(byte[] data, bool expected) { - var profile = new IccProfile(data); + IccProfile profile = new(data); bool result = profile.CheckIsValid(); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs index 24671aa3c..71c58c25d 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs @@ -12,7 +12,7 @@ public class IccWriterTests [Fact] public void WriteProfile_NoEntries() { - var profile = new IccProfile + IccProfile profile = new() { Header = IccTestDataProfiles.HeaderRandomWrite }; diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs index 968fa86c4..5af672c21 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/ICC/Various/IccProfileIdTests.cs @@ -19,7 +19,7 @@ public class IccProfileIdTests [Fact] public void SetIsTrueWhenNonDefaultValue() { - var id = new IccProfileId(1, 2, 3, 4); + IccProfileId id = new(1, 2, 3, 4); Assert.True(id.IsSet); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs index 1a52ade62..2dbe5d343 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/IPTC/IptcProfileTests.cs @@ -14,7 +14,7 @@ public class IptcProfileTests { foreach (object tag in Enum.GetValues(typeof(IptcTag))) { - yield return new object[] { tag }; + yield return [tag]; } } @@ -22,10 +22,10 @@ public class IptcProfileTests public void IptcProfile_WithUtf8Data_WritesEnvelopeRecord_Works() { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); profile.SetValue(IptcTag.City, "ESPAÑA"); profile.UpdateData(); - byte[] expectedEnvelopeData = { 28, 1, 90, 0, 3, 27, 37, 71 }; + byte[] expectedEnvelopeData = [28, 1, 90, 0, 3, 27, 37, 71]; // act byte[] profileBytes = profile.Data; @@ -39,7 +39,7 @@ public class IptcProfileTests public void IptcProfile_SetValue_WithStrictEnabled_Works(IptcTag tag) { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); string value = new('s', tag.MaxLength() + 1); int expectedLength = tag.MaxLength(); @@ -56,7 +56,7 @@ public class IptcProfileTests public void IptcProfile_SetValue_WithStrictDisabled_Works(IptcTag tag) { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); string value = new('s', tag.MaxLength() + 1); int expectedLength = value.Length; @@ -77,8 +77,8 @@ public class IptcProfileTests public void IptcProfile_SetDateValue_Works(IptcTag tag) { // arrange - var profile = new IptcProfile(); - var datetime = new DateTimeOffset(new DateTime(1994, 3, 17)); + IptcProfile profile = new(); + DateTimeOffset datetime = new(new DateTime(1994, 3, 17)); // act profile.SetDateTimeValue(tag, datetime); @@ -96,8 +96,8 @@ public class IptcProfileTests public void IptcProfile_SetTimeValue_Works(IptcTag tag) { // arrange - var profile = new IptcProfile(); - var dateTimeUtc = new DateTime(1994, 3, 17, 14, 15, 16, DateTimeKind.Utc); + IptcProfile profile = new(); + DateTime dateTimeUtc = new(1994, 3, 17, 14, 15, 16, DateTimeKind.Utc); DateTimeOffset dateTimeOffset = new DateTimeOffset(dateTimeUtc).ToOffset(TimeSpan.FromHours(2)); // act @@ -116,7 +116,7 @@ public class IptcProfileTests using (Image image = provider.GetImage(JpegDecoder.Instance)) { Assert.NotNull(image.Metadata.IptcProfile); - var iptcValues = image.Metadata.IptcProfile.Values.ToList(); + List iptcValues = image.Metadata.IptcProfile.Values.ToList(); IptcProfileContainsExpectedValues(iptcValues); } } @@ -130,7 +130,7 @@ public class IptcProfileTests { IptcProfile iptc = image.Frames.RootFrame.Metadata.IptcProfile; Assert.NotNull(iptc); - var iptcValues = iptc.Values.ToList(); + List iptcValues = iptc.Values.ToList(); IptcProfileContainsExpectedValues(iptcValues); } } @@ -170,7 +170,7 @@ public class IptcProfileTests public void IptcProfile_ToAndFromByteArray_Works() { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); const string expectedCaptionWriter = "unittest"; const string expectedCaption = "test"; profile.SetValue(IptcTag.CaptionWriter, expectedCaptionWriter); @@ -179,10 +179,10 @@ public class IptcProfileTests // act profile.UpdateData(); byte[] profileBytes = profile.Data; - var profileFromBytes = new IptcProfile(profileBytes); + IptcProfile profileFromBytes = new(profileBytes); // assert - var iptcValues = profileFromBytes.Values.ToList(); + List iptcValues = profileFromBytes.Values.ToList(); ContainsIptcValue(iptcValues, IptcTag.CaptionWriter, expectedCaptionWriter); ContainsIptcValue(iptcValues, IptcTag.Caption, expectedCaption); } @@ -191,7 +191,7 @@ public class IptcProfileTests public void IptcProfile_CloneIsDeep() { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); const string captionWriter = "unittest"; const string caption = "test"; profile.SetValue(IptcTag.CaptionWriter, captionWriter); @@ -203,7 +203,7 @@ public class IptcProfileTests // assert Assert.Equal(2, clone.Values.Count()); - var cloneValues = clone.Values.ToList(); + List cloneValues = clone.Values.ToList(); ContainsIptcValue(cloneValues, IptcTag.CaptionWriter, captionWriter); ContainsIptcValue(cloneValues, IptcTag.Caption, "changed"); ContainsIptcValue(profile.Values.ToList(), IptcTag.Caption, caption); @@ -213,7 +213,7 @@ public class IptcProfileTests public void IptcValue_CloneIsDeep() { // arrange - var iptcValue = new IptcValue(IptcTag.Caption, System.Text.Encoding.UTF8, "test", true); + IptcValue iptcValue = new(IptcTag.Caption, System.Text.Encoding.UTF8, "test", true); // act IptcValue clone = iptcValue.DeepClone(); @@ -240,7 +240,7 @@ public class IptcProfileTests // assert IptcProfile actual = reloadedImage.Metadata.IptcProfile; Assert.NotNull(actual); - var iptcValues = actual.Values.ToList(); + List iptcValues = actual.Values.ToList(); ContainsIptcValue(iptcValues, IptcTag.CaptionWriter, expectedCaptionWriter); ContainsIptcValue(iptcValues, IptcTag.Caption, expectedCaption); } @@ -263,7 +263,7 @@ public class IptcProfileTests public void IptcProfile_AddRepeatable_Works(IptcTag tag) { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); const string expectedValue1 = "test"; const string expectedValue2 = "another one"; profile.SetValue(tag, expectedValue1, false); @@ -272,7 +272,7 @@ public class IptcProfileTests profile.SetValue(tag, expectedValue2, false); // assert - var values = profile.Values.ToList(); + List values = profile.Values.ToList(); Assert.Equal(2, values.Count); ContainsIptcValue(values, tag, expectedValue1); ContainsIptcValue(values, tag, expectedValue2); @@ -315,7 +315,7 @@ public class IptcProfileTests public void IptcProfile_AddNoneRepeatable_DoesOverrideOldValue(IptcTag tag) { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); const string expectedValue = "another one"; profile.SetValue(tag, "test", false); @@ -323,7 +323,7 @@ public class IptcProfileTests profile.SetValue(tag, expectedValue, false); // assert - var values = profile.Values.ToList(); + List values = profile.Values.ToList(); Assert.Equal(1, values.Count); ContainsIptcValue(values, tag, expectedValue); } @@ -332,7 +332,7 @@ public class IptcProfileTests public void IptcProfile_RemoveByTag_RemovesAllEntrys() { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); profile.SetValue(IptcTag.Byline, "test"); profile.SetValue(IptcTag.Byline, "test2"); @@ -348,7 +348,7 @@ public class IptcProfileTests public void IptcProfile_RemoveByTagAndValue_Works() { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); profile.SetValue(IptcTag.Byline, "test"); profile.SetValue(IptcTag.Byline, "test2"); @@ -364,7 +364,7 @@ public class IptcProfileTests public void IptcProfile_GetValue_RetrievesAllEntries() { // arrange - var profile = new IptcProfile(); + IptcProfile profile = new(); profile.SetValue(IptcTag.Byline, "test"); profile.SetValue(IptcTag.Byline, "test2"); profile.SetValue(IptcTag.Caption, "test"); @@ -385,7 +385,7 @@ public class IptcProfileTests private static Image WriteAndReadJpeg(Image image) { - using (var memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { image.SaveAsJpeg(memStream); image.Dispose(); diff --git a/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs b/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs index 5dc6ac6db..32d4bc7cd 100644 --- a/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs +++ b/tests/ImageSharp.Tests/Metadata/Profiles/XMP/XmpProfileTests.cs @@ -78,6 +78,34 @@ public class XmpProfileTests } } + [Fact] + public void XmpProfile_CtorFromXDocument_Works() + { + // arrange + XDocument document = CreateMinimalXDocument(); + + // act + XmpProfile profile = new(document); + + // assert + XmpProfileContainsExpectedValues(profile); + } + + [Fact] + public void XmpProfile_ToXDocument_ReturnsValidDocument() + { + // arrange + XmpProfile profile = CreateMinimalXmlProfile(); + + // act + XDocument document = profile.ToXDocument(); + + // assert + Assert.NotNull(document); + Assert.Equal("xmpmeta", document.Root.Name.LocalName); + Assert.Equal("adobe:ns:meta/", document.Root.Name.NamespaceName); + } + [Fact] public void XmpProfile_ToFromByteArray_ReturnsClone() { @@ -97,11 +125,11 @@ public class XmpProfileTests { // arrange XmpProfile profile = CreateMinimalXmlProfile(); - byte[] original = profile.ToByteArray(); + byte[] original = profile.Data; // act XmpProfile clone = profile.DeepClone(); - byte[] actual = clone.ToByteArray(); + byte[] actual = clone.Data; // assert Assert.False(ReferenceEquals(original, actual)); @@ -111,10 +139,10 @@ public class XmpProfileTests public void WritingGif_PreservesXmpProfile() { // arrange - using var image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - var encoder = new GifEncoder(); + GifEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -129,10 +157,10 @@ public class XmpProfileTests public void WritingJpeg_PreservesXmpProfile() { // arrange - using var image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - var encoder = new JpegEncoder(); + JpegEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -147,10 +175,10 @@ public class XmpProfileTests public async Task WritingJpeg_PreservesExtendedXmpProfile() { // arrange - var provider = TestImageProvider.File(TestImages.Jpeg.Baseline.ExtendedXmp); + TestImageProvider provider = TestImageProvider.File(TestImages.Jpeg.Baseline.ExtendedXmp); using Image image = await provider.GetImageAsync(JpegDecoder.Instance); XmpProfile original = image.Metadata.XmpProfile; - var encoder = new JpegEncoder(); + JpegEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -165,10 +193,10 @@ public class XmpProfileTests public void WritingPng_PreservesXmpProfile() { // arrange - using var image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - var encoder = new PngEncoder(); + PngEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -183,10 +211,10 @@ public class XmpProfileTests public void WritingTiff_PreservesXmpProfile() { // arrange - using var image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Frames.RootFrame.Metadata.XmpProfile = original; - var encoder = new TiffEncoder(); + TiffEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -201,10 +229,10 @@ public class XmpProfileTests public void WritingWebp_PreservesXmpProfile() { // arrange - using var image = new Image(1, 1); + using Image image = new(1, 1); XmpProfile original = CreateMinimalXmlProfile(); image.Metadata.XmpProfile = original; - var encoder = new WebpEncoder(); + WebpEncoder encoder = new(); // act using Image reloadedImage = WriteAndRead(image, encoder); @@ -218,7 +246,7 @@ public class XmpProfileTests private static void XmpProfileContainsExpectedValues(XmpProfile xmp) { Assert.NotNull(xmp); - XDocument document = xmp.GetDocument(); + XDocument document = xmp.ToXDocument(); Assert.NotNull(document); Assert.Equal("xmpmeta", document.Root.Name.LocalName); Assert.Equal("adobe:ns:meta/", document.Root.Name.NamespaceName); @@ -228,13 +256,15 @@ public class XmpProfileTests { string content = $" "; byte[] data = Encoding.UTF8.GetBytes(content); - var profile = new XmpProfile(data); + XmpProfile profile = new(data); return profile; } + private static XDocument CreateMinimalXDocument() => CreateMinimalXmlProfile().ToXDocument(); + private static Image WriteAndRead(Image image, IImageEncoder encoder) { - using (var memStream = new MemoryStream()) + using (MemoryStream memStream = new()) { image.Save(memStream, encoder); image.Dispose(); diff --git a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs index 04183571b..f194484c4 100644 --- a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs +++ b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs @@ -14,15 +14,15 @@ public class SignedRationalTests [Fact] public void AreEqual() { - var r1 = new SignedRational(3, 2); - var r2 = new SignedRational(3, 2); + SignedRational r1 = new(3, 2); + SignedRational r2 = new(3, 2); Assert.Equal(r1, r2); Assert.True(r1 == r2); - var r3 = new SignedRational(7.55); - var r4 = new SignedRational(755, 100); - var r5 = new SignedRational(151, 20); + SignedRational r3 = new(7.55); + SignedRational r4 = new(755, 100); + SignedRational r5 = new(151, 20); Assert.Equal(r3, r4); Assert.Equal(r4, r5); @@ -34,8 +34,8 @@ public class SignedRationalTests [Fact] public void AreNotEqual() { - var first = new SignedRational(0, 100); - var second = new SignedRational(100, 100); + SignedRational first = new(0, 100); + SignedRational second = new(100, 100); Assert.NotEqual(first, second); Assert.True(first != second); @@ -47,7 +47,7 @@ public class SignedRationalTests [Fact] public void ConstructorAssignsProperties() { - var rational = new SignedRational(7, -55); + SignedRational rational = new(7, -55); Assert.Equal(7, rational.Numerator); Assert.Equal(-55, rational.Denominator); @@ -75,15 +75,15 @@ public class SignedRationalTests [Fact] public void Fraction() { - var first = new SignedRational(1.0 / 1600); - var second = new SignedRational(1.0 / 1600, true); + SignedRational first = new(1.0 / 1600); + SignedRational second = new(1.0 / 1600, true); Assert.False(first.Equals(second)); } [Fact] public void ToDouble() { - var rational = new SignedRational(0, 0); + SignedRational rational = new(0, 0); Assert.Equal(double.NaN, rational.ToDouble()); rational = new SignedRational(2, 0); @@ -96,7 +96,7 @@ public class SignedRationalTests [Fact] public void ToStringRepresentation() { - var rational = new SignedRational(0, 0); + SignedRational rational = new(0, 0); Assert.Equal("[ Indeterminate ]", rational.ToString()); rational = new SignedRational(double.PositiveInfinity); diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs index d375a74c6..2c97cbde0 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffFunctionsTestsTPixel.cs @@ -15,7 +15,7 @@ public class PorterDuffFunctionsTestsTPixel return new Span(new[] { value }); } - public static TheoryData NormalBlendFunctionData = new TheoryData + public static TheoryData NormalBlendFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(1, 1, 1, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(0.6f, 0.6f, 0.6f, 1) } @@ -46,12 +46,12 @@ public class PorterDuffFunctionsTestsTPixel public void NormalBlendFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.NormalSrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData MultiplyFunctionData = new TheoryData + public static TheoryData MultiplyFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(1, 1, 1, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(0.6f, 0.6f, 0.6f, 1) }, @@ -86,12 +86,12 @@ public class PorterDuffFunctionsTestsTPixel public void MultiplyFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.MultiplySrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData AddFunctionData = new TheoryData + public static TheoryData AddFunctionData = new() { { new TestPixel(1, 1, 1, 1), @@ -136,12 +136,12 @@ public class PorterDuffFunctionsTestsTPixel public void AddFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.AddSrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData SubtractFunctionData = new TheoryData + public static TheoryData SubtractFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(0, 0, 0, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(1, 1, 1, 1f) }, @@ -176,12 +176,12 @@ public class PorterDuffFunctionsTestsTPixel public void SubtractFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.SubtractSrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData ScreenFunctionData = new TheoryData + public static TheoryData ScreenFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(1, 1, 1, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(1, 1, 1, 1f) }, @@ -216,12 +216,12 @@ public class PorterDuffFunctionsTestsTPixel public void ScreenFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.ScreenSrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData DarkenFunctionData = new TheoryData + public static TheoryData DarkenFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(1, 1, 1, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(.6f, .6f, .6f, 1f) }, @@ -256,12 +256,12 @@ public class PorterDuffFunctionsTestsTPixel public void DarkenFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.DarkenSrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData LightenFunctionData = new TheoryData + public static TheoryData LightenFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(1, 1, 1, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(1, 1, 1, 1f) }, @@ -296,12 +296,12 @@ public class PorterDuffFunctionsTestsTPixel public void LightenFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.LightenSrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData OverlayFunctionData = new TheoryData + public static TheoryData OverlayFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(1, 1, 1, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(1, 1, 1, 1f) }, @@ -336,12 +336,12 @@ public class PorterDuffFunctionsTestsTPixel public void OverlayFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.OverlaySrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } - public static TheoryData HardLightFunctionData = new TheoryData + public static TheoryData HardLightFunctionData = new() { { new TestPixel(1, 1, 1, 1), new TestPixel(1, 1, 1, 1), 1, new TestPixel(1, 1, 1, 1) }, { new TestPixel(1, 1, 1, 1), new TestPixel(0, 0, 0, .8f), .5f, new TestPixel(0.6f, 0.6f, 0.6f, 1f) }, @@ -376,7 +376,7 @@ public class PorterDuffFunctionsTestsTPixel public void HardLightFunctionBlenderBulk(TestPixel back, TestPixel source, float amount, TestPixel expected) where TPixel : unmanaged, IPixel { - var dest = new Span(new TPixel[1]); + Span dest = new(new TPixel[1]); new DefaultPixelBlenders.HardLightSrcOver().Blend(this.Configuration, dest, back.AsSpan(), source.AsSpan(), AsSpan(amount)); VectorAssert.Equal(expected.AsPixel(), dest[0], 2); } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/Generated/_Common.ttinclude b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/Generated/_Common.ttinclude index 90cb3a866..ccf90fe40 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/Generated/_Common.ttinclude +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/Generated/_Common.ttinclude @@ -13,8 +13,8 @@ using Xunit; using Xunit.Abstractions; <#+ private static readonly string[] UnassociatedAlphaPixelTypes = - { - "A8", + [ + "A8", "Argb32", "Abgr32", "Bgra32", @@ -31,13 +31,13 @@ using Xunit.Abstractions; "Rgba64", "RgbaVector", "Short4" - }; + ]; - private static readonly string[] AssociatedAlphaPixelTypes = Array.Empty(); + private static readonly string[] AssociatedAlphaPixelTypes = []; private static readonly string[] CommonPixelTypes = - { - "A8", + [ + "A8", "Argb32", "Abgr32", "Bgr24", @@ -65,8 +65,8 @@ using Xunit.Abstractions; "Rgba64", "RgbaVector", "Short2", - "Short4", - }; + "Short4" + ]; void GenerateSpecializedClass(string pixelType, string alpha) {#> diff --git a/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs index 6d56185ec..3bb1fead1 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs @@ -21,10 +21,10 @@ public class Rgba32Tests { Rgba32 color1 = new(0, 0, 0); Rgba32 color2 = new(0, 0, 0, 1F); - Rgba32 color3 = Rgba32.ParseHex("#000"); - Rgba32 color4 = Rgba32.ParseHex("#000F"); - Rgba32 color5 = Rgba32.ParseHex("#000000"); - Rgba32 color6 = Rgba32.ParseHex("#000000FF"); + Rgba32 color3 = Color.ParseHex("#000").ToPixel(); + Rgba32 color4 = Color.ParseHex("#000F").ToPixel(); + Rgba32 color5 = Color.ParseHex("#000000").ToPixel(); + Rgba32 color6 = Color.ParseHex("#000000FF").ToPixel(); Assert.Equal(color1, color2); Assert.Equal(color1, color3); @@ -41,9 +41,9 @@ public class Rgba32Tests { Rgba32 color1 = new(255, 0, 0, 255); Rgba32 color2 = new(0, 0, 0, 255); - Rgba32 color3 = Rgba32.ParseHex("#000"); - Rgba32 color4 = Rgba32.ParseHex("#000000"); - Rgba32 color5 = Rgba32.ParseHex("#FF000000"); + Rgba32 color3 = Color.ParseHex("#000").ToPixel(); + Rgba32 color4 = Color.ParseHex("#000000").ToPixel(); + Rgba32 color5 = Color.ParseHex("#FF000000").ToPixel(); Assert.NotEqual(color1, color2); Assert.NotEqual(color1, color3); @@ -82,30 +82,6 @@ public class Rgba32Tests Assert.Equal(Math.Round(.5f * 255), color5.A); } - /// - /// Tests whether FromHex and ToHex work correctly. - /// - [Fact] - public void FromAndToHex() - { - // 8 digit hex matches css4 spec. RRGGBBAA - Rgba32 color = Rgba32.ParseHex("#AABBCCDD"); // 170, 187, 204, 221 - Assert.Equal(170, color.R); - Assert.Equal(187, color.G); - Assert.Equal(204, color.B); - Assert.Equal(221, color.A); - - Assert.Equal("AABBCCDD", color.ToHex()); - - color.R = 0; - - Assert.Equal("00BBCCDD", color.ToHex()); - - color.A = 255; - - Assert.Equal("00BBCCFF", color.ToHex()); - } - /// /// Tests that the individual byte elements are laid out in RGBA order. /// diff --git a/tests/ImageSharp.Tests/PixelFormats/UnPackedPixelTests.cs b/tests/ImageSharp.Tests/PixelFormats/UnPackedPixelTests.cs index 651f6fe7f..eb93ba230 100644 --- a/tests/ImageSharp.Tests/PixelFormats/UnPackedPixelTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/UnPackedPixelTests.cs @@ -60,7 +60,7 @@ public class UnPackedPixelTests [Fact] public void Color_Types_From_Hex_Produce_Equal_Scaled_Component_OutPut() { - Rgba32 color = Rgba32.ParseHex("183060C0"); + Rgba32 color = Color.ParseHex("183060C0").ToPixel(); RgbaVector colorVector = RgbaVector.FromHex("183060C0"); Assert.Equal(color.R, (byte)(colorVector.R * 255)); diff --git a/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs index 9c0e83a7f..0ea429a77 100644 --- a/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs +++ b/tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs @@ -49,7 +49,7 @@ public class ColorMatrixTests ColorMatrix value1 = CreateAllTwos(); ColorMatrix value2 = CreateAllThrees(); - var m = default(ColorMatrix); + ColorMatrix m = default(ColorMatrix); // First row m.M11 = (value1.M11 * value2.M11) + (value1.M12 * value2.M21) + (value1.M13 * value2.M31) + (value1.M14 * value2.M41); diff --git a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs index ecc592326..f83ebc53c 100644 --- a/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs +++ b/tests/ImageSharp.Tests/Primitives/DenseMatrixTests.cs @@ -38,7 +38,7 @@ public class DenseMatrixTests [Fact] public void DenseMatrixReturnsCorrectDimensions() { - var dense = new DenseMatrix(FloydSteinbergMatrix); + DenseMatrix dense = new(FloydSteinbergMatrix); Assert.True(dense.Columns == FloydSteinbergMatrix.GetLength(1)); Assert.True(dense.Rows == FloydSteinbergMatrix.GetLength(0)); Assert.Equal(3, dense.Columns); @@ -63,7 +63,7 @@ public class DenseMatrixTests [Fact] public void DenseMatrixGetSetReturnsCorrectResults() { - var dense = new DenseMatrix(4, 4); + DenseMatrix dense = new(4, 4); const int Val = 5; dense[3, 3] = Val; @@ -74,7 +74,7 @@ public class DenseMatrixTests [Fact] public void DenseMatrixCanFillAndClear() { - var dense = new DenseMatrix(9); + DenseMatrix dense = new(9); dense.Fill(4); for (int i = 0; i < dense.Data.Length; i++) @@ -100,7 +100,7 @@ public class DenseMatrixTests [Fact] public void DenseMatrixCanTranspose() { - var dense = new DenseMatrix(3, 1); + DenseMatrix dense = new(3, 1); dense[0, 0] = 1; dense[0, 1] = 2; dense[0, 2] = 3; @@ -117,9 +117,9 @@ public class DenseMatrixTests [Fact] public void DenseMatrixEquality() { - var dense = new DenseMatrix(3, 1); - var dense2 = new DenseMatrix(3, 1); - var dense3 = new DenseMatrix(1, 3); + DenseMatrix dense = new(3, 1); + DenseMatrix dense2 = new(3, 1); + DenseMatrix dense3 = new(1, 3); Assert.True(dense == dense2); Assert.False(dense != dense2); diff --git a/tests/ImageSharp.Tests/Primitives/PointFTests.cs b/tests/ImageSharp.Tests/Primitives/PointFTests.cs index c3d9e8176..8b574daf0 100644 --- a/tests/ImageSharp.Tests/Primitives/PointFTests.cs +++ b/tests/ImageSharp.Tests/Primitives/PointFTests.cs @@ -9,13 +9,12 @@ namespace SixLabors.ImageSharp.Tests; public class PointFTests { - private static readonly ApproximateFloatComparer ApproximateFloatComparer = - new ApproximateFloatComparer(1e-6f); + private static readonly ApproximateFloatComparer ApproximateFloatComparer = new(1e-6f); [Fact] public void CanReinterpretCastFromVector2() { - var vector = new Vector2(1, 2); + Vector2 vector = new(1, 2); PointF point = Unsafe.As(ref vector); @@ -37,7 +36,7 @@ public class PointFTests [InlineData(0.0, 0.0)] public void NonDefaultConstructorTest(float x, float y) { - var p1 = new PointF(x, y); + PointF p1 = new(x, y); Assert.Equal(x, p1.X); Assert.Equal(y, p1.Y); @@ -67,7 +66,7 @@ public class PointFTests [InlineData(0, 0)] public void CoordinatesTest(float x, float y) { - var p = new PointF(x, y); + PointF p = new(x, y); Assert.Equal(x, p.X); Assert.Equal(y, p.Y); @@ -84,11 +83,11 @@ public class PointFTests [InlineData(0, 0, 0, 0)] public void ArithmeticTestWithSize(float x, float y, int x1, int y1) { - var p = new PointF(x, y); - var s = new Size(x1, y1); + PointF p = new(x, y); + Size s = new(x1, y1); - var addExpected = new PointF(x + x1, y + y1); - var subExpected = new PointF(x - x1, y - y1); + PointF addExpected = new(x + x1, y + y1); + PointF subExpected = new(x - x1, y - y1); Assert.Equal(addExpected, p + s); Assert.Equal(subExpected, p - s); Assert.Equal(addExpected, PointF.Add(p, s)); @@ -101,11 +100,11 @@ public class PointFTests [InlineData(0, 0)] public void ArithmeticTestWithSizeF(float x, float y) { - var p = new PointF(x, y); - var s = new SizeF(y, x); + PointF p = new(x, y); + SizeF s = new(y, x); - var addExpected = new PointF(x + y, y + x); - var subExpected = new PointF(x - y, y - x); + PointF addExpected = new(x + y, y + x); + PointF subExpected = new(x - y, y - x); Assert.Equal(addExpected, p + s); Assert.Equal(subExpected, p - s); Assert.Equal(addExpected, PointF.Add(p, s)); @@ -115,10 +114,10 @@ public class PointFTests [Fact] public void RotateTest() { - var p = new PointF(13, 17); + PointF p = new(13, 17); Matrix3x2 matrix = Matrix3x2Extensions.CreateRotationDegrees(45, PointF.Empty); - var pout = PointF.Transform(p, matrix); + PointF pout = PointF.Transform(p, matrix); Assert.Equal(-2.82842732F, pout.X, ApproximateFloatComparer); Assert.Equal(21.2132034F, pout.Y, ApproximateFloatComparer); @@ -127,10 +126,10 @@ public class PointFTests [Fact] public void SkewTest() { - var p = new PointF(13, 17); + PointF p = new(13, 17); Matrix3x2 matrix = Matrix3x2Extensions.CreateSkewDegrees(45, 45, PointF.Empty); - var pout = PointF.Transform(p, matrix); + PointF pout = PointF.Transform(p, matrix); Assert.Equal(new PointF(30, 30), pout); } @@ -142,8 +141,8 @@ public class PointFTests [InlineData(0, 0)] public void EqualityTest(float x, float y) { - var pLeft = new PointF(x, y); - var pRight = new PointF(y, x); + PointF pLeft = new(x, y); + PointF pRight = new(y, x); if (x == y) { @@ -164,7 +163,7 @@ public class PointFTests [Fact] public void EqualityTest_NotPointF() { - var point = new PointF(0, 0); + PointF point = new(0, 0); Assert.False(point.Equals(null)); Assert.False(point.Equals(0)); @@ -180,7 +179,7 @@ public class PointFTests [Fact] public void GetHashCodeTest() { - var point = new PointF(10, 10); + PointF point = new(10, 10); Assert.Equal(point.GetHashCode(), new PointF(10, 10).GetHashCode()); Assert.NotEqual(point.GetHashCode(), new PointF(20, 10).GetHashCode()); Assert.NotEqual(point.GetHashCode(), new PointF(10, 20).GetHashCode()); @@ -189,7 +188,7 @@ public class PointFTests [Fact] public void ToStringTest() { - var p = new PointF(5.1F, -5.123F); + PointF p = new(5.1F, -5.123F); Assert.Equal(string.Format(CultureInfo.CurrentCulture, "PointF [ X={0}, Y={1} ]", p.X, p.Y), p.ToString()); } @@ -200,7 +199,7 @@ public class PointFTests [InlineData(0, 0)] public void DeconstructTest(float x, float y) { - PointF p = new PointF(x, y); + PointF p = new(x, y); (float deconstructedX, float deconstructedY) = p; diff --git a/tests/ImageSharp.Tests/Primitives/PointTests.cs b/tests/ImageSharp.Tests/Primitives/PointTests.cs index f5c64abf5..3ad2a83b3 100644 --- a/tests/ImageSharp.Tests/Primitives/PointTests.cs +++ b/tests/ImageSharp.Tests/Primitives/PointTests.cs @@ -21,8 +21,8 @@ public class PointTests [InlineData(0, 0)] public void NonDefaultConstructorTest(int x, int y) { - var p1 = new Point(x, y); - var p2 = new Point(new Size(x, y)); + Point p1 = new(x, y); + Point p2 = new(new Size(x, y)); Assert.Equal(p1, p2); } @@ -33,8 +33,8 @@ public class PointTests [InlineData(0)] public void SingleIntConstructorTest(int x) { - var p1 = new Point(x); - var p2 = new Point(unchecked((short)(x & 0xFFFF)), unchecked((short)((x >> 16) & 0xFFFF))); + Point p1 = new(x); + Point p2 = new(unchecked((short)(x & 0xFFFF)), unchecked((short)((x >> 16) & 0xFFFF))); Assert.Equal(p1, p2); } @@ -63,7 +63,7 @@ public class PointTests [InlineData(0, 0)] public void CoordinatesTest(int x, int y) { - var p = new Point(x, y); + Point p = new(x, y); Assert.Equal(x, p.X); Assert.Equal(y, p.Y); } @@ -86,7 +86,7 @@ public class PointTests [InlineData(0, 0)] public void SizeConversionTest(int x, int y) { - var sz = (Size)new Point(x, y); + Size sz = (Size)new Point(x, y); Assert.Equal(new Size(x, y), sz); } @@ -97,8 +97,8 @@ public class PointTests [InlineData(0, 0)] public void ArithmeticTest(int x, int y) { - Point addExpected, subExpected, p = new Point(x, y); - var s = new Size(y, x); + Point addExpected, subExpected, p = new(x, y); + Size s = new(y, x); unchecked { @@ -119,7 +119,7 @@ public class PointTests [InlineData(0, 0)] public void PointFMathematicalTest(float x, float y) { - var pf = new PointF(x, y); + PointF pf = new(x, y); Point pCeiling, pTruncate, pRound; unchecked @@ -141,8 +141,8 @@ public class PointTests [InlineData(0, 0)] public void OffsetTest(int x, int y) { - var p1 = new Point(x, y); - var p2 = new Point(y, x); + Point p1 = new(x, y); + Point p2 = new(y, x); p1.Offset(p2); @@ -156,10 +156,10 @@ public class PointTests [Fact] public void RotateTest() { - var p = new Point(13, 17); + Point p = new(13, 17); Matrix3x2 matrix = Matrix3x2Extensions.CreateRotationDegrees(45, Point.Empty); - var pout = Point.Transform(p, matrix); + Point pout = Point.Transform(p, matrix); Assert.Equal(new Point(-3, 21), pout); } @@ -167,10 +167,10 @@ public class PointTests [Fact] public void SkewTest() { - var p = new Point(13, 17); + Point p = new(13, 17); Matrix3x2 matrix = Matrix3x2Extensions.CreateSkewDegrees(45, 45, Point.Empty); - var pout = Point.Transform(p, matrix); + Point pout = Point.Transform(p, matrix); Assert.Equal(new Point(30, 30), pout); } @@ -181,9 +181,9 @@ public class PointTests [InlineData(0, 0)] public void EqualityTest(int x, int y) { - var p1 = new Point(x, y); - var p2 = new Point((x / 2) - 1, (y / 2) - 1); - var p3 = new Point(x, y); + Point p1 = new(x, y); + Point p2 = new((x / 2) - 1, (y / 2) - 1); + Point p3 = new(x, y); Assert.True(p1 == p3); Assert.True(p1 != p2); @@ -203,7 +203,7 @@ public class PointTests [Fact] public void EqualityTest_NotPoint() { - var point = new Point(0, 0); + Point point = new(0, 0); Assert.False(point.Equals(null)); Assert.False(point.Equals(0)); Assert.False(point.Equals(new PointF(0, 0))); @@ -212,7 +212,7 @@ public class PointTests [Fact] public void GetHashCodeTest() { - var point = new Point(10, 10); + Point point = new(10, 10); Assert.Equal(point.GetHashCode(), new Point(10, 10).GetHashCode()); Assert.NotEqual(point.GetHashCode(), new Point(20, 10).GetHashCode()); Assert.NotEqual(point.GetHashCode(), new Point(10, 20).GetHashCode()); @@ -223,7 +223,7 @@ public class PointTests [InlineData(1, -2, 3, -4)] public void ConversionTest(int x, int y, int width, int height) { - var rect = new Rectangle(x, y, width, height); + Rectangle rect = new(x, y, width, height); RectangleF rectF = rect; Assert.Equal(x, rectF.X); Assert.Equal(y, rectF.Y); @@ -234,7 +234,7 @@ public class PointTests [Fact] public void ToStringTest() { - var p = new Point(5, -5); + Point p = new(5, -5); Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Point [ X={0}, Y={1} ]", p.X, p.Y), p.ToString()); } @@ -245,7 +245,7 @@ public class PointTests [InlineData(0, 0)] public void DeconstructTest(int x, int y) { - Point p = new Point(x, y); + Point p = new(x, y); (int deconstructedX, int deconstructedY) = p; diff --git a/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs b/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs index a9b3251ca..4122daaa5 100644 --- a/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs +++ b/tests/ImageSharp.Tests/Primitives/RectangleFTests.cs @@ -23,10 +23,10 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void NonDefaultConstructorTest(float x, float y, float width, float height) { - var rect1 = new RectangleF(x, y, width, height); - var p = new PointF(x, y); - var s = new SizeF(width, height); - var rect2 = new RectangleF(p, s); + RectangleF rect1 = new(x, y, width, height); + PointF p = new(x, y); + SizeF s = new(width, height); + RectangleF rect2 = new(p, s); Assert.Equal(rect1, rect2); } @@ -38,8 +38,8 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void FromLTRBTest(float left, float top, float right, float bottom) { - var expected = new RectangleF(left, top, right - left, bottom - top); - var actual = RectangleF.FromLTRB(left, top, right, bottom); + RectangleF expected = new(left, top, right - left, bottom - top); + RectangleF actual = RectangleF.FromLTRB(left, top, right, bottom); Assert.Equal(expected, actual); } @@ -51,9 +51,9 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void DimensionsTest(float x, float y, float width, float height) { - var rect = new RectangleF(x, y, width, height); - var p = new PointF(x, y); - var s = new SizeF(width, height); + RectangleF rect = new(x, y, width, height); + PointF p = new(x, y); + SizeF s = new(width, height); Assert.Equal(p, rect.Location); Assert.Equal(s, rect.Size); @@ -84,8 +84,8 @@ public class RectangleFTests [InlineData(float.MaxValue, float.MinValue)] public void LocationSetTest(float x, float y) { - var point = new PointF(x, y); - var rect = new RectangleF(10, 10, 10, 10) { Location = point }; + PointF point = new(x, y); + RectangleF rect = new(10, 10, 10, 10) { Location = point }; Assert.Equal(point, rect.Location); Assert.Equal(point.X, rect.X); Assert.Equal(point.Y, rect.Y); @@ -96,8 +96,8 @@ public class RectangleFTests [InlineData(float.MaxValue, float.MinValue)] public void SizeSetTest(float x, float y) { - var size = new SizeF(x, y); - var rect = new RectangleF(10, 10, 10, 10) { Size = size }; + SizeF size = new(x, y); + RectangleF rect = new(10, 10, 10, 10) { Size = size }; Assert.Equal(size, rect.Size); Assert.Equal(size.Width, rect.Width); Assert.Equal(size.Height, rect.Height); @@ -109,8 +109,8 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void EqualityTest(float x, float y, float width, float height) { - var rect1 = new RectangleF(x, y, width, height); - var rect2 = new RectangleF(width, height, x, y); + RectangleF rect1 = new(x, y, width, height); + RectangleF rect2 = new(width, height, x, y); Assert.True(rect1 != rect2); Assert.False(rect1 == rect2); @@ -121,7 +121,7 @@ public class RectangleFTests [Fact] public void EqualityTestNotRectangleF() { - var rectangle = new RectangleF(0, 0, 0, 0); + RectangleF rectangle = new(0, 0, 0, 0); Assert.False(rectangle.Equals(null)); Assert.False(rectangle.Equals(0)); @@ -137,8 +137,8 @@ public class RectangleFTests [Fact] public void GetHashCodeTest() { - var rect1 = new RectangleF(10, 10, 10, 10); - var rect2 = new RectangleF(10, 10, 10, 10); + RectangleF rect1 = new(10, 10, 10, 10); + RectangleF rect2 = new(10, 10, 10, 10); Assert.Equal(rect1.GetHashCode(), rect2.GetHashCode()); Assert.NotEqual(rect1.GetHashCode(), new RectangleF(20, 10, 10, 10).GetHashCode()); Assert.NotEqual(rect1.GetHashCode(), new RectangleF(10, 20, 10, 10).GetHashCode()); @@ -151,11 +151,11 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void ContainsTest(float x, float y, float width, float height) { - var rect = new RectangleF(x, y, width, height); + RectangleF rect = new(x, y, width, height); float x1 = (x + width) / 2; float y1 = (y + height) / 2; - var p = new PointF(x1, y1); - var r = new RectangleF(x1, y1, width / 2, height / 2); + PointF p = new(x1, y1); + RectangleF r = new(x1, y1, width / 2, height / 2); Assert.False(rect.Contains(x1, y1)); Assert.False(rect.Contains(p)); @@ -168,13 +168,13 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void InflateTest(float x, float y, float width, float height) { - var rect = new RectangleF(x, y, width, height); - var inflatedRect = new RectangleF(x - width, y - height, width + (2 * width), height + (2 * height)); + RectangleF rect = new(x, y, width, height); + RectangleF inflatedRect = new(x - width, y - height, width + (2 * width), height + (2 * height)); rect.Inflate(width, height); Assert.Equal(inflatedRect, rect); - var s = new SizeF(x, y); + SizeF s = new(x, y); inflatedRect = RectangleF.Inflate(rect, x, y); rect.Inflate(s); @@ -186,9 +186,9 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void IntersectTest(float x, float y, float width, float height) { - var rect1 = new RectangleF(x, y, width, height); - var rect2 = new RectangleF(y, x, width, height); - var expectedRect = RectangleF.Intersect(rect1, rect2); + RectangleF rect1 = new(x, y, width, height); + RectangleF rect2 = new(y, x, width, height); + RectangleF expectedRect = RectangleF.Intersect(rect1, rect2); rect1.Intersect(rect2); Assert.Equal(expectedRect, rect1); Assert.False(rect1.IntersectsWith(expectedRect)); @@ -197,9 +197,9 @@ public class RectangleFTests [Fact] public void IntersectIntersectingRectsTest() { - var rect1 = new RectangleF(0, 0, 5, 5); - var rect2 = new RectangleF(1, 1, 3, 3); - var expected = new RectangleF(1, 1, 3, 3); + RectangleF rect1 = new(0, 0, 5, 5); + RectangleF rect2 = new(1, 1, 3, 3); + RectangleF expected = new(1, 1, 3, 3); Assert.Equal(expected, RectangleF.Intersect(rect1, rect2)); } @@ -211,15 +211,15 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void UnionTest(float x, float y, float width, float height) { - var a = new RectangleF(x, y, width, height); - var b = new RectangleF(width, height, x, y); + RectangleF a = new(x, y, width, height); + RectangleF b = new(width, height, x, y); float x1 = Math.Min(a.X, b.X); float x2 = Math.Max(a.X + a.Width, b.X + b.Width); float y1 = Math.Min(a.Y, b.Y); float y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); - var expectedRectangle = new RectangleF(x1, y1, x2 - x1, y2 - y1); + RectangleF expectedRectangle = new(x1, y1, x2 - x1, y2 - y1); Assert.Equal(expectedRectangle, RectangleF.Union(a, b)); } @@ -231,9 +231,9 @@ public class RectangleFTests [InlineData(0, float.MinValue, float.MaxValue, 0)] public void OffsetTest(float x, float y, float width, float height) { - var r1 = new RectangleF(x, y, width, height); - var expectedRect = new RectangleF(x + width, y + height, width, height); - var p = new PointF(width, height); + RectangleF r1 = new(x, y, width, height); + RectangleF expectedRect = new(x + width, y + height, width, height); + PointF p = new(width, height); r1.Offset(p); Assert.Equal(expectedRect, r1); @@ -246,7 +246,7 @@ public class RectangleFTests [Fact] public void ToStringTest() { - var r = new RectangleF(5, 5.1F, 1.3F, 1); + RectangleF r = new(5, 5.1F, 1.3F, 1); Assert.Equal(string.Format(CultureInfo.CurrentCulture, "RectangleF [ X={0}, Y={1}, Width={2}, Height={3} ]", r.X, r.Y, r.Width, r.Height), r.ToString()); } @@ -270,7 +270,7 @@ public class RectangleFTests [InlineData(0, 0, 0, 0)] public void DeconstructTest(float x, float y, float width, float height) { - RectangleF r = new RectangleF(x, y, width, height); + RectangleF r = new(x, y, width, height); (float dx, float dy, float dw, float dh) = r; diff --git a/tests/ImageSharp.Tests/Primitives/RectangleTests.cs b/tests/ImageSharp.Tests/Primitives/RectangleTests.cs index 2ba3a7731..2800852af 100644 --- a/tests/ImageSharp.Tests/Primitives/RectangleTests.cs +++ b/tests/ImageSharp.Tests/Primitives/RectangleTests.cs @@ -23,8 +23,8 @@ public class RectangleTests [InlineData(0, int.MinValue, 0, int.MaxValue)] public void NonDefaultConstructorTest(int x, int y, int width, int height) { - var rect1 = new Rectangle(x, y, width, height); - var rect2 = new Rectangle(new Point(x, y), new Size(width, height)); + Rectangle rect1 = new(x, y, width, height); + Rectangle rect2 = new(new Point(x, y), new Size(width, height)); Assert.Equal(rect1, rect2); } @@ -36,8 +36,8 @@ public class RectangleTests [InlineData(0, int.MinValue, 0, int.MaxValue)] public void FromLTRBTest(int left, int top, int right, int bottom) { - var rect1 = new Rectangle(left, top, unchecked(right - left), unchecked(bottom - top)); - var rect2 = Rectangle.FromLTRB(left, top, right, bottom); + Rectangle rect1 = new(left, top, unchecked(right - left), unchecked(bottom - top)); + Rectangle rect2 = Rectangle.FromLTRB(left, top, right, bottom); Assert.Equal(rect1, rect2); } @@ -68,7 +68,7 @@ public class RectangleTests [InlineData(int.MinValue, int.MaxValue, int.MinValue, int.MaxValue)] public void DimensionsTest(int x, int y, int width, int height) { - var rect = new Rectangle(x, y, width, height); + Rectangle rect = new(x, y, width, height); Assert.Equal(new Point(x, y), rect.Location); Assert.Equal(new Size(width, height), rect.Size); @@ -81,8 +81,8 @@ public class RectangleTests Assert.Equal(unchecked(x + width), rect.Right); Assert.Equal(unchecked(y + height), rect.Bottom); - var p = new Point(width, height); - var s = new Size(x, y); + Point p = new(width, height); + Size s = new(x, y); rect.Location = p; rect.Size = s; @@ -104,8 +104,8 @@ public class RectangleTests [InlineData(int.MaxValue, int.MinValue)] public void LocationSetTest(int x, int y) { - var point = new Point(x, y); - var rect = new Rectangle(10, 10, 10, 10) { Location = point }; + Point point = new(x, y); + Rectangle rect = new(10, 10, 10, 10) { Location = point }; Assert.Equal(point, rect.Location); Assert.Equal(point.X, rect.X); Assert.Equal(point.Y, rect.Y); @@ -116,8 +116,8 @@ public class RectangleTests [InlineData(int.MaxValue, int.MinValue)] public void SizeSetTest(int x, int y) { - var size = new Size(x, y); - var rect = new Rectangle(10, 10, 10, 10) { Size = size }; + Size size = new(x, y); + Rectangle rect = new(10, 10, 10, 10) { Size = size }; Assert.Equal(size, rect.Size); Assert.Equal(size.Width, rect.Width); Assert.Equal(size.Height, rect.Height); @@ -130,8 +130,8 @@ public class RectangleTests [InlineData(int.MinValue, int.MaxValue, int.MinValue, int.MaxValue)] public void EqualityTest(int x, int y, int width, int height) { - var rect1 = new Rectangle(x, y, width, height); - var rect2 = new Rectangle(width / 2, height / 2, x, y); + Rectangle rect1 = new(x, y, width, height); + Rectangle rect2 = new(width / 2, height / 2, x, y); Assert.True(rect1 != rect2); Assert.False(rect1 == rect2); @@ -142,7 +142,7 @@ public class RectangleTests [Fact] public void EqualityTestNotRectangle() { - var rectangle = new Rectangle(0, 0, 0, 0); + Rectangle rectangle = new(0, 0, 0, 0); Assert.False(rectangle.Equals(null)); Assert.False(rectangle.Equals(0)); Assert.False(rectangle.Equals(new RectangleF(0, 0, 0, 0))); @@ -151,8 +151,8 @@ public class RectangleTests [Fact] public void GetHashCodeTest() { - var rect1 = new Rectangle(10, 10, 10, 10); - var rect2 = new Rectangle(10, 10, 10, 10); + Rectangle rect1 = new(10, 10, 10, 10); + Rectangle rect2 = new(10, 10, 10, 10); Assert.Equal(rect1.GetHashCode(), rect2.GetHashCode()); Assert.NotEqual(rect1.GetHashCode(), new Rectangle(20, 10, 10, 10).GetHashCode()); Assert.NotEqual(rect1.GetHashCode(), new Rectangle(10, 20, 10, 10).GetHashCode()); @@ -166,7 +166,7 @@ public class RectangleTests [InlineData(0, 0, 0, 0)] public void RectangleFConversionTest(float x, float y, float width, float height) { - var rect = new RectangleF(x, y, width, height); + RectangleF rect = new(x, y, width, height); Rectangle rCeiling, rTruncate, rRound; unchecked @@ -196,9 +196,9 @@ public class RectangleTests [InlineData(0, int.MinValue, int.MaxValue, 0)] public void ContainsTest(int x, int y, int width, int height) { - var rect = new Rectangle(unchecked((2 * x) - width), unchecked((2 * y) - height), width, height); - var p = new Point(x, y); - var r = new Rectangle(x, y, width / 2, height / 2); + Rectangle rect = new(unchecked((2 * x) - width), unchecked((2 * y) - height), width, height); + Point p = new(x, y); + Rectangle r = new(x, y, width / 2, height / 2); Assert.False(rect.Contains(x, y)); Assert.False(rect.Contains(p)); @@ -211,7 +211,7 @@ public class RectangleTests [InlineData(0, int.MinValue, int.MaxValue, 0)] public void InflateTest(int x, int y, int width, int height) { - Rectangle inflatedRect, rect = new Rectangle(x, y, width, height); + Rectangle inflatedRect, rect = new(x, y, width, height); unchecked { inflatedRect = new Rectangle(x - width, y - height, width + (2 * width), height + (2 * height)); @@ -222,7 +222,7 @@ public class RectangleTests rect.Inflate(width, height); Assert.Equal(inflatedRect, rect); - var s = new Size(x, y); + Size s = new(x, y); unchecked { inflatedRect = new Rectangle(rect.X - x, rect.Y - y, rect.Width + (2 * x), rect.Height + (2 * y)); @@ -238,8 +238,8 @@ public class RectangleTests [InlineData(0, int.MinValue, int.MaxValue, 0)] public void IntersectTest(int x, int y, int width, int height) { - var rect = new Rectangle(x, y, width, height); - var expectedRect = Rectangle.Intersect(rect, rect); + Rectangle rect = new(x, y, width, height); + Rectangle expectedRect = Rectangle.Intersect(rect, rect); rect.Intersect(rect); Assert.Equal(expectedRect, rect); Assert.False(rect.IntersectsWith(expectedRect)); @@ -248,9 +248,9 @@ public class RectangleTests [Fact] public void IntersectIntersectingRectsTest() { - var rect1 = new Rectangle(0, 0, 5, 5); - var rect2 = new Rectangle(1, 1, 3, 3); - var expected = new Rectangle(1, 1, 3, 3); + Rectangle rect1 = new(0, 0, 5, 5); + Rectangle rect2 = new(1, 1, 3, 3); + Rectangle expected = new(1, 1, 3, 3); Assert.Equal(expected, Rectangle.Intersect(rect1, rect2)); } @@ -262,15 +262,15 @@ public class RectangleTests [InlineData(0, int.MinValue, int.MaxValue, 0)] public void UnionTest(int x, int y, int width, int height) { - var a = new Rectangle(x, y, width, height); - var b = new Rectangle(width, height, x, y); + Rectangle a = new(x, y, width, height); + Rectangle b = new(width, height, x, y); int x1 = Math.Min(a.X, b.X); int x2 = Math.Max(a.X + a.Width, b.X + b.Width); int y1 = Math.Min(a.Y, b.Y); int y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); - var expectedRectangle = new Rectangle(x1, y1, x2 - x1, y2 - y1); + Rectangle expectedRectangle = new(x1, y1, x2 - x1, y2 - y1); Assert.Equal(expectedRectangle, Rectangle.Union(a, b)); } @@ -282,9 +282,9 @@ public class RectangleTests [InlineData(0, int.MinValue, int.MaxValue, 0)] public void OffsetTest(int x, int y, int width, int height) { - var r1 = new Rectangle(x, y, width, height); - var expectedRect = new Rectangle(x + width, y + height, width, height); - var p = new Point(width, height); + Rectangle r1 = new(x, y, width, height); + Rectangle expectedRect = new(x + width, y + height, width, height); + Point p = new(width, height); r1.Offset(p); Assert.Equal(expectedRect, r1); @@ -297,7 +297,7 @@ public class RectangleTests [Fact] public void ToStringTest() { - var r = new Rectangle(5, -5, 0, 1); + Rectangle r = new(5, -5, 0, 1); Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Rectangle [ X={0}, Y={1}, Width={2}, Height={3} ]", r.X, r.Y, r.Width, r.Height), r.ToString()); } @@ -321,7 +321,7 @@ public class RectangleTests [InlineData(0, 0, 0, 0)] public void DeconstructTest(int x, int y, int width, int height) { - var r = new Rectangle(x, y, width, height); + Rectangle r = new(x, y, width, height); (int dx, int dy, int dw, int dh) = r; diff --git a/tests/ImageSharp.Tests/Primitives/SizeFTests.cs b/tests/ImageSharp.Tests/Primitives/SizeFTests.cs index 1a36b4921..2893a7c71 100644 --- a/tests/ImageSharp.Tests/Primitives/SizeFTests.cs +++ b/tests/ImageSharp.Tests/Primitives/SizeFTests.cs @@ -20,9 +20,9 @@ public class SizeFTests [InlineData(0, 0)] public void NonDefaultConstructorAndDimensionsTest(float width, float height) { - var s1 = new SizeF(width, height); - var p1 = new PointF(width, height); - var s2 = new SizeF(s1); + SizeF s1 = new(width, height); + PointF p1 = new(width, height); + SizeF s2 = new(s1); Assert.Equal(s1, s2); Assert.Equal(s1, new SizeF(p1)); @@ -62,10 +62,10 @@ public class SizeFTests [InlineData(0, 0)] public void ArithmeticTest(float width, float height) { - var s1 = new SizeF(width, height); - var s2 = new SizeF(height, width); - var addExpected = new SizeF(width + height, width + height); - var subExpected = new SizeF(width - height, height - width); + SizeF s1 = new(width, height); + SizeF s2 = new(height, width); + SizeF addExpected = new(width + height, width + height); + SizeF subExpected = new(width - height, height - width); Assert.Equal(addExpected, s1 + s2); Assert.Equal(addExpected, SizeF.Add(s1, s2)); @@ -81,8 +81,8 @@ public class SizeFTests [InlineData(0, 0)] public void EqualityTest(float width, float height) { - var sLeft = new SizeF(width, height); - var sRight = new SizeF(height, width); + SizeF sLeft = new(width, height); + SizeF sRight = new(height, width); if (width == height) { @@ -103,7 +103,7 @@ public class SizeFTests [Fact] public void EqualityTest_NotSizeF() { - var size = new SizeF(0, 0); + SizeF size = new(0, 0); Assert.False(size.Equals(null)); Assert.False(size.Equals(0)); @@ -119,7 +119,7 @@ public class SizeFTests [Fact] public void GetHashCodeTest() { - var size = new SizeF(10, 10); + SizeF size = new(10, 10); Assert.Equal(size.GetHashCode(), new SizeF(10, 10).GetHashCode()); Assert.NotEqual(size.GetHashCode(), new SizeF(20, 10).GetHashCode()); Assert.NotEqual(size.GetHashCode(), new SizeF(10, 20).GetHashCode()); @@ -132,9 +132,9 @@ public class SizeFTests [InlineData(0, 0)] public void ConversionTest(float width, float height) { - var s1 = new SizeF(width, height); - var p1 = (PointF)s1; - var s2 = new Size(unchecked((int)width), unchecked((int)height)); + SizeF s1 = new(width, height); + PointF p1 = (PointF)s1; + Size s2 = new(unchecked((int)width), unchecked((int)height)); Assert.Equal(new PointF(width, height), p1); Assert.Equal(p1, (PointF)s1); @@ -144,7 +144,7 @@ public class SizeFTests [Fact] public void ToStringTest() { - var sz = new SizeF(10, 5); + SizeF sz = new(10, 5); Assert.Equal(string.Format(CultureInfo.CurrentCulture, "SizeF [ Width={0}, Height={1} ]", sz.Width, sz.Height), sz.ToString()); } @@ -172,7 +172,7 @@ public class SizeFTests [InlineData(float.MinValue, float.MinValue)] public void MultiplicationTest(float dimension, float multiplier) { - SizeF sz1 = new SizeF(dimension, dimension); + SizeF sz1 = new(dimension, dimension); SizeF mulExpected; mulExpected = new SizeF(dimension * multiplier, dimension * multiplier); @@ -185,7 +185,7 @@ public class SizeFTests [InlineData(1111.1111f, 2222.2222f, 3333.3333f)] public void MultiplicationTestWidthHeightMultiplier(float width, float height, float multiplier) { - SizeF sz1 = new SizeF(width, height); + SizeF sz1 = new(width, height); SizeF mulExpected; mulExpected = new SizeF(width * multiplier, height * multiplier); @@ -215,8 +215,8 @@ public class SizeFTests [InlineData(-1.0f, float.MaxValue)] public void DivideTestSizeFloat(float dimension, float divisor) { - SizeF size = new SizeF(dimension, dimension); - SizeF expected = new SizeF(dimension / divisor, dimension / divisor); + SizeF size = new(dimension, dimension); + SizeF expected = new(dimension / divisor, dimension / divisor); Assert.Equal(expected, size / divisor); } @@ -224,8 +224,8 @@ public class SizeFTests [InlineData(-111.111f, 222.222f, 333.333f)] public void DivideTestSizeFloatWidthHeightDivisor(float width, float height, float divisor) { - SizeF size = new SizeF(width, height); - SizeF expected = new SizeF(width / divisor, height / divisor); + SizeF size = new(width, height); + SizeF expected = new(width / divisor, height / divisor); Assert.Equal(expected, size / divisor); } @@ -236,7 +236,7 @@ public class SizeFTests [InlineData(0, 0)] public void DeconstructTest(float width, float height) { - SizeF s = new SizeF(width, height); + SizeF s = new(width, height); (float deconstructedWidth, float deconstructedHeight) = s; diff --git a/tests/ImageSharp.Tests/Primitives/SizeTests.cs b/tests/ImageSharp.Tests/Primitives/SizeTests.cs index eec1fb63b..63320796a 100644 --- a/tests/ImageSharp.Tests/Primitives/SizeTests.cs +++ b/tests/ImageSharp.Tests/Primitives/SizeTests.cs @@ -23,8 +23,8 @@ public class SizeTests [InlineData(0, 0)] public void NonDefaultConstructorTest(int width, int height) { - var s1 = new Size(width, height); - var s2 = new Size(new Point(width, height)); + Size s1 = new(width, height); + Size s2 = new(new Point(width, height)); Assert.Equal(s1, s2); @@ -59,7 +59,7 @@ public class SizeTests [InlineData(0, 0)] public void DimensionsTest(int width, int height) { - var p = new Size(width, height); + Size p = new(width, height); Assert.Equal(width, p.Width); Assert.Equal(height, p.Height); } @@ -82,7 +82,7 @@ public class SizeTests [InlineData(0, 0)] public void SizeConversionTest(int width, int height) { - var sz = (Point)new Size(width, height); + Point sz = (Point)new Size(width, height); Assert.Equal(new Point(width, height), sz); } @@ -93,8 +93,8 @@ public class SizeTests [InlineData(0, 0)] public void ArithmeticTest(int width, int height) { - var sz1 = new Size(width, height); - var sz2 = new Size(height, width); + Size sz1 = new(width, height); + Size sz2 = new(height, width); Size addExpected, subExpected; unchecked @@ -116,7 +116,7 @@ public class SizeTests [InlineData(0, 0)] public void PointFMathematicalTest(float width, float height) { - var szF = new SizeF(width, height); + SizeF szF = new(width, height); Size pCeiling, pTruncate, pRound; unchecked @@ -138,9 +138,9 @@ public class SizeTests [InlineData(0, 0)] public void EqualityTest(int width, int height) { - var p1 = new Size(width, height); - var p2 = new Size(unchecked(width - 1), unchecked(height - 1)); - var p3 = new Size(width, height); + Size p1 = new(width, height); + Size p2 = new(unchecked(width - 1), unchecked(height - 1)); + Size p3 = new(width, height); Assert.True(p1 == p3); Assert.True(p1 != p2); @@ -160,7 +160,7 @@ public class SizeTests [Fact] public void EqualityTest_NotSize() { - var size = new Size(0, 0); + Size size = new(0, 0); Assert.False(size.Equals(null)); Assert.False(size.Equals(0)); Assert.False(size.Equals(new SizeF(0, 0))); @@ -169,7 +169,7 @@ public class SizeTests [Fact] public void GetHashCodeTest() { - var size = new Size(10, 10); + Size size = new(10, 10); Assert.Equal(size.GetHashCode(), new Size(10, 10).GetHashCode()); Assert.NotEqual(size.GetHashCode(), new Size(20, 10).GetHashCode()); Assert.NotEqual(size.GetHashCode(), new Size(10, 20).GetHashCode()); @@ -178,7 +178,7 @@ public class SizeTests [Fact] public void ToStringTest() { - var sz = new Size(10, 5); + Size sz = new(10, 5); Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Size [ Width={0}, Height={1} ]", sz.Width, sz.Height), sz.ToString()); } @@ -206,7 +206,7 @@ public class SizeTests [InlineData(int.MinValue, int.MinValue)] public void MultiplicationTestSizeInt(int dimension, int multiplier) { - Size sz1 = new Size(dimension, dimension); + Size sz1 = new(dimension, dimension); Size mulExpected; unchecked @@ -222,7 +222,7 @@ public class SizeTests [InlineData(1000, 2000, 3000)] public void MultiplicationTestSizeIntWidthHeightMultiplier(int width, int height, int multiplier) { - Size sz1 = new Size(width, height); + Size sz1 = new(width, height); Size mulExpected; unchecked @@ -258,7 +258,7 @@ public class SizeTests [InlineData(int.MinValue, float.MinValue)] public void MultiplicationTestSizeFloat(int dimension, float multiplier) { - Size sz1 = new Size(dimension, dimension); + Size sz1 = new(dimension, dimension); SizeF mulExpected; mulExpected = new SizeF(dimension * multiplier, dimension * multiplier); @@ -271,7 +271,7 @@ public class SizeTests [InlineData(1000, 2000, 30.33f)] public void MultiplicationTestSizeFloatWidthHeightMultiplier(int width, int height, float multiplier) { - Size sz1 = new Size(width, height); + Size sz1 = new(width, height); SizeF mulExpected; mulExpected = new SizeF(width * multiplier, height * multiplier); @@ -283,10 +283,10 @@ public class SizeTests [Fact] public void DivideByZeroChecks() { - Size size = new Size(100, 100); + Size size = new(100, 100); Assert.Throws(() => size / 0); - SizeF expectedSizeF = new SizeF(float.PositiveInfinity, float.PositiveInfinity); + SizeF expectedSizeF = new(float.PositiveInfinity, float.PositiveInfinity); Assert.Equal(expectedSizeF, size / 0.0f); } @@ -305,7 +305,7 @@ public class SizeTests [InlineData(int.MaxValue, -1)] public void DivideTestSizeInt(int dimension, int divisor) { - Size size = new Size(dimension, dimension); + Size size = new(dimension, dimension); Size expected; expected = new Size(dimension / divisor, dimension / divisor); @@ -317,7 +317,7 @@ public class SizeTests [InlineData(1111, 2222, 3333)] public void DivideTestSizeIntWidthHeightDivisor(int width, int height, int divisor) { - Size size = new Size(width, height); + Size size = new(width, height); Size expected; expected = new Size(width / divisor, height / divisor); @@ -341,7 +341,7 @@ public class SizeTests [InlineData(int.MinValue, -1.0f)] public void DivideTestSizeFloat(int dimension, float divisor) { - SizeF size = new SizeF(dimension, dimension); + SizeF size = new(dimension, dimension); SizeF expected; expected = new SizeF(dimension / divisor, dimension / divisor); @@ -352,7 +352,7 @@ public class SizeTests [InlineData(1111, 2222, -333.33f)] public void DivideTestSizeFloatWidthHeightDivisor(int width, int height, float divisor) { - SizeF size = new SizeF(width, height); + SizeF size = new(width, height); SizeF expected; expected = new SizeF(width / divisor, height / divisor); @@ -366,7 +366,7 @@ public class SizeTests [InlineData(0, 0)] public void DeconstructTest(int width, int height) { - Size s = new Size(width, height); + Size s = new(width, height); (int deconstructedWidth, int deconstructedHeight) = s; diff --git a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs index c7eb95953..32b8bf276 100644 --- a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs +++ b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs @@ -10,14 +10,14 @@ public class OrderedDitherFactoryTests { #pragma warning disable SA1025 // Code should not contain multiple whitespace in a row - private static readonly DenseMatrix Expected2x2Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected2x2Matrix = new( new uint[2, 2] { { 0, 2 }, { 3, 1 } }); - private static readonly DenseMatrix Expected3x3Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected3x3Matrix = new( new uint[3, 3] { { 0, 5, 2 }, @@ -25,7 +25,7 @@ public class OrderedDitherFactoryTests { 3, 6, 1 } }); - private static readonly DenseMatrix Expected4x4Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected4x4Matrix = new( new uint[4, 4] { { 0, 8, 2, 10 }, @@ -34,7 +34,7 @@ public class OrderedDitherFactoryTests { 15, 7, 13, 5 } }); - private static readonly DenseMatrix Expected8x8Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected8x8Matrix = new( new uint[8, 8] { { 0, 32, 8, 40, 2, 34, 10, 42 }, diff --git a/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs index da2bc465f..2337e4567 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs @@ -13,7 +13,7 @@ public class BoxBlurTest : BaseImageOperationsExtensionTest public void BoxBlur_BoxBlurProcessorDefaultsSet() { this.operations.BoxBlur(); - var processor = this.Verify(); + BoxBlurProcessor processor = this.Verify(); Assert.Equal(7, processor.Radius); } @@ -22,7 +22,7 @@ public class BoxBlurTest : BaseImageOperationsExtensionTest public void BoxBlur_amount_BoxBlurProcessorDefaultsSet() { this.operations.BoxBlur(34); - var processor = this.Verify(); + BoxBlurProcessor processor = this.Verify(); Assert.Equal(34, processor.Radius); } @@ -31,7 +31,7 @@ public class BoxBlurTest : BaseImageOperationsExtensionTest public void BoxBlur_amount_rect_BoxBlurProcessorDefaultsSet() { this.operations.BoxBlur(5, this.rect); - var processor = this.Verify(this.rect); + BoxBlurProcessor processor = this.Verify(this.rect); Assert.Equal(5, processor.Radius); } diff --git a/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs index 476e5b0a9..eb1d3031a 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/KernelSamplingMapTest.cs @@ -11,87 +11,87 @@ public class KernelSamplingMapTest [Fact] public void KernalSamplingMap_Kernel5Image7x7RepeatBorder() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Repeat; + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = - { + [ 0, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 6, - 4, 5, 6, 6, 6, - }; + 4, 5, 6, 6, 6 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image7x7BounceBorder() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Bounce; + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = - { + [ 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 5, - 4, 5, 6, 5, 4, - }; + 4, 5, 6, 5, 4 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image7x7MirrorBorder() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Mirror; + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = - { + [ 1, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 6, - 4, 5, 6, 6, 5, - }; + 4, 5, 6, 6, 5 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image7x7WrapBorder() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Wrap; + Size kernelSize = new(5, 5); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = - { + [ 5, 6, 0, 1, 2, 6, 0, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 0, - 4, 5, 6, 0, 1, - }; + 4, 5, 6, 0, 1 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image9x9BounceBorder() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(1, 1, 9, 9); - var mode = BorderWrappingMode.Bounce; + Size kernelSize = new(5, 5); + Rectangle bounds = new(1, 1, 9, 9); + BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = - { + [ 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 1, 2, 3, 4, 5, @@ -100,19 +100,19 @@ public class KernelSamplingMapTest 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 8, - 7, 8, 9, 8, 7, - }; + 7, 8, 9, 8, 7 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image9x9MirrorBorder() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(1, 1, 9, 9); - var mode = BorderWrappingMode.Mirror; + Size kernelSize = new(5, 5); + Rectangle bounds = new(1, 1, 9, 9); + BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = - { + [ 2, 1, 1, 2, 3, 1, 1, 2, 3, 4, 1, 2, 3, 4, 5, @@ -121,19 +121,19 @@ public class KernelSamplingMapTest 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 9, - 7, 8, 9, 9, 8, - }; + 7, 8, 9, 9, 8 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image9x9WrapBorder() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(1, 1, 9, 9); - var mode = BorderWrappingMode.Wrap; + Size kernelSize = new(5, 5); + Rectangle bounds = new(1, 1, 9, 9); + BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = - { + [ 8, 9, 1, 2, 3, 9, 1, 2, 3, 4, 1, 2, 3, 4, 5, @@ -142,278 +142,278 @@ public class KernelSamplingMapTest 4, 5, 6, 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 1, - 7, 8, 9, 1, 2, - }; + 7, 8, 9, 1, 2 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image7x7RepeatBorderTile() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Repeat; + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = - { + [ 2, 2, 2, 3, 4, 2, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 8, - 6, 7, 8, 8, 8, - }; + 6, 7, 8, 8, 8 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image7x7BounceBorderTile() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Bounce; + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = - { + [ 4, 3, 2, 3, 4, 3, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 7, - 6, 7, 8, 7, 6, - }; + 6, 7, 8, 7, 6 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image7x7MirrorBorderTile() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Mirror; + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = - { + [ 3, 2, 2, 3, 4, 2, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 8, - 6, 7, 8, 8, 7, - }; + 6, 7, 8, 8, 7 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel5Image7x7WrapBorderTile() { - var kernelSize = new Size(5, 5); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Wrap; + Size kernelSize = new(5, 5); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = - { + [ 7, 8, 2, 3, 4, 8, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, 4, 5, 6, 7, 4, 5, 6, 7, 8, 5, 6, 7, 8, 2, - 6, 7, 8, 2, 3, - }; + 6, 7, 8, 2, 3 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7x7RepeatBorder() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Repeat; + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = - { + [ 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, - 5, 6, 6, - }; + 5, 6, 6 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7x7BounceBorder() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Bounce; + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = - { + [ 1, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, - 5, 6, 5, - }; + 5, 6, 5 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7x7MirrorBorder() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Mirror; + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = - { + [ 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, - 5, 6, 6, - }; + 5, 6, 6 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7x7WrapBorder() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(0, 0, 7, 7); - var mode = BorderWrappingMode.Wrap; + Size kernelSize = new(3, 3); + Rectangle bounds = new(0, 0, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = - { + [ 6, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, - 5, 6, 0, - }; + 5, 6, 0 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7x7RepeatBorderTile() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Repeat; + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Repeat; int[] expected = - { + [ 2, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, - 7, 8, 8, - }; + 7, 8, 8 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7BounceBorderTile() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Bounce; + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Bounce; int[] expected = - { + [ 3, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, - 7, 8, 7, - }; + 7, 8, 7 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7MirrorBorderTile() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Mirror; + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Mirror; int[] expected = - { + [ 2, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, - 7, 8, 8, - }; + 7, 8, 8 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7x7WrapBorderTile() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(2, 2, 7, 7); - var mode = BorderWrappingMode.Wrap; + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 7); + BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] expected = - { + [ 8, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, - 7, 8, 2, - }; + 7, 8, 2 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, expected, expected); } [Fact] public void KernalSamplingMap_Kernel3Image7x5WrapBorderTile() { - var kernelSize = new Size(3, 3); - var bounds = new Rectangle(2, 2, 7, 5); - var mode = BorderWrappingMode.Wrap; + Size kernelSize = new(3, 3); + Rectangle bounds = new(2, 2, 7, 5); + BorderWrappingMode mode = BorderWrappingMode.Wrap; int[] xExpected = - { + [ 8, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, - 7, 8, 2, - }; + 7, 8, 2 + ]; int[] yExpected = - { + [ 6, 2, 3, 2, 3, 4, 3, 4, 5, 4, 5, 6, - 5, 6, 2, - }; + 5, 6, 2 + ]; this.AssertOffsets(kernelSize, bounds, mode, mode, xExpected, yExpected); } private void AssertOffsets(Size kernelSize, Rectangle bounds, BorderWrappingMode xBorderMode, BorderWrappingMode yBorderMode, int[] xExpected, int[] yExpected) { // Arrange - var map = new KernelSamplingMap(Configuration.Default.MemoryAllocator); + KernelSamplingMap map = new(Configuration.Default.MemoryAllocator); // Act map.BuildSamplingOffsetMap(kernelSize.Height, kernelSize.Width, bounds, xBorderMode, yBorderMode); // Assert - var xOffsets = map.GetColumnOffsetSpan().ToArray(); + int[] xOffsets = map.GetColumnOffsetSpan().ToArray(); Assert.Equal(xExpected, xOffsets); - var yOffsets = map.GetRowOffsetSpan().ToArray(); + int[] yOffsets = map.GetRowOffsetSpan().ToArray(); Assert.Equal(yExpected, yOffsets); } } diff --git a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs index 800cb06ac..6c6fa6b2b 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs @@ -7,9 +7,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Convolution.Processors; public class LaplacianKernelFactoryTests { - private static readonly ApproximateFloatComparer ApproximateComparer = new ApproximateFloatComparer(0.0001F); + private static readonly ApproximateFloatComparer ApproximateComparer = new(0.0001F); - private static readonly DenseMatrix Expected3x3Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected3x3Matrix = new( new float[,] { { -1, -1, -1 }, @@ -17,7 +17,7 @@ public class LaplacianKernelFactoryTests { -1, -1, -1 } }); - private static readonly DenseMatrix Expected5x5Matrix = new DenseMatrix( + private static readonly DenseMatrix Expected5x5Matrix = new( new float[,] { { -1, -1, -1, -1, -1 }, diff --git a/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs b/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs index 1b3d1bd9a..43785da6e 100644 --- a/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs +++ b/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs @@ -20,11 +20,11 @@ public class DitherTest : BaseImageOperationsExtensionTest private readonly IDither orderedDither; private readonly IDither errorDiffuser; private readonly Color[] testPalette = - { + [ Color.Red, Color.Green, Color.Blue - }; + ]; public DitherTest() { diff --git a/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs b/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs index 6d5973dbb..b24ab6c81 100644 --- a/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs +++ b/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs @@ -13,7 +13,7 @@ public class OilPaintTest : BaseImageOperationsExtensionTest public void OilPaint_OilPaintingProcessorDefaultsSet() { this.operations.OilPaint(); - var processor = this.Verify(); + OilPaintingProcessor processor = this.Verify(); Assert.Equal(10, processor.Levels); Assert.Equal(15, processor.BrushSize); @@ -23,7 +23,7 @@ public class OilPaintTest : BaseImageOperationsExtensionTest public void OilPaint_rect_OilPaintingProcessorDefaultsSet() { this.operations.OilPaint(this.rect); - var processor = this.Verify(this.rect); + OilPaintingProcessor processor = this.Verify(this.rect); Assert.Equal(10, processor.Levels); Assert.Equal(15, processor.BrushSize); @@ -33,7 +33,7 @@ public class OilPaintTest : BaseImageOperationsExtensionTest public void OilPaint_Levels_Brush_OilPaintingProcessorDefaultsSet() { this.operations.OilPaint(34, 65); - var processor = this.Verify(); + OilPaintingProcessor processor = this.Verify(); Assert.Equal(34, processor.Levels); Assert.Equal(65, processor.BrushSize); @@ -43,7 +43,7 @@ public class OilPaintTest : BaseImageOperationsExtensionTest public void OilPaint_Levels_Brush_rect_OilPaintingProcessorDefaultsSet() { this.operations.OilPaint(54, 43, this.rect); - var processor = this.Verify(this.rect); + OilPaintingProcessor processor = this.Verify(this.rect); Assert.Equal(54, processor.Levels); Assert.Equal(43, processor.BrushSize); diff --git a/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs index 6531f7b44..f557183d6 100644 --- a/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs @@ -13,7 +13,7 @@ public class PixelateTest : BaseImageOperationsExtensionTest public void Pixelate_PixelateProcessorDefaultsSet() { this.operations.Pixelate(); - var processor = this.Verify(); + PixelateProcessor processor = this.Verify(); Assert.Equal(4, processor.Size); } @@ -22,7 +22,7 @@ public class PixelateTest : BaseImageOperationsExtensionTest public void Pixelate_Size_PixelateProcessorDefaultsSet() { this.operations.Pixelate(12); - var processor = this.Verify(); + PixelateProcessor processor = this.Verify(); Assert.Equal(12, processor.Size); } @@ -31,7 +31,7 @@ public class PixelateTest : BaseImageOperationsExtensionTest public void Pixelate_Size_rect_PixelateProcessorDefaultsSet() { this.operations.Pixelate(23, this.rect); - var processor = this.Verify(this.rect); + PixelateProcessor processor = this.Verify(this.rect); Assert.Equal(23, processor.Size); } diff --git a/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs b/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs index 17f63384e..f55500f99 100644 --- a/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs +++ b/tests/ImageSharp.Tests/Processing/FakeImageOperationsProvider.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Tests.Processing; internal class FakeImageOperationsProvider : IImageProcessingContextFactory { - private readonly List imageOperators = new List(); + private readonly List imageOperators = []; public bool HasCreated(Image source) where TPixel : unmanaged, IPixel @@ -35,7 +35,7 @@ internal class FakeImageOperationsProvider : IImageProcessingContextFactory public IInternalImageProcessingContext CreateImageProcessingContext(Configuration configuration, Image source, bool mutate) where TPixel : unmanaged, IPixel { - var op = new FakeImageOperations(configuration, source, mutate); + FakeImageOperations op = new(configuration, source, mutate); this.imageOperators.Add(op); return op; } @@ -51,7 +51,7 @@ internal class FakeImageOperationsProvider : IImageProcessingContextFactory public Image Source { get; } - public List Applied { get; } = new List(); + public List Applied { get; } = []; public Configuration Configuration { get; } diff --git a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs index 87436e4a3..135212400 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs @@ -31,7 +31,7 @@ public class BrightnessTest : BaseImageOperationsExtensionTest [Fact] public void Brightness_scaled_vector() { - var rgbImage = new Image(Configuration.Default, 100, 100, new Rgb24(0, 0, 0)); + Image rgbImage = new(Configuration.Default, 100, 100, new Rgb24(0, 0, 0)); rgbImage.Mutate(x => x.ApplyProcessor(new BrightnessProcessor(2))); @@ -43,7 +43,7 @@ public class BrightnessTest : BaseImageOperationsExtensionTest Assert.Equal(new Rgb24(20, 20, 20), rgbImage[0, 0]); - var halfSingleImage = new Image(Configuration.Default, 100, 100, new HalfSingle(-1)); + Image halfSingleImage = new(Configuration.Default, 100, 100, new HalfSingle(-1)); halfSingleImage.Mutate(x => x.ApplyProcessor(new BrightnessProcessor(2))); diff --git a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs index 7fb93bba5..f00087e1c 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs @@ -11,17 +11,17 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters; [Trait("Category", "Processors")] public class ColorBlindnessTest : BaseImageOperationsExtensionTest { - public static IEnumerable TheoryData = new[] - { - new object[] { new TestType(), ColorBlindnessMode.Achromatomaly }, - new object[] { new TestType(), ColorBlindnessMode.Achromatopsia }, - new object[] { new TestType(), ColorBlindnessMode.Deuteranomaly }, - new object[] { new TestType(), ColorBlindnessMode.Deuteranopia }, - new object[] { new TestType(), ColorBlindnessMode.Protanomaly }, - new object[] { new TestType(), ColorBlindnessMode.Protanopia }, - new object[] { new TestType(), ColorBlindnessMode.Tritanomaly }, - new object[] { new TestType(), ColorBlindnessMode.Tritanopia } - }; + public static IEnumerable TheoryData = + [ + [new TestType(), ColorBlindnessMode.Achromatomaly], + [new TestType(), ColorBlindnessMode.Achromatopsia], + [new TestType(), ColorBlindnessMode.Deuteranomaly], + [new TestType(), ColorBlindnessMode.Deuteranopia], + [new TestType(), ColorBlindnessMode.Protanomaly], + [new TestType(), ColorBlindnessMode.Protanopia], + [new TestType(), ColorBlindnessMode.Tritanomaly], + [new TestType(), ColorBlindnessMode.Tritanopia] + ]; [Theory] [MemberData(nameof(TheoryData))] diff --git a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs index 36edc10e5..6f0f06535 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs @@ -11,10 +11,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters; [Trait("Category", "Processors")] public class GrayscaleTest : BaseImageOperationsExtensionTest { - public static IEnumerable ModeTheoryData = new[] - { - new object[] { new TestType(), GrayscaleMode.Bt709 } - }; + public static IEnumerable ModeTheoryData = + [ + [new TestType(), GrayscaleMode.Bt709] + ]; [Theory] [MemberData(nameof(ModeTheoryData))] diff --git a/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs b/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs index 0c197a96f..33deb715b 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs @@ -13,7 +13,7 @@ public class HueTest : BaseImageOperationsExtensionTest public void Hue_amount_HueProcessorDefaultsSet() { this.operations.Hue(34f); - var processor = this.Verify(); + HueProcessor processor = this.Verify(); Assert.Equal(34f, processor.Degrees); } @@ -22,7 +22,7 @@ public class HueTest : BaseImageOperationsExtensionTest public void Hue_amount_rect_HueProcessorDefaultsSet() { this.operations.Hue(5f, this.rect); - var processor = this.Verify(this.rect); + HueProcessor processor = this.Verify(this.rect); Assert.Equal(5f, processor.Degrees); } diff --git a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs index e84bd243e..f68ecef08 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs @@ -13,7 +13,7 @@ public class LomographTest : BaseImageOperationsExtensionTest public void Lomograph_amount_LomographProcessorDefaultsSet() { this.operations.Lomograph(); - var processor = this.Verify(); + LomographProcessor processor = this.Verify(); Assert.Equal(processor.GraphicsOptions, this.options); } @@ -21,7 +21,7 @@ public class LomographTest : BaseImageOperationsExtensionTest public void Lomograph_amount_rect_LomographProcessorDefaultsSet() { this.operations.Lomograph(this.rect); - var processor = this.Verify(this.rect); + LomographProcessor processor = this.Verify(this.rect); Assert.Equal(processor.GraphicsOptions, this.options); } } diff --git a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs index 7d3e0aed0..89d8d47bc 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs @@ -13,7 +13,7 @@ public class PolaroidTest : BaseImageOperationsExtensionTest public void Polaroid_amount_PolaroidProcessorDefaultsSet() { this.operations.Polaroid(); - var processor = this.Verify(); + PolaroidProcessor processor = this.Verify(); Assert.Equal(processor.GraphicsOptions, this.options); } @@ -21,7 +21,7 @@ public class PolaroidTest : BaseImageOperationsExtensionTest public void Polaroid_amount_rect_PolaroidProcessorDefaultsSet() { this.operations.Polaroid(this.rect); - var processor = this.Verify(this.rect); + PolaroidProcessor processor = this.Verify(this.rect); Assert.Equal(processor.GraphicsOptions, this.options); } } diff --git a/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs b/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs index 744e26d8f..09fbcdc70 100644 --- a/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs +++ b/tests/ImageSharp.Tests/Processing/ImageOperationTests.cs @@ -24,7 +24,7 @@ public class ImageOperationTests : IDisposable { this.provider = new FakeImageOperationsProvider(); - var processorMock = new Mock(); + Mock processorMock = new(); this.processorDefinition = processorMock.Object; this.image = new Image( @@ -103,7 +103,7 @@ public class ImageOperationTests : IDisposable [Fact] public void ApplyProcessors_ListOfProcessors_AppliesAllProcessorsToOperation() { - var operations = new FakeImageOperationsProvider.FakeImageOperations(Configuration.Default, null, false); + FakeImageOperationsProvider.FakeImageOperations operations = new(Configuration.Default, null, false); operations.ApplyProcessors(this.processorDefinition); Assert.Contains(this.processorDefinition, operations.Applied.Select(x => x.NonGenericProcessor)); } @@ -152,7 +152,7 @@ public class ImageOperationTests : IDisposable { try { - var img = new Image(1, 1); + Image img = new(1, 1); img.Dispose(); img.EnsureNotDisposed(); } diff --git a/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs b/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs index 88707c60f..e39d8075b 100644 --- a/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs +++ b/tests/ImageSharp.Tests/Processing/ImageProcessingContextTests.cs @@ -23,7 +23,7 @@ public class ImageProcessingContextTests : IDisposable private readonly Mock> cloningProcessorImpl; - private static readonly Rectangle Bounds = new Rectangle(3, 3, 5, 5); + private static readonly Rectangle Bounds = new(3, 3, 5, 5); public ImageProcessingContextTests() { @@ -34,7 +34,7 @@ public class ImageProcessingContextTests : IDisposable } // bool throwException, bool useBounds - public static readonly TheoryData ProcessorTestData = new TheoryData() + public static readonly TheoryData ProcessorTestData = new() { { false, false }, { false, true }, diff --git a/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs b/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs index 60e33835a..c39648d01 100644 --- a/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs +++ b/tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs @@ -21,7 +21,7 @@ public class HistogramEqualizationTests { // Arrange byte[] pixels = - { + [ 52, 55, 61, 59, 70, 61, 76, 61, 62, 59, 55, 104, 94, 85, 59, 71, 63, 65, 66, 113, 144, 104, 63, 72, @@ -30,9 +30,9 @@ public class HistogramEqualizationTests 68, 79, 60, 79, 77, 66, 58, 75, 69, 85, 64, 58, 55, 61, 65, 83, 70, 87, 69, 68, 65, 73, 78, 90 - }; + ]; - using (var image = new Image(8, 8)) + using (Image image = new(8, 8)) { for (int y = 0; y < 8; y++) { @@ -44,7 +44,7 @@ public class HistogramEqualizationTests } byte[] expected = - { + [ 0, 12, 53, 32, 146, 53, 174, 53, 57, 32, 12, 227, 219, 202, 32, 154, 65, 85, 93, 239, 251, 227, 65, 158, @@ -53,7 +53,7 @@ public class HistogramEqualizationTests 117, 190, 36, 190, 178, 93, 20, 170, 130, 202, 73, 20, 12, 53, 85, 194, 146, 206, 130, 117, 85, 166, 182, 215 - }; + ]; // Act image.Mutate(x => x.HistogramEqualization(new HistogramEqualizationOptions @@ -83,7 +83,7 @@ public class HistogramEqualizationTests { using (Image image = provider.GetImage()) { - var options = new HistogramEqualizationOptions + HistogramEqualizationOptions options = new() { Method = HistogramEqualizationMethod.Global, LuminanceLevels = 256, @@ -101,7 +101,7 @@ public class HistogramEqualizationTests { using (Image image = provider.GetImage()) { - var options = new HistogramEqualizationOptions + HistogramEqualizationOptions options = new() { Method = HistogramEqualizationMethod.AdaptiveSlidingWindow, LuminanceLevels = 256, @@ -121,7 +121,7 @@ public class HistogramEqualizationTests { using (Image image = provider.GetImage()) { - var options = new HistogramEqualizationOptions + HistogramEqualizationOptions options = new() { Method = HistogramEqualizationMethod.AdaptiveTileInterpolation, LuminanceLevels = 256, @@ -141,7 +141,7 @@ public class HistogramEqualizationTests { using (Image image = provider.GetImage()) { - var options = new HistogramEqualizationOptions + HistogramEqualizationOptions options = new() { Method = HistogramEqualizationMethod.AutoLevel, LuminanceLevels = 256, @@ -160,7 +160,7 @@ public class HistogramEqualizationTests { using (Image image = provider.GetImage()) { - var options = new HistogramEqualizationOptions + HistogramEqualizationOptions options = new() { Method = HistogramEqualizationMethod.AutoLevel, LuminanceLevels = 256, @@ -187,7 +187,7 @@ public class HistogramEqualizationTests { using (Image image = provider.GetImage()) { - var options = new HistogramEqualizationOptions() + HistogramEqualizationOptions options = new() { Method = HistogramEqualizationMethod.AdaptiveTileInterpolation, LuminanceLevels = 256, @@ -214,7 +214,7 @@ public class HistogramEqualizationTests // https://github.com/SixLabors/ImageSharp/discussions/1640 // Test using isolated memory to ensure clean buffers for reference provider.Configuration = Configuration.CreateDefaultInstance(); - var options = new HistogramEqualizationOptions + HistogramEqualizationOptions options = new() { Method = HistogramEqualizationMethod.AdaptiveTileInterpolation, LuminanceLevels = 4096, diff --git a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs index 7eec6eb0c..c7881597a 100644 --- a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs +++ b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs @@ -45,7 +45,7 @@ public class GlowTest : BaseImageOperationsExtensionTest [Fact] public void Glow_Rect_GlowProcessorWithDefaultValues() { - var rect = new Rectangle(12, 123, 43, 65); + Rectangle rect = new(12, 123, 43, 65); this.operations.Glow(rect); GlowProcessor p = this.Verify(rect); diff --git a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs index 1602b5c7a..e222c566f 100644 --- a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs @@ -48,7 +48,7 @@ public class VignetteTest : BaseImageOperationsExtensionTest [Fact] public void Vignette_Rect_VignetteProcessorWithDefaultValues() { - var rect = new Rectangle(12, 123, 43, 65); + Rectangle rect = new(12, 123, 43, 65); this.operations.Vignette(rect); VignetteProcessor p = this.Verify(rect); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs index 9694aeb22..62682e837 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs @@ -13,11 +13,11 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization; public class BinaryDitherTests { public static readonly string[] CommonTestImages = - { - TestImages.Png.CalliphoraPartial, TestImages.Png.Bike - }; + [ + TestImages.Png.CalliphoraPartial, TestImages.Png.Bike + ]; - public static readonly TheoryData OrderedDitherers = new TheoryData + public static readonly TheoryData OrderedDitherers = new() { { "Bayer8x8", KnownDitherings.Bayer8x8 }, { "Bayer4x4", KnownDitherings.Bayer4x4 }, @@ -25,7 +25,7 @@ public class BinaryDitherTests { "Bayer2x2", KnownDitherings.Bayer2x2 } }; - public static readonly TheoryData ErrorDiffusers = new TheoryData + public static readonly TheoryData ErrorDiffusers = new() { { "Atkinson", KnownDitherings.Atkinson }, { "Burks", KnownDitherings.Burks }, @@ -102,7 +102,7 @@ public class BinaryDitherTests using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); + Rectangle bounds = new(10, 10, image.Width / 2, image.Height / 2); image.Mutate(x => x.BinaryDither(DefaultDitherer, bounds)); image.DebugSave(provider); @@ -119,7 +119,7 @@ public class BinaryDitherTests using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); + Rectangle bounds = new(10, 10, image.Width / 2, image.Height / 2); image.Mutate(x => x.BinaryDither(DefaultErrorDiffuser, bounds)); image.DebugSave(provider); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs index ecbbb21ab..c9d3f6914 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs @@ -12,17 +12,17 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization; public class BinaryThresholdTest { public static readonly TheoryData BinaryThresholdValues - = new TheoryData - { + = new() + { .25F, .75F }; public static readonly string[] CommonTestImages = - { + [ TestImages.Png.Rgb48Bpp, - TestImages.Png.ColorsSaturationLightness, - }; + TestImages.Png.ColorsSaturationLightness + ]; public const PixelTypes TestPixelTypes = PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.Rgb24; @@ -46,7 +46,7 @@ public class BinaryThresholdTest using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - var bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); + Rectangle bounds = new(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); image.Mutate(x => x.BinaryThreshold(value, bounds)); image.DebugSave(provider, value); @@ -76,7 +76,7 @@ public class BinaryThresholdTest using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - var bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); + Rectangle bounds = new(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.Saturation, bounds)); image.DebugSave(provider, value); @@ -96,7 +96,7 @@ public class BinaryThresholdTest if (!TestEnvironment.Is64BitProcess && TestEnvironment.IsFramework) { - var comparer = ImageComparer.TolerantPercentage(0.0004F); + ImageComparer comparer = ImageComparer.TolerantPercentage(0.0004F); image.CompareToReferenceOutput(comparer, provider, value.ToString("0.00", NumberFormatInfo.InvariantInfo)); } else @@ -114,14 +114,14 @@ public class BinaryThresholdTest using (Image source = provider.GetImage()) using (Image image = source.Clone()) { - var bounds = new Rectangle(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); + Rectangle bounds = new(image.Width / 8, image.Height / 8, 6 * image.Width / 8, 6 * image.Width / 8); image.Mutate(x => x.BinaryThreshold(value, BinaryThresholdMode.MaxChroma, bounds)); image.DebugSave(provider, value); if (!TestEnvironment.Is64BitProcess && TestEnvironment.IsFramework) { - var comparer = ImageComparer.TolerantPercentage(0.0004F); + ImageComparer comparer = ImageComparer.TolerantPercentage(0.0004F); image.CompareToReferenceOutput(comparer, provider, value.ToString("0.00", NumberFormatInfo.InvariantInfo)); } else diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs index 13ddf85c1..1eec35368 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs @@ -12,14 +12,14 @@ public abstract class Basic1ParameterConvolutionTests { private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.05F); - public static readonly TheoryData Values = new TheoryData { 3, 5 }; + public static readonly TheoryData Values = new() { 3, 5 }; public static readonly string[] InputImages = - { + [ TestImages.Bmp.Car, TestImages.Png.CalliphoraPartial, TestImages.Png.Blur - }; + ]; [Theory] [WithFileCollection(nameof(InputImages), nameof(Values), PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs index f045c981e..3d4c239c9 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs @@ -50,7 +50,7 @@ public class BokehBlurTest List components = new(); foreach (Match match in Regex.Matches(Components10x2, @"\[\[(.*?)\]\]", RegexOptions.Singleline)) { - string[] values = match.Groups[1].Value.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + string[] values = match.Groups[1].Value.Trim().Split([' '], StringSplitOptions.RemoveEmptyEntries); Complex64[] component = values.Select( value => { @@ -114,12 +114,12 @@ public class BokehBlurTest }; public static readonly string[] TestFiles = - { - TestImages.Png.CalliphoraPartial, + [ + TestImages.Png.CalliphoraPartial, TestImages.Png.Bike, TestImages.Png.BikeGrayscale, - TestImages.Png.Cross, - }; + TestImages.Png.Cross + ]; [Theory] [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32)] @@ -148,7 +148,7 @@ public class BokehBlurTest [Theory] [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.AllowAll)] - [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.DisableSSE41)] + [WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.DisableHWIntrinsic)] public void BokehBlurFilterProcessor_Bounded(TestImageProvider provider, BokehBlurInfo value, HwIntrinsics intrinsicsFilter) { static void RunTest(string arg1, string arg2) diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs index 0cb56b732..468965f1e 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/ConvolutionTests.cs @@ -12,7 +12,7 @@ public class ConvolutionTests { private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.05F); - public static readonly TheoryData> Values = new TheoryData> + public static readonly TheoryData> Values = new() { // Sharpening kernel. new float[,] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs index d51012f9e..be3fc1e50 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs @@ -17,21 +17,21 @@ public class DetectEdgesTest private static readonly ImageComparer TransparentComparer = ImageComparer.TolerantPercentage(0.5F); - public static readonly string[] TestImages = { Tests.TestImages.Png.Bike }; + public static readonly string[] TestImages = [Tests.TestImages.Png.Bike]; public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.RgbaVector; public static readonly TheoryData DetectEdgesFilters - = new TheoryData - { + = new() + { { KnownEdgeDetectorKernels.Laplacian3x3, nameof(KnownEdgeDetectorKernels.Laplacian3x3) }, { KnownEdgeDetectorKernels.Laplacian5x5, nameof(KnownEdgeDetectorKernels.Laplacian5x5) }, { KnownEdgeDetectorKernels.LaplacianOfGaussian, nameof(KnownEdgeDetectorKernels.LaplacianOfGaussian) }, }; public static readonly TheoryData DetectEdges2DFilters - = new TheoryData - { + = new() + { { KnownEdgeDetectorKernels.Kayyali, nameof(KnownEdgeDetectorKernels.Kayyali) }, { KnownEdgeDetectorKernels.Prewitt, nameof(KnownEdgeDetectorKernels.Prewitt) }, { KnownEdgeDetectorKernels.RobertsCross, nameof(KnownEdgeDetectorKernels.RobertsCross) }, @@ -40,8 +40,8 @@ public class DetectEdgesTest }; public static readonly TheoryData DetectEdgesCompassFilters - = new TheoryData - { + = new() + { { KnownEdgeDetectorKernels.Kirsch, nameof(KnownEdgeDetectorKernels.Kirsch) }, { KnownEdgeDetectorKernels.Robinson, nameof(KnownEdgeDetectorKernels.Robinson) }, }; @@ -55,7 +55,7 @@ public class DetectEdgesTest ctx => { Size size = ctx.GetCurrentSize(); - var bounds = new Rectangle(10, 10, size.Width / 2, size.Height / 2); + Rectangle bounds = new(10, 10, size.Width / 2, size.Height / 2); ctx.DetectEdges(bounds); }, comparer: OpaqueComparer, @@ -158,7 +158,7 @@ public class DetectEdgesTest { using (Image image = provider.GetImage()) { - var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2); + Rectangle bounds = new(10, 10, image.Width / 2, image.Height / 2); image.Mutate(x => x.DetectEdges(bounds)); image.DebugSave(provider); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs index b8e968f73..25acd3aa6 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs @@ -14,10 +14,10 @@ public class DitherTests public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.Rgb24 | PixelTypes.RgbaVector; - public static readonly string[] CommonTestImages = { TestImages.Png.CalliphoraPartial, TestImages.Png.Bike }; + public static readonly string[] CommonTestImages = [TestImages.Png.CalliphoraPartial, TestImages.Png.Bike]; public static readonly TheoryData ErrorDiffusers - = new TheoryData + = new() { { KnownDitherings.Atkinson, nameof(KnownDitherings.Atkinson) }, { KnownDitherings.Burks, nameof(KnownDitherings.Burks) }, @@ -31,7 +31,7 @@ public class DitherTests }; public static readonly TheoryData OrderedDitherers - = new TheoryData + = new() { { KnownDitherings.Bayer2x2, nameof(KnownDitherings.Bayer2x2) }, { KnownDitherings.Bayer4x4, nameof(KnownDitherings.Bayer4x4) }, @@ -41,7 +41,7 @@ public class DitherTests }; public static readonly TheoryData DefaultInstanceDitherers - = new TheoryData + = new() { default(ErrorDither), default(OrderedDither) @@ -101,7 +101,7 @@ public class DitherTests } // Increased tolerance because of compatibility issues on .NET 4.6.2: - var comparer = ImageComparer.TolerantPercentage(1f); + ImageComparer comparer = ImageComparer.TolerantPercentage(1f); provider.RunValidatingProcessorTest(x => x.Dither(DefaultErrorDiffuser), comparer: comparer); } @@ -186,7 +186,7 @@ public class DitherTests { void Command() { - using var image = new Image(10, 10); + using Image image = new(10, 10); image.Mutate(x => x.Dither(dither)); } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs index ed3be0f67..ab379ad7c 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs @@ -11,10 +11,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects; public class BackgroundColorTest { public static readonly string[] InputImages = - { - TestImages.Png.Splash, + [ + TestImages.Png.Splash, TestImages.Png.Ducky - }; + ]; [Theory] [WithFileCollection(nameof(InputImages), PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs index 10811a559..b7e859785 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs @@ -11,17 +11,17 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects; [GroupOutput("Effects")] public class OilPaintTest { - public static readonly TheoryData OilPaintValues = new TheoryData - { + public static readonly TheoryData OilPaintValues = new() + { { 15, 10 }, { 6, 5 } }; public static readonly string[] InputImages = - { - TestImages.Png.CalliphoraPartial, + [ + TestImages.Png.CalliphoraPartial, TestImages.Bmp.Car - }; + ]; [Theory] [WithFileCollection(nameof(InputImages), nameof(OilPaintValues), PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs index fd732f570..b88ab37fe 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelShaderTest.cs @@ -71,7 +71,7 @@ public class PixelShaderTest Vector4 v4 = span[i]; float avg = (v4.X + v4.Y + v4.Z) / 3f; - var gray = new Vector4(avg, avg, avg, a); + Vector4 gray = new(avg, avg, avg, a); span[i] = Vector4.Clamp(gray, Vector4.Zero, Vector4.One); } @@ -101,7 +101,7 @@ public class PixelShaderTest Vector4 v4 = span[i]; float avg = (v4.X + v4.Y + v4.Z) / 3f; - var gray = new Vector4(avg, avg, avg, a); + Vector4 gray = new(avg, avg, avg, a); span[i] = Vector4.Clamp(gray, Vector4.Zero, Vector4.One); } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs index 29b952403..fff7ba018 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects; [GroupOutput("Effects")] public class PixelateTest { - public static readonly TheoryData PixelateValues = new TheoryData { 4, 8 }; + public static readonly TheoryData PixelateValues = new() { 4, 8 }; [Theory] [WithFile(TestImages.Png.Ducky, nameof(PixelateValues), PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs index 7da96d13d..4663aa868 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs @@ -14,7 +14,7 @@ public class BrightnessTest private readonly ImageComparer imageComparer = ImageComparer.Tolerant(0.007F); public static readonly TheoryData BrightnessValues - = new TheoryData + = new() { .5F, 1.5F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs index 0727a5b97..1f2afb97f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs @@ -14,7 +14,7 @@ public class ColorBlindnessTest private readonly ImageComparer imageComparer = ImageComparer.Tolerant(0.03F); public static readonly TheoryData ColorBlindnessFilters - = new TheoryData + = new() { ColorBlindnessMode.Achromatomaly, ColorBlindnessMode.Achromatopsia, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs index 5e2a7f55d..6ff10bbd8 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class ContrastTest { public static readonly TheoryData ContrastValues - = new TheoryData + = new() { .5F, 1.5F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs index 50a262152..15ef7f7c3 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class GrayscaleTest { public static readonly TheoryData GrayscaleModeTypes - = new TheoryData + = new() { GrayscaleMode.Bt601, GrayscaleMode.Bt709 diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs index 65ac4245d..1838cc33d 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class HueTest { public static readonly TheoryData HueValues - = new TheoryData + = new() { 180, -180 diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs index 39e69aa4a..49e2c8546 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/LightnessTest.cs @@ -14,7 +14,7 @@ public class LightnessTest private readonly ImageComparer imageComparer = ImageComparer.Tolerant(0.007F); public static readonly TheoryData LightnessValues - = new TheoryData + = new() { .5F, 1.5F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs index 10ddf3a47..8a1bbfe3f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class OpacityTest { public static readonly TheoryData AlphaValues - = new TheoryData + = new() { 20 / 100F, 80 / 100F diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs index 8632d4625..642c79819 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters; public class SaturateTest { public static readonly TheoryData SaturationValues - = new TheoryData + = new() { .5F, 1.5F, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs b/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs index cf2b7d4da..3005867ca 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Overlays/OverlayTestBase.cs @@ -11,9 +11,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Overlays; [GroupOutput("Overlays")] public abstract class OverlayTestBase { - public static string[] ColorNames = { "Blue", "White" }; + public static string[] ColorNames = ["Blue", "White"]; - public static string[] InputImages = { TestImages.Png.Ducky, TestImages.Png.Splash }; + public static string[] InputImages = [TestImages.Png.Ducky, TestImages.Png.Splash]; private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.05f); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs index c6880d3a8..c9f3daf0f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Quantization/OctreeQuantizerTests.cs @@ -13,8 +13,8 @@ public class OctreeQuantizerTests [Fact] public void OctreeQuantizerConstructor() { - var expected = new QuantizerOptions { MaxColors = 128 }; - var quantizer = new OctreeQuantizer(expected); + QuantizerOptions expected = new() { MaxColors = 128 }; + OctreeQuantizer quantizer = new(expected); Assert.Equal(expected.MaxColors, quantizer.Options.MaxColors); Assert.Equal(QuantizerConstants.DefaultDither, quantizer.Options.Dither); @@ -38,7 +38,7 @@ public class OctreeQuantizerTests [Fact] public void OctreeQuantizerCanCreateFrameQuantizer() { - var quantizer = new OctreeQuantizer(); + OctreeQuantizer quantizer = new(); IQuantizer frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs index 91cf90bc4..f2a4b079b 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Quantization/PaletteQuantizerTests.cs @@ -10,13 +10,13 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Quantization; [Trait("Category", "Processors")] public class PaletteQuantizerTests { - private static readonly Color[] Palette = { Color.Red, Color.Green, Color.Blue }; + private static readonly Color[] Palette = [Color.Red, Color.Green, Color.Blue]; [Fact] public void PaletteQuantizerConstructor() { - var expected = new QuantizerOptions { MaxColors = 128 }; - var quantizer = new PaletteQuantizer(Palette, expected); + QuantizerOptions expected = new() { MaxColors = 128 }; + PaletteQuantizer quantizer = new(Palette, expected); Assert.Equal(expected.MaxColors, quantizer.Options.MaxColors); Assert.Equal(QuantizerConstants.DefaultDither, quantizer.Options.Dither); @@ -40,7 +40,7 @@ public class PaletteQuantizerTests [Fact] public void PaletteQuantizerCanCreateFrameQuantizer() { - var quantizer = new PaletteQuantizer(Palette); + PaletteQuantizer quantizer = new(Palette); IQuantizer frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Quantization/QuantizerTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Quantization/QuantizerTests.cs index b8b4615b9..2ba757c11 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Quantization/QuantizerTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Quantization/QuantizerTests.cs @@ -13,10 +13,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Quantization; public class QuantizerTests { public static readonly string[] CommonTestImages = - { + [ TestImages.Png.CalliphoraPartial, TestImages.Png.Bike - }; + ]; private static readonly QuantizerOptions NoDitherOptions = new() { Dither = null }; private static readonly QuantizerOptions DiffuserDitherOptions = new() { Dither = KnownDitherings.FloydSteinberg }; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs index ab4304d89..2d270b2a4 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Quantization/WuQuantizerTests.cs @@ -13,8 +13,8 @@ public class WuQuantizerTests [Fact] public void WuQuantizerConstructor() { - var expected = new QuantizerOptions { MaxColors = 128 }; - var quantizer = new WuQuantizer(expected); + QuantizerOptions expected = new() { MaxColors = 128 }; + WuQuantizer quantizer = new(expected); Assert.Equal(expected.MaxColors, quantizer.Options.MaxColors); Assert.Equal(QuantizerConstants.DefaultDither, quantizer.Options.Dither); @@ -38,7 +38,7 @@ public class WuQuantizerTests [Fact] public void WuQuantizerCanCreateFrameQuantizer() { - var quantizer = new WuQuantizer(); + WuQuantizer quantizer = new(); IQuantizer frameQuantizer = quantizer.CreatePixelSpecificQuantizer(Configuration.Default); Assert.NotNull(frameQuantizer); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs index a7855e23a..941d78c43 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AffineTransformTests.cs @@ -234,7 +234,23 @@ public class AffineTransformTests image.DebugSave(provider); Assert.Equal(4, image.Width); - Assert.Equal(8, image.Height); + Assert.Equal(7, image.Height); + } + + [Theory] + [WithFile(TestImages.Png.Issue3000, PixelTypes.Rgba32, 3, 3)] + [WithFile(TestImages.Png.Issue3000, PixelTypes.Rgba32, 4, 4)] + public void Issue3000(TestImageProvider provider, float x, float y) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + image.Mutate(c => c + .Transform(new AffineTransformBuilder().AppendRotationDegrees(90, new Vector2(x, y)))); + + string details = $"p-{x}-{y}"; + image.DebugSave(provider, testOutputDetails: details); + image.CompareToReferenceOutput(ValidatorComparer, provider, testOutputDetails: details); } [Theory] @@ -267,31 +283,41 @@ public class AffineTransformTests image.CompareToReferenceOutput(ValidatorComparer, provider, testOutputDetails: radians); } - [Fact] - public void TransformRotationDoesNotOffset() + [Theory] + [WithSolidFilledImages(100, 100, "DimGray", PixelTypes.Rgba32)] + public void TransformRotationDoesNotOffset(TestImageProvider provider) + where TPixel : unmanaged, IPixel { Rgba32 background = Color.DimGray.ToPixel(); - Rgba32 marker = Color.Aqua.ToPixel(); + TPixel marker = Color.Aqua.ToPixel(); + + using Image canvas = provider.GetImage(); - using Image img = new(100, 100, background); + using Image img = canvas.Clone(); img[0, 0] = marker; img.Mutate(c => c.Rotate(180)); Assert.Equal(marker, img[99, 99]); - using Image img2 = new(100, 100, background); + img.DebugSave(provider, "Rotate180"); + + using Image img2 = canvas.Clone(); img2[0, 0] = marker; img2.Mutate( c => c.Transform(new AffineTransformBuilder().AppendRotationDegrees(180), KnownResamplers.NearestNeighbor)); - using Image img3 = new(100, 100, background); + img.DebugSave(provider, "AffineRotate180NN"); + + using Image img3 = canvas.Clone(); img3[0, 0] = marker; img3.Mutate(c => c.Transform(new AffineTransformBuilder().AppendRotationDegrees(180))); + img3.DebugSave(provider, "AffineRotate180Bicubic"); + ImageComparer.Exact.VerifySimilarity(img, img2); ImageComparer.Exact.VerifySimilarity(img, img3); } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs index 6a61538ea..ee21920d4 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs @@ -17,8 +17,8 @@ public class AutoOrientTests public static readonly TheoryData InvalidOrientationValues = new() { - { ExifDataType.Byte, new byte[] { 1 } }, - { ExifDataType.SignedByte, new byte[] { 2 } }, + { ExifDataType.Byte, [1] }, + { ExifDataType.SignedByte, [2] }, { ExifDataType.SignedShort, BitConverter.GetBytes((short)3) }, { ExifDataType.Long, BitConverter.GetBytes(4U) }, { ExifDataType.SignedLong, BitConverter.GetBytes(5) } @@ -57,7 +57,7 @@ public class AutoOrientTests public void AutoOrient_WorksWithCorruptExifData(TestImageProvider provider, ExifDataType dataType, byte[] orientation) where TPixel : unmanaged, IPixel { - var profile = new ExifProfile(); + ExifProfile profile = new(); profile.SetValue(ExifTag.JPEGTables, orientation); byte[] bytes = profile.ToByteArray(); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs index 18a7a9bd0..56e9a5201 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs @@ -1,8 +1,10 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Metadata.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Tests.TestUtilities; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; @@ -17,12 +19,36 @@ public class CropTest public void Crop(TestImageProvider provider, int x, int y, int w, int h) where TPixel : unmanaged, IPixel { - var rect = new Rectangle(x, y, w, h); + Rectangle rect = new(x, y, w, h); FormattableString info = $"X{x}Y{y}.W{w}H{h}"; provider.RunValidatingProcessorTest( ctx => ctx.Crop(rect), info, - appendPixelTypeToFileName: false, - comparer: ImageComparer.Exact); + comparer: ImageComparer.Exact, + appendPixelTypeToFileName: false); + } + + [Theory] + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] + public void CropUpdatesSubject(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectLocation, [5, 15]); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectArea, [5, 15, 50, 50]); + + image.Mutate(ctx => ctx.Crop(Rectangle.FromLTRB(20, 20, 50, 50))); + + // The new subject area is now relative to the cropped area. + // overhanging pixels are constrained to the dimensions of the image. + Assert.Equal( + [0, 0], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectLocation).Value); + + Assert.Equal( + [0, 0, 30, 30], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectArea).Value); } } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs index ca4b00d8a..ffa9be6ea 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs @@ -10,14 +10,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; [GroupOutput("Transforms")] public class EntropyCropTest { - public static readonly TheoryData EntropyCropValues = new TheoryData { .25F, .75F }; + public static readonly TheoryData EntropyCropValues = new() { .25F, .75F }; public static readonly string[] InputImages = - { - TestImages.Png.Ducky, + [ + TestImages.Png.Ducky, TestImages.Jpeg.Baseline.Jpeg400, TestImages.Jpeg.Baseline.MultiScanBaselineCMYK - }; + ]; [Theory] [WithFileCollection(nameof(InputImages), nameof(EntropyCropValues), PixelTypes.Rgba32)] @@ -35,8 +35,8 @@ public class EntropyCropTest { // arrange using Image image = provider.GetImage(); - var expectedHeight = image.Height; - var expectedWidth = image.Width; + int expectedHeight = image.Height; + int expectedWidth = image.Width; // act image.Mutate(img => img.EntropyCrop()); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs index 717582274..9aa04e370 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs @@ -1,8 +1,10 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Metadata.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Tests.TestUtilities; // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; @@ -12,12 +14,12 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; public class FlipTests { public static readonly TheoryData FlipValues = - new TheoryData - { - FlipMode.None, - FlipMode.Vertical, - FlipMode.Horizontal, - }; + new() + { + FlipMode.None, + FlipMode.Vertical, + FlipMode.Horizontal + }; [Theory] [WithTestPatternImages(nameof(FlipValues), 20, 37, PixelTypes.Rgba32)] @@ -25,23 +27,77 @@ public class FlipTests [WithTestPatternImages(nameof(FlipValues), 17, 32, PixelTypes.Rgba32)] public void Flip(TestImageProvider provider, FlipMode flipMode) where TPixel : unmanaged, IPixel - { - provider.RunValidatingProcessorTest( + => provider.RunValidatingProcessorTest( ctx => ctx.Flip(flipMode), testOutputDetails: flipMode, appendPixelTypeToFileName: false); - } [Theory] [WithTestPatternImages(nameof(FlipValues), 53, 37, PixelTypes.Rgba32)] [WithTestPatternImages(nameof(FlipValues), 17, 32, PixelTypes.Rgba32)] public void Flip_WorksOnWrappedMemoryImage(TestImageProvider provider, FlipMode flipMode) where TPixel : unmanaged, IPixel - { - provider.RunValidatingProcessorTestOnWrappedMemoryImage( + => provider.RunValidatingProcessorTestOnWrappedMemoryImage( ctx => ctx.Flip(flipMode), testOutputDetails: flipMode, useReferenceOutputFrom: nameof(this.Flip), appendPixelTypeToFileName: false); + + [Theory] + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] + public void FlipVerticalUpdatesSubject(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectLocation, [5, 15]); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectArea, [5, 15, 50, 50]); + + image.Mutate(ctx => ctx.Flip(FlipMode.Vertical)); + + // The subject location is a single coordinate, so a vertical flip simply reflects its Y position: + // newY = imageHeight - originalY - 1 + // This mirrors the point vertically around the image's horizontal axis, preserving its X coordinate. + Assert.Equal( + [5, 84], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectLocation).Value); + + // The subject area is now inverted because a vertical flip reflects the image across + // the horizontal axis passing through the image center. + // The Y-coordinate of the top edge is recalculated as: + // newY = imageHeight - originalY - height - 1 + Assert.Equal( + [5, 34, 50, 50], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectArea).Value); + } + + [Theory] + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] + public void FlipHorizontalUpdatesSubject(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectLocation, [5, 15]); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectArea, [5, 15, 50, 50]); + + image.Mutate(ctx => ctx.Flip(FlipMode.Horizontal)); + + // The subject location is a single coordinate, so a horizontal flip simply reflects its X position: + // newX = imageWidth - originalX - 1 + // This mirrors the point horizontally around the image's vertical axis, preserving its Y coordinate. + Assert.Equal( + [94, 15], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectLocation).Value); + + // The subject area is now inverted because a horizontal flip reflects the image across + // the vertical axis passing through the image center. + // The X-coordinate of the left edge is recalculated as: + // newX = imageWidth - originalX - width - 1 + Assert.Equal( + [44, 15, 50, 50], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectArea).Value); } } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs index 8949049fb..0b6f5702f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs @@ -10,9 +10,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; public class PadTest { public static readonly string[] CommonTestImages = - { + [ TestImages.Png.CalliphoraPartial, TestImages.Png.Bike - }; + ]; [Theory] [WithFileCollection(nameof(CommonTestImages), PixelTypes.Rgba32)] diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ProjectiveTransformTests.cs similarity index 67% rename from tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs rename to tests/ImageSharp.Tests/Processing/Processors/Transforms/ProjectiveTransformTests.cs index 6b6db69c1..c65f136d6 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ProjectiveTransformTests.cs @@ -3,14 +3,16 @@ using System.Numerics; using System.Reflection; +using SixLabors.ImageSharp.Metadata.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Processors.Transforms; +using SixLabors.ImageSharp.Tests.TestUtilities; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using Xunit.Abstractions; // ReSharper disable InconsistentNaming -namespace SixLabors.ImageSharp.Tests.Processing.Transforms; +namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; [Trait("Category", "Processors")] public class ProjectiveTransformTests @@ -20,7 +22,7 @@ public class ProjectiveTransformTests private ITestOutputHelper Output { get; } - public static readonly TheoryData ResamplerNames = new TheoryData + public static readonly TheoryData ResamplerNames = new() { nameof(KnownResamplers.Bicubic), nameof(KnownResamplers.Box), @@ -39,7 +41,7 @@ public class ProjectiveTransformTests nameof(KnownResamplers.Welch), }; - public static readonly TheoryData TaperMatrixData = new TheoryData + public static readonly TheoryData TaperMatrixData = new() { { TaperSide.Bottom, TaperCorner.Both }, { TaperSide.Bottom, TaperCorner.LeftOrTop }, @@ -71,16 +73,14 @@ public class ProjectiveTransformTests where TPixel : unmanaged, IPixel { IResampler sampler = GetResampler(resamplerName); - using (Image image = provider.GetImage()) - { - ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() - .AppendTaper(TaperSide.Right, TaperCorner.Both, .5F); + using Image image = provider.GetImage(); + ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() + .AppendTaper(TaperSide.Right, TaperCorner.Both, .5F); - image.Mutate(i => i.Transform(builder, sampler)); + image.Mutate(i => i.Transform(builder, sampler)); - image.DebugSave(provider, resamplerName); - image.CompareToReferenceOutput(ValidatorComparer, provider, resamplerName); - } + image.DebugSave(provider, resamplerName); + image.CompareToReferenceOutput(ValidatorComparer, provider, resamplerName); } [Theory] @@ -88,17 +88,15 @@ public class ProjectiveTransformTests public void Transform_WithTaperMatrix(TestImageProvider provider, TaperSide taperSide, TaperCorner taperCorner) where TPixel : unmanaged, IPixel { - using (Image image = provider.GetImage()) - { - ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() - .AppendTaper(taperSide, taperCorner, .5F); + using Image image = provider.GetImage(); + ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() + .AppendTaper(taperSide, taperCorner, .5F); - image.Mutate(i => i.Transform(builder)); + image.Mutate(i => i.Transform(builder)); - FormattableString testOutputDetails = $"{taperSide}-{taperCorner}"; - image.DebugSave(provider, testOutputDetails); - image.CompareFirstFrameToReferenceOutput(TolerantComparer, provider, testOutputDetails); - } + FormattableString testOutputDetails = $"{taperSide}-{taperCorner}"; + image.DebugSave(provider, testOutputDetails); + image.CompareFirstFrameToReferenceOutput(TolerantComparer, provider, testOutputDetails); } [Theory] @@ -106,17 +104,15 @@ public class ProjectiveTransformTests public void Transform_WithQuadDistortion(TestImageProvider provider, PointF topLeft, PointF topRight, PointF bottomRight, PointF bottomLeft) where TPixel : unmanaged, IPixel { - using (Image image = provider.GetImage()) - { - ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() - .AppendQuadDistortion(topLeft, topRight, bottomRight, bottomLeft); + using Image image = provider.GetImage(); + ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() + .AppendQuadDistortion(topLeft, topRight, bottomRight, bottomLeft); - image.Mutate(i => i.Transform(builder)); + image.Mutate(i => i.Transform(builder)); - FormattableString testOutputDetails = $"{topLeft}-{topRight}-{bottomRight}-{bottomLeft}"; - image.DebugSave(provider, testOutputDetails); - image.CompareFirstFrameToReferenceOutput(TolerantComparer, provider, testOutputDetails); - } + FormattableString testOutputDetails = $"{topLeft}-{topRight}-{bottomRight}-{bottomLeft}"; + image.DebugSave(provider, testOutputDetails); + image.CompareFirstFrameToReferenceOutput(TolerantComparer, provider, testOutputDetails); } [Theory] @@ -129,19 +125,17 @@ public class ProjectiveTransformTests // This test matches the output described in the example at // https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/transforms/non-affine - using (Image image = provider.GetImage()) - { - Matrix4x4 matrix = Matrix4x4.Identity; - matrix.M14 = 0.01F; + using Image image = provider.GetImage(); + Matrix4x4 matrix = Matrix4x4.Identity; + matrix.M14 = 0.01F; - ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() + ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() .AppendMatrix(matrix); - image.Mutate(i => i.Transform(builder)); + image.Mutate(i => i.Transform(builder)); - image.DebugSave(provider); - image.CompareToReferenceOutput(TolerantComparer, provider); - } + image.DebugSave(provider); + image.CompareToReferenceOutput(TolerantComparer, provider); } [Theory] @@ -151,30 +145,28 @@ public class ProjectiveTransformTests { // https://jsfiddle.net/dFrHS/545/ // https://github.com/SixLabors/ImageSharp/issues/787 - using (Image image = provider.GetImage()) - { + using Image image = provider.GetImage(); #pragma warning disable SA1117 // Parameters should be on same line or separate lines - Matrix4x4 matrix = new( - 0.260987f, -0.434909f, 0, -0.0022184f, - 0.373196f, 0.949882f, 0, -0.000312129f, - 0, 0, 1, 0, - 52, 165, 0, 1); + Matrix4x4 matrix = new( + 0.260987f, -0.434909f, 0, -0.0022184f, + 0.373196f, 0.949882f, 0, -0.000312129f, + 0, 0, 1, 0, + 52, 165, 0, 1); #pragma warning restore SA1117 // Parameters should be on same line or separate lines - ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() + ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() .AppendMatrix(matrix); - image.Mutate(i => i.Transform(builder)); + image.Mutate(i => i.Transform(builder)); - image.DebugSave(provider); - image.CompareToReferenceOutput(TolerantComparer, provider); - } + image.DebugSave(provider); + image.CompareToReferenceOutput(TolerantComparer, provider); } [Fact] public void Issue1911() { - using var image = new Image(100, 100); + using Image image = new(100, 100); image.Mutate(x => x = x.Transform(new Rectangle(0, 0, 99, 100), Matrix4x4.Identity, new Size(99, 100), KnownResamplers.Lanczos2)); Assert.Equal(99, image.Width); @@ -240,13 +232,44 @@ public class ProjectiveTransformTests ImageComparer.Exact.VerifySimilarity(img, img3); } + [Theory] + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] + public void TransformUpdatesSubject(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectLocation, [5, 15]); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectArea, [5, 15, 50, 50]); + + ProjectiveTransformBuilder builder = new ProjectiveTransformBuilder() + .AppendRotationDegrees(180); + + image.Mutate(ctx => ctx.Transform(builder)); + + // A 180-degree rotation inverts both axes around the image center. + // The subject location (5, 15) becomes (imageWidth - 5, imageHeight - 15) = (95, 85) + Assert.Equal( + [95, 85], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectLocation).Value); + + // The subject area is also mirrored around the center. + // New X = imageWidth - originalX - width + // New Y = imageHeight - originalY - height + // (5, 15, 50, 50) becomes (45, 35, 50, 50) + Assert.Equal( + [45, 35, 50, 50], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectArea).Value); + } + private static IResampler GetResampler(string name) { PropertyInfo property = typeof(KnownResamplers).GetTypeInfo().GetProperty(name); if (property is null) { - throw new Exception($"No resampler named {name}"); + throw new InvalidOperationException($"No resampler named {name}"); } return (IResampler)property.GetValue(null); diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs index 84d834cc5..e3e7118c0 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeHelperTests.cs @@ -34,8 +34,8 @@ public class ResizeHelperTests [Fact] public void CalculateMinRectangleWhenSourceIsSmallerThanTarget() { - var sourceSize = new Size(200, 100); - var target = new Size(400, 200); + Size sourceSize = new(200, 100); + Size target = new(400, 200); (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, @@ -52,11 +52,11 @@ public class ResizeHelperTests [Fact] public void MaxSizeAndRectangleAreCorrect() { - var sourceSize = new Size(5072, 6761); - var target = new Size(0, 450); + Size sourceSize = new(5072, 6761); + Size target = new(0, 450); - var expectedSize = new Size(338, 450); - var expectedRectangle = new Rectangle(Point.Empty, expectedSize); + Size expectedSize = new(338, 450); + Rectangle expectedRectangle = new(Point.Empty, expectedSize); (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, @@ -73,11 +73,11 @@ public class ResizeHelperTests [Fact] public void CropSizeAndRectangleAreCorrect() { - var sourceSize = new Size(100, 100); - var target = new Size(25, 50); + Size sourceSize = new(100, 100); + Size target = new(25, 50); - var expectedSize = new Size(25, 50); - var expectedRectangle = new Rectangle(-12, 0, 50, 50); + Size expectedSize = new(25, 50); + Rectangle expectedRectangle = new(-12, 0, 50, 50); (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, @@ -94,11 +94,11 @@ public class ResizeHelperTests [Fact] public void BoxPadSizeAndRectangleAreCorrect() { - var sourceSize = new Size(100, 100); - var target = new Size(120, 110); + Size sourceSize = new(100, 100); + Size target = new(120, 110); - var expectedSize = new Size(120, 110); - var expectedRectangle = new Rectangle(10, 5, 100, 100); + Size expectedSize = new(120, 110); + Rectangle expectedRectangle = new(10, 5, 100, 100); (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, @@ -115,11 +115,11 @@ public class ResizeHelperTests [Fact] public void PadSizeAndRectangleAreCorrect() { - var sourceSize = new Size(100, 100); - var target = new Size(120, 110); + Size sourceSize = new(100, 100); + Size target = new(120, 110); - var expectedSize = new Size(120, 110); - var expectedRectangle = new Rectangle(5, 0, 110, 110); + Size expectedSize = new(120, 110); + Rectangle expectedRectangle = new(5, 0, 110, 110); (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, @@ -136,11 +136,11 @@ public class ResizeHelperTests [Fact] public void StretchSizeAndRectangleAreCorrect() { - var sourceSize = new Size(100, 100); - var target = new Size(57, 32); + Size sourceSize = new(100, 100); + Size target = new(57, 32); - var expectedSize = new Size(57, 32); - var expectedRectangle = new Rectangle(Point.Empty, expectedSize); + Size expectedSize = new(57, 32); + Rectangle expectedRectangle = new(Point.Empty, expectedSize); (Size size, Rectangle rectangle) = ResizeHelper.CalculateTargetLocationAndBounds( sourceSize, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs index cc0fc051e..8c200e983 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs @@ -22,8 +22,8 @@ public partial class ResizeKernelMapTests /// resamplerName, srcSize, destSize /// public static readonly TheoryData KernelMapData - = new TheoryData - { + = new() + { { KnownResamplers.Bicubic, 15, 10 }, { KnownResamplers.Bicubic, 10, 15 }, { KnownResamplers.Bicubic, 20, 20 }, @@ -88,7 +88,7 @@ public partial class ResizeKernelMapTests public void PrintNonNormalizedKernelMap(TResampler resampler, int srcSize, int destSize) where TResampler : struct, IResampler { - var kernelMap = ReferenceKernelMap.Calculate(in resampler, destSize, srcSize, false); + ReferenceKernelMap kernelMap = ReferenceKernelMap.Calculate(in resampler, destSize, srcSize, false); this.Output.WriteLine($"Actual KernelMap:\n{PrintKernelMap(kernelMap)}\n"); } @@ -116,8 +116,8 @@ public partial class ResizeKernelMapTests private void VerifyKernelMapContentIsCorrect(TResampler resampler, int srcSize, int destSize) where TResampler : struct, IResampler { - var referenceMap = ReferenceKernelMap.Calculate(in resampler, destSize, srcSize); - var kernelMap = ResizeKernelMap.Calculate(in resampler, destSize, srcSize, Configuration.Default.MemoryAllocator); + ReferenceKernelMap referenceMap = ReferenceKernelMap.Calculate(in resampler, destSize, srcSize); + ResizeKernelMap kernelMap = ResizeKernelMap.Calculate(in resampler, destSize, srcSize, Configuration.Default.MemoryAllocator); #if DEBUG this.Output.WriteLine(kernelMap.Info); @@ -184,7 +184,7 @@ public partial class ResizeKernelMapTests Func getDestinationSize, Func getKernel) { - var bld = new StringBuilder(); + StringBuilder bld = new(); if (kernelMap is ResizeKernelMap actualMap) { @@ -214,19 +214,19 @@ public partial class ResizeKernelMapTests private static TheoryData GenerateImageResizeData() { - var result = new TheoryData(); + TheoryData result = new(); string[] resamplerNames = TestUtils.GetAllResamplerNames(false); int[] dimensionVals = - { - // Arbitrary, small dimensions: + [ + // Arbitrary, small dimensions: 9, 10, 11, 13, 49, 50, 53, 99, 100, 199, 200, 201, 299, 300, 301, // Typical image sizes: 640, 480, 800, 600, 1024, 768, 1280, 960, 1536, 1180, 1600, 1200, 2048, 1536, 2240, 1680, 2560, 1920, 3032, 2008, 3072, 2304, 3264, 2448 - }; + ]; IOrderedEnumerable<(int S, int D)> source2Dest = dimensionVals .SelectMany(s => dimensionVals.Select(d => (s, d))) diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index d1b005ee4..023d47886 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -3,10 +3,12 @@ using System.Numerics; using System.Runtime.CompilerServices; +using SixLabors.ImageSharp.Metadata.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.ImageSharp.Tests.Memory; +using SixLabors.ImageSharp.Tests.TestUtilities; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; // ReSharper disable InconsistentNaming @@ -20,15 +22,15 @@ public class ResizeTests public static readonly string[] AllResamplerNames = TestUtils.GetAllResamplerNames(); - public static readonly string[] CommonTestImages = { TestImages.Png.CalliphoraPartial }; + public static readonly string[] CommonTestImages = [TestImages.Png.CalliphoraPartial]; public static readonly string[] SmokeTestResamplerNames = - { + [ nameof(KnownResamplers.NearestNeighbor), nameof(KnownResamplers.Bicubic), nameof(KnownResamplers.Box), nameof(KnownResamplers.Lanczos5), - }; + ]; private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.07F); @@ -78,7 +80,7 @@ public class ResizeTests // resizing: (15, 12) -> (10, 6) // kernel dimensions: (3, 4) using Image image = provider.GetImage(); - Size destSize = new Size(image.Width * wN / wD, image.Height * hN / hD); + Size destSize = new(image.Width * wN / wD, image.Height * hN / hD); image.Mutate(x => x.Resize(destSize, KnownResamplers.Bicubic, false)); FormattableString outputInfo = $"({wN}÷{wD},{hN}÷{hD})"; image.DebugSave(provider, outputInfo, appendPixelTypeToFileName: false); @@ -106,7 +108,7 @@ public class ResizeTests Configuration configuration = Configuration.CreateDefaultInstance(); int workingBufferSizeHintInBytes = workingBufferLimitInRows * destSize.Width * SizeOfVector4; - TestMemoryAllocator allocator = new TestMemoryAllocator(); + TestMemoryAllocator allocator = new(); allocator.EnableNonThreadSafeLogging(); configuration.MemoryAllocator = allocator; configuration.WorkingBufferSizeHintInBytes = workingBufferSizeHintInBytes; @@ -211,7 +213,7 @@ public class ResizeTests provider.RunValidatingProcessorTest( x => { - ResizeOptions resizeOptions = new ResizeOptions() + ResizeOptions resizeOptions = new() { Size = x.GetCurrentSize() / 2, Mode = ResizeMode.Crop, @@ -242,9 +244,7 @@ public class ResizeTests [WithTestPatternImages(50, 50, CommonNonDefaultPixelTypes)] public void Resize_IsNotBoundToSinglePixelType(TestImageProvider provider) where TPixel : unmanaged, IPixel - { - provider.RunValidatingProcessorTest(x => x.Resize(x.GetCurrentSize() / 2), comparer: ValidatorComparer); - } + => provider.RunValidatingProcessorTest(x => x.Resize(x.GetCurrentSize() / 2), comparer: ValidatorComparer); [Theory] [WithFileCollection(nameof(CommonTestImages), PixelTypes.Rgba32)] @@ -257,7 +257,7 @@ public class ResizeTests using Image image1 = Image.WrapMemory(mmg.Memory, image0.Width, image0.Height); Assert.ThrowsAny( - () => { image1.Mutate(x => x.Resize(image0.Width / 2, image0.Height / 2, true)); }); + () => image1.Mutate(x => x.Resize(image0.Width / 2, image0.Height / 2, true))); } [Theory] @@ -365,12 +365,12 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - Rectangle sourceRectangle = new Rectangle( + Rectangle sourceRectangle = new( image.Width / 8, image.Height / 8, image.Width / 4, image.Height / 4); - Rectangle destRectangle = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2); + Rectangle destRectangle = new(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2); image.Mutate( x => x.Resize( @@ -437,7 +437,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions + ResizeOptions options = new() { Size = new Size(image.Width + 200, image.Height + 200), Mode = ResizeMode.BoxPad, @@ -456,7 +456,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions { Size = new Size(image.Width, image.Height / 2) }; + ResizeOptions options = new() { Size = new Size(image.Width, image.Height / 2) }; image.Mutate(x => x.Resize(options)); @@ -470,7 +470,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions { Size = new Size(image.Width / 2, image.Height) }; + ResizeOptions options = new() { Size = new Size(image.Width / 2, image.Height) }; image.Mutate(x => x.Resize(options)); @@ -484,7 +484,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions + ResizeOptions options = new() { Size = new Size(480, 600), Mode = ResizeMode.Crop @@ -502,7 +502,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions { Size = new Size(300, 300), Mode = ResizeMode.Max }; + ResizeOptions options = new() { Size = new Size(300, 300), Mode = ResizeMode.Max }; image.Mutate(x => x.Resize(options)); @@ -516,7 +516,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions + ResizeOptions options = new() { Size = new Size((int)Math.Round(image.Width * .75F), (int)Math.Round(image.Height * .95F)), Mode = ResizeMode.Min @@ -534,7 +534,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions + ResizeOptions options = new() { Size = new Size(image.Width + 200, image.Height), Mode = ResizeMode.Pad, @@ -553,7 +553,7 @@ public class ResizeTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - ResizeOptions options = new ResizeOptions + ResizeOptions options = new() { Size = new Size(image.Width / 2, image.Height), Mode = ResizeMode.Stretch @@ -579,6 +579,7 @@ public class ResizeTests } using Image image = provider.GetImage(); + // Don't bother saving, we're testing the EXIF metadata updates. image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2)); } @@ -586,8 +587,8 @@ public class ResizeTests [Fact] public void Issue1195() { - using Image image = new Image(2, 300); - Size size = new Size(50, 50); + using Image image = new(2, 300); + Size size = new(50, 50); image.Mutate(x => x .Resize( new ResizeOptions @@ -605,8 +606,8 @@ public class ResizeTests [InlineData(3, 7)] public void Issue1342(int width, int height) { - using Image image = new Image(1, 1); - Size size = new Size(width, height); + using Image image = new(1, 1); + Size size = new(width, height); image.Mutate(x => x .Resize( new ResizeOptions @@ -630,4 +631,28 @@ public class ResizeTests appendPixelTypeToFileName: false, appendSourceFileOrDescription: false); } + + [Theory] + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] + public void ResizeUpdatesSubject(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectLocation, [5, 15]); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectArea, [5, 15, 20, 20]); + + image.Mutate(ctx => ctx.Resize(new Size(image.Width / 2, image.Height / 2))); + + // The transform operates in pixel space, so the resulting values correspond to the + // scaled pixel centers, producing whole-number coordinates after resizing. + Assert.Equal( + [2, 7], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectLocation).Value); + + Assert.Equal( + [2, 7, 10, 10], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectArea).Value); + } } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs index 55d26974a..523fd2bdd 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs @@ -9,11 +9,11 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; [Trait("Category", "Processors")] public class RotateFlipTests { - public static readonly string[] FlipFiles = { TestImages.Bmp.F }; + public static readonly string[] FlipFiles = [TestImages.Bmp.F]; public static readonly TheoryData RotateFlipValues - = new TheoryData - { + = new() + { { RotateMode.None, FlipMode.Vertical }, { RotateMode.None, FlipMode.Horizontal }, { RotateMode.Rotate90, FlipMode.None }, diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs index b150da1d8..5eee7313d 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs @@ -1,8 +1,10 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Metadata.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Tests.TestUtilities; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; @@ -11,35 +13,59 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; public class RotateTests { public static readonly TheoryData RotateAngles - = new TheoryData - { - 50, -50, 170, -170 - }; + = new() + { + 50, -50, 170, -170 + }; public static readonly TheoryData RotateEnumValues - = new TheoryData - { - RotateMode.None, - RotateMode.Rotate90, - RotateMode.Rotate180, - RotateMode.Rotate270 - }; + = new() + { + RotateMode.None, + RotateMode.Rotate90, + RotateMode.Rotate180, + RotateMode.Rotate270 + }; [Theory] [WithTestPatternImages(nameof(RotateAngles), 100, 50, PixelTypes.Rgba32)] [WithTestPatternImages(nameof(RotateAngles), 50, 100, PixelTypes.Rgba32)] public void Rotate_WithAngle(TestImageProvider provider, float value) where TPixel : unmanaged, IPixel - { - provider.RunValidatingProcessorTest(ctx => ctx.Rotate(value), value, appendPixelTypeToFileName: false); - } + => provider.RunValidatingProcessorTest(ctx => ctx.Rotate(value), value, appendPixelTypeToFileName: false); [Theory] [WithTestPatternImages(nameof(RotateEnumValues), 100, 50, PixelTypes.Rgba32)] [WithTestPatternImages(nameof(RotateEnumValues), 50, 100, PixelTypes.Rgba32)] public void Rotate_WithRotateTypeEnum(TestImageProvider provider, RotateMode value) where TPixel : unmanaged, IPixel + => provider.RunValidatingProcessorTest(ctx => ctx.Rotate(value), value, appendPixelTypeToFileName: false); + + [Theory] + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] + public void RotateUpdatesSubject(TestImageProvider provider) + where TPixel : unmanaged, IPixel { - provider.RunValidatingProcessorTest(ctx => ctx.Rotate(value), value, appendPixelTypeToFileName: false); + using Image image = provider.GetImage(); + + image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectLocation, [5, 15]); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectArea, [5, 15, 50, 50]); + + image.Mutate(ctx => ctx.Rotate(180)); + + // A 180-degree rotation inverts both axes around the image center. + // The subject location (5, 15) becomes (imageWidth - 5, imageHeight - 15) = (95, 85) + Assert.Equal( + [95, 85], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectLocation).Value); + + // The subject area is also mirrored around the center. + // New X = imageWidth - originalX - width + // New Y = imageHeight - originalY - height + // (5, 15, 50, 50) becomes (45, 35, 50, 50) + Assert.Equal( + [45, 35, 50, 50], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectArea).Value); } } diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs index 1e217ae24..84401e846 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTests.cs @@ -14,9 +14,9 @@ public class SkewTests { private const PixelTypes CommonPixelTypes = PixelTypes.Bgra32 | PixelTypes.Rgb24; - public static readonly string[] ResamplerNames = new[] - { - nameof(KnownResamplers.Bicubic), + public static readonly string[] ResamplerNames = + [ + nameof(KnownResamplers.Bicubic), nameof(KnownResamplers.Box), nameof(KnownResamplers.CatmullRom), nameof(KnownResamplers.Hermite), @@ -30,11 +30,11 @@ public class SkewTests nameof(KnownResamplers.RobidouxSharp), nameof(KnownResamplers.Spline), nameof(KnownResamplers.Triangle), - nameof(KnownResamplers.Welch), - }; + nameof(KnownResamplers.Welch) + ]; - public static readonly TheoryData SkewValues = new TheoryData - { + public static readonly TheoryData SkewValues = new() + { { 20, 10 }, { -20, -10 } }; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs index de02502e2..33e22d364 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SwizzleTests.cs @@ -1,9 +1,11 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using SixLabors.ImageSharp.Metadata.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Processors.Transforms; +using SixLabors.ImageSharp.Tests.TestUtilities; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; @@ -12,17 +14,14 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms; [GroupOutput("Transforms")] public class SwizzleTests { - private struct InvertXAndYSwizzler : ISwizzler + private readonly struct SwapXAndYSwizzler : ISwizzler { - public InvertXAndYSwizzler(Size sourceSize) - { - this.DestinationSize = new Size(sourceSize.Height, sourceSize.Width); - } + public SwapXAndYSwizzler(Size sourceSize) + => this.DestinationSize = new Size(sourceSize.Height, sourceSize.Width); public Size DestinationSize { get; } - public Point Transform(Point point) - => new Point(point.Y, point.X); + public Point Transform(Point point) => new(point.Y, point.X); } [Theory] @@ -35,15 +34,15 @@ public class SwizzleTests using Image expectedImage = provider.GetImage(); using Image image = provider.GetImage(); - image.Mutate(ctx => ctx.Swizzle(new InvertXAndYSwizzler(new Size(image.Width, image.Height)))); + image.Mutate(ctx => ctx.Swizzle(new SwapXAndYSwizzler(new Size(image.Width, image.Height)))); image.DebugSave( provider, - nameof(InvertXAndYSwizzler), + nameof(SwapXAndYSwizzler), appendPixelTypeToFileName: false, appendSourceFileOrDescription: true); - image.Mutate(ctx => ctx.Swizzle(new InvertXAndYSwizzler(new Size(image.Width, image.Height)))); + image.Mutate(ctx => ctx.Swizzle(new SwapXAndYSwizzler(new Size(image.Width, image.Height)))); image.DebugSave( provider, @@ -53,4 +52,26 @@ public class SwizzleTests ImageComparer.Exact.VerifySimilarity(expectedImage, image); } + + [Theory] + [WithTestPatternImages(100, 100, PixelTypes.Rgba32)] + public void SwizzleUpdatesSubject(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(); + + image.Metadata.ExifProfile = new(); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectLocation, [5, 15]); + image.Metadata.ExifProfile.SetValue(ExifTag.SubjectArea, [5, 15, 20, 20]); + + image.Mutate(ctx => ctx.Swizzle(new SwapXAndYSwizzler(new Size(image.Width, image.Height)))); + + Assert.Equal( + [15, 5], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectLocation).Value); + + Assert.Equal( + [15, 5, 20, 20], + image.Metadata.ExifProfile.GetValue(ExifTag.SubjectArea).Value); + } } diff --git a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs index 4b1ca92dd..232571d4d 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformBuilderTests.cs @@ -8,8 +8,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms; public class AffineTransformBuilderTests : TransformBuilderTestBase { - protected override AffineTransformBuilder CreateBuilder() - => new AffineTransformBuilder(); + protected override AffineTransformBuilder CreateBuilder() => new(); protected override void AppendRotationDegrees(AffineTransformBuilder builder, float degrees) => builder.AppendRotationDegrees(degrees); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs index 30c89ec33..c56df3152 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs @@ -25,7 +25,7 @@ public class CropTest : BaseImageOperationsExtensionTest [InlineData(12, 123, 6, 2)] public void CropRectangleCropProcessorWithRectangleSet(int x, int y, int width, int height) { - var cropRectangle = new Rectangle(x, y, width, height); + Rectangle cropRectangle = new(x, y, width, height); this.operations.Crop(cropRectangle); CropProcessor processor = this.Verify(); @@ -35,7 +35,7 @@ public class CropTest : BaseImageOperationsExtensionTest [Fact] public void CropRectangleWithInvalidBoundsThrowsException() { - var cropRectangle = Rectangle.Inflate(this.SourceBounds(), 5, 5); + Rectangle cropRectangle = Rectangle.Inflate(this.SourceBounds(), 5, 5); Assert.Throws(() => this.operations.Crop(cropRectangle)); } } diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs index 7d0c0dc58..a0380033f 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformBuilderTests.cs @@ -9,8 +9,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms; [Trait("Category", "Processors")] public class ProjectiveTransformBuilderTests : TransformBuilderTestBase { - protected override ProjectiveTransformBuilder CreateBuilder() - => new ProjectiveTransformBuilder(); + protected override ProjectiveTransformBuilder CreateBuilder() => new(); protected override void AppendRotationDegrees(ProjectiveTransformBuilder builder, float degrees) => builder.AppendRotationDegrees(degrees); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs index f6c93ffd0..3f2d8e059 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs @@ -64,7 +64,7 @@ public class ResizeTests : BaseImageOperationsExtensionTest bool compand = true; ResizeMode mode = ResizeMode.Stretch; - var resizeOptions = new ResizeOptions + ResizeOptions resizeOptions = new() { Size = new Size(width, height), Sampler = sampler, @@ -93,7 +93,7 @@ public class ResizeTests : BaseImageOperationsExtensionTest { static void RunTest() { - using var image = new Image(50, 50); + using Image image = new(50, 50); image.Mutate(img => img.Resize(25, 25)); Assert.Equal(25, image.Width); @@ -102,6 +102,6 @@ public class ResizeTests : BaseImageOperationsExtensionTest FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, - HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableFMA); + HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2); } } diff --git a/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs index 432bb5cac..8475ce5ab 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/SwizzleTests.cs @@ -18,8 +18,7 @@ public class SwizzleTests : BaseImageOperationsExtensionTest public Size DestinationSize { get; } - public Point Transform(Point point) - => new Point(point.Y, point.X); + public Point Transform(Point point) => new(point.Y, point.X); } [Fact] diff --git a/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs b/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs index f046c2503..73215b1c6 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/TransformBuilderTestBase.cs @@ -10,11 +10,11 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms; [Trait("Category", "Processors")] public abstract class TransformBuilderTestBase { - private static readonly ApproximateFloatComparer Comparer = new ApproximateFloatComparer(1e-6f); + private static readonly ApproximateFloatComparer Comparer = new(1e-6f); public static readonly TheoryData ScaleTranslate_Data = - new TheoryData - { + new() + { // scale, translate, source, expectedDest { Vector2.One, Vector2.Zero, Vector2.Zero, Vector2.Zero }, { Vector2.One, Vector2.Zero, new Vector2(10, 20), new Vector2(10, 20) }, @@ -29,7 +29,7 @@ public abstract class TransformBuilderTestBase #pragma warning restore SA1300 // Element should begin with upper-case letter { // These operations should be size-agnostic: - var size = new Size(123, 321); + Size size = new(123, 321); TBuilder builder = this.CreateBuilder(); this.AppendScale(builder, new SizeF(scale)); @@ -40,8 +40,8 @@ public abstract class TransformBuilderTestBase } public static readonly TheoryData TranslateScale_Data = - new TheoryData - { + new() + { // translate, scale, source, expectedDest { Vector2.Zero, Vector2.One, Vector2.Zero, Vector2.Zero }, { Vector2.Zero, Vector2.One, new Vector2(10, 20), new Vector2(10, 20) }, @@ -55,7 +55,7 @@ public abstract class TransformBuilderTestBase #pragma warning restore SA1300 // Element should begin with upper-case letter { // Translate ans scale are size-agnostic: - var size = new Size(456, 432); + Size size = new(456, 432); TBuilder builder = this.CreateBuilder(); this.AppendTranslation(builder, translate); @@ -70,7 +70,7 @@ public abstract class TransformBuilderTestBase [InlineData(-20, 10)] public void LocationOffsetIsPrepended(int locationX, int locationY) { - var rectangle = new Rectangle(locationX, locationY, 10, 10); + Rectangle rectangle = new(locationX, locationY, 10, 10); TBuilder builder = this.CreateBuilder(); this.AppendScale(builder, new SizeF(2, 2)); @@ -92,16 +92,16 @@ public abstract class TransformBuilderTestBase float x, float y) { - var size = new Size(width, height); + Size size = new(width, height); TBuilder builder = this.CreateBuilder(); this.AppendRotationDegrees(builder, degrees); // TODO: We should also test CreateRotationMatrixDegrees() (and all TransformUtils stuff!) for correctness - Matrix3x2 matrix = TransformUtils.CreateRotationTransformMatrixDegrees(degrees, size, TransformSpace.Pixel); + Matrix3x2 matrix = TransformUtilities.CreateRotationTransformMatrixDegrees(degrees, size); - var position = new Vector2(x, y); - var expected = Vector2.Transform(position, matrix); + Vector2 position = new(x, y); + Vector2 expected = Vector2.Transform(position, matrix); Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); @@ -120,16 +120,16 @@ public abstract class TransformBuilderTestBase float x, float y) { - var size = new Size(width, height); + Size size = new(width, height); TBuilder builder = this.CreateBuilder(); - var centerPoint = new Vector2(cx, cy); + Vector2 centerPoint = new(cx, cy); this.AppendRotationDegrees(builder, degrees, centerPoint); - var matrix = Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees), centerPoint); + Matrix3x2 matrix = Matrix3x2.CreateRotation(GeometryUtilities.DegreeToRadian(degrees), centerPoint); - var position = new Vector2(x, y); - var expected = Vector2.Transform(position, matrix); + Vector2 position = new(x, y); + Vector2 expected = Vector2.Transform(position, matrix); Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); @@ -147,15 +147,15 @@ public abstract class TransformBuilderTestBase float x, float y) { - var size = new Size(width, height); + Size size = new(width, height); TBuilder builder = this.CreateBuilder(); this.AppendSkewDegrees(builder, degreesX, degreesY); - Matrix3x2 matrix = TransformUtils.CreateSkewTransformMatrixDegrees(degreesX, degreesY, size, TransformSpace.Pixel); + Matrix3x2 matrix = TransformUtilities.CreateSkewTransformMatrixDegrees(degreesX, degreesY, size); - var position = new Vector2(x, y); - var expected = Vector2.Transform(position, matrix); + Vector2 position = new(x, y); + Vector2 expected = Vector2.Transform(position, matrix); Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); } @@ -174,16 +174,16 @@ public abstract class TransformBuilderTestBase float x, float y) { - var size = new Size(width, height); + Size size = new(width, height); TBuilder builder = this.CreateBuilder(); - var centerPoint = new Vector2(cx, cy); + Vector2 centerPoint = new(cx, cy); this.AppendSkewDegrees(builder, degreesX, degreesY, centerPoint); - var matrix = Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY), centerPoint); + Matrix3x2 matrix = Matrix3x2.CreateSkew(GeometryUtilities.DegreeToRadian(degreesX), GeometryUtilities.DegreeToRadian(degreesY), centerPoint); - var position = new Vector2(x, y); - var expected = Vector2.Transform(position, matrix); + Vector2 position = new(x, y); + Vector2 expected = Vector2.Transform(position, matrix); Vector2 actual = this.Execute(builder, new Rectangle(Point.Empty, size), position); Assert.Equal(actual, expected, Comparer); @@ -192,7 +192,7 @@ public abstract class TransformBuilderTestBase [Fact] public void AppendPrependOpposite() { - var rectangle = new Rectangle(-1, -1, 3, 3); + Rectangle rectangle = new(-1, -1, 3, 3); TBuilder b1 = this.CreateBuilder(); TBuilder b2 = this.CreateBuilder(); @@ -226,7 +226,7 @@ public abstract class TransformBuilderTestBase [InlineData(-1, 0)] public void ThrowsForInvalidSizes(int width, int height) { - var size = new Size(width, height); + Size size = new(width, height); Assert.ThrowsAny( () => diff --git a/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs b/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs index a1d7e358b..209dd361e 100644 --- a/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/ProfilingBenchmarks/LoadResizeSaveProfilingBenchmarks.cs @@ -18,7 +18,7 @@ public class LoadResizeSaveProfilingBenchmarks : MeasureFixture [InlineData(TestImages.Jpeg.Baseline.Jpeg420Exif)] public void LoadResizeSave(string imagePath) { - var configuration = Configuration.CreateDefaultInstance(); + Configuration configuration = Configuration.CreateDefaultInstance(); configuration.MaxDegreeOfParallelism = 1; DecoderOptions options = new() @@ -28,12 +28,12 @@ public class LoadResizeSaveProfilingBenchmarks : MeasureFixture byte[] imageBytes = TestFile.Create(imagePath).Bytes; - using var ms = new MemoryStream(); + using MemoryStream ms = new(); this.Measure( 30, () => { - using (var image = Image.Load(options, imageBytes)) + using (Image image = Image.Load(options, imageBytes)) { image.Mutate(x => x.Resize(image.Size / 4)); image.SaveAsJpeg(ms); diff --git a/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs b/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs index f20ca8ce1..bab11b0f9 100644 --- a/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/ProfilingBenchmarks/ResizeProfilingBenchmarks.cs @@ -28,7 +28,7 @@ public class ResizeProfilingBenchmarks : MeasureFixture this.ExecutionCount, () => { - using (var image = new Image(this.configuration, width, height)) + using (Image image = new(this.configuration, width, height)) { image.Mutate(x => x.Resize(width / 5, height / 5)); } diff --git a/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs b/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs index b59542482..d832136a9 100644 --- a/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs +++ b/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs @@ -53,7 +53,6 @@ public class QuantizedImageTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - Assert.True(image[0, 0].Equals(default)); QuantizerOptions options = new(); if (!dither) @@ -79,7 +78,6 @@ public class QuantizedImageTests where TPixel : unmanaged, IPixel { using Image image = provider.GetImage(); - Assert.True(image[0, 0].Equals(default)); QuantizerOptions options = new(); if (!dither) @@ -106,7 +104,7 @@ public class QuantizedImageTests { using Image image = provider.GetImage(); OctreeQuantizer octreeQuantizer = new(); - IQuantizer quantizer = octreeQuantizer.CreatePixelSpecificQuantizer(Configuration.Default, new QuantizerOptions() { MaxColors = 128 }); + IQuantizer quantizer = octreeQuantizer.CreatePixelSpecificQuantizer(Configuration.Default, new QuantizerOptions { MaxColors = 128 }); ImageFrame frame = image.Frames[0]; quantizer.BuildPaletteAndQuantizeFrame(frame, frame.Bounds); } diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLut.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLut.cs index e910038ef..e3bc3bba6 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLut.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLut.cs @@ -5,26 +5,26 @@ namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion; public class IccConversionDataLut { - private static readonly float[] LutEven = { 0, 0.5f, 1 }; + private static readonly float[] LutEven = [0, 0.5f, 1]; - private static readonly float[] LutUneven = { 0, 0.7f, 1 }; + private static readonly float[] LutUneven = [0, 0.7f, 1]; public static object[][] LutConversionTestData = - { - new object[] { LutEven, false, 0.5f, 0.5f }, - new object[] { LutEven, false, 0.25f, 0.25f }, - new object[] { LutEven, false, 0.75f, 0.75f }, + [ + [LutEven, false, 0.5f, 0.5f], + [LutEven, false, 0.25f, 0.25f], + [LutEven, false, 0.75f, 0.75f], - new object[] { LutEven, true, 0.5f, 0.5f }, - new object[] { LutEven, true, 0.25f, 0.25f }, - new object[] { LutEven, true, 0.75f, 0.75f }, + [LutEven, true, 0.5f, 0.5f], + [LutEven, true, 0.25f, 0.25f], + [LutEven, true, 0.75f, 0.75f], - new object[] { LutUneven, false, 0.1, 0.14 }, - new object[] { LutUneven, false, 0.5, 0.7 }, - new object[] { LutUneven, false, 0.75, 0.85 }, + [LutUneven, false, 0.1, 0.14], + [LutUneven, false, 0.5, 0.7], + [LutUneven, false, 0.75, 0.85], - new object[] { LutUneven, true, 0.14, 0.1 }, - new object[] { LutUneven, true, 0.7, 0.5 }, - new object[] { LutUneven, true, 0.85, 0.75 }, - }; + [LutUneven, true, 0.14, 0.1], + [LutUneven, true, 0.7, 0.5], + [LutUneven, true, 0.85, 0.75] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutAB.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutAB.cs index 02fc23735..f38bc68d1 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutAB.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutAB.cs @@ -9,12 +9,11 @@ namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion; public class IccConversionDataLutAB { private static readonly IccLutAToBTagDataEntry LutAtoBSingleCurve = new( - new IccTagDataEntry[] - { - IccConversionDataTrc.IdentityCurve, + [ + IccConversionDataTrc.IdentityCurve, IccConversionDataTrc.IdentityCurve, IccConversionDataTrc.IdentityCurve - }, + ], null, null, null, @@ -26,12 +25,11 @@ public class IccConversionDataLutAB // # CurveA + CLUT + CurveB // # CurveA + CLUT + CurveM + Matrix + CurveB private static readonly IccLutBToATagDataEntry LutBtoASingleCurve = new( - new IccTagDataEntry[] - { - IccConversionDataTrc.IdentityCurve, + [ + IccConversionDataTrc.IdentityCurve, IccConversionDataTrc.IdentityCurve, IccConversionDataTrc.IdentityCurve - }, + ], null, null, null, @@ -39,12 +37,12 @@ public class IccConversionDataLutAB null); public static object[][] LutAToBConversionTestData = - { - new object[] { LutAtoBSingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0) }, - }; + [ + [LutAtoBSingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0)] + ]; public static object[][] LutBToAConversionTestData = - { - new object[] { LutBtoASingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0) }, - }; + [ + [LutBtoASingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0)] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMatrix.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMatrix.cs index f91c32df8..5f1417461 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMatrix.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMatrix.cs @@ -24,14 +24,20 @@ public class IccConversionDataMatrix }; public static object[][] MatrixConversionTestData = - { - new object[] { CreateMatrix(Matrix3x3Identity), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.5f, 0.5f, 0.5f, 0) }, - new object[] { CreateMatrix(Matrix3x3Identity), new Vector3(0.2f, 0.2f, 0.2f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.7f, 0.7f, 0) }, - new object[] { CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.6f, 0.75f, 0.9f, 0) }, - new object[] { CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.95f, 1.2f, 0) }, - new object[] { CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.67f, 0.8f, 0.93f, 0) }, - new object[] { CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.77f, 1, 1.23f, 0) }, - }; + [ + [CreateMatrix(Matrix3x3Identity), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.5f, 0.5f, 0.5f, 0) + ], + [CreateMatrix(Matrix3x3Identity), new Vector3(0.2f, 0.2f, 0.2f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.7f, 0.7f, 0) + ], + [CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.6f, 0.75f, 0.9f, 0) + ], + [CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.95f, 1.2f, 0) + ], + [CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.67f, 0.8f, 0.93f, 0) + ], + [CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.77f, 1, 1.23f, 0) + ] + ]; private static Matrix4x4 CreateMatrix(float[,] matrix) => new( matrix[0, 0], diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs index e4adba078..f79666e3e 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs @@ -48,13 +48,13 @@ public class IccConversionDataMultiProcessElement private static IccCurveSetProcessElement Create1DSingleCurveSet(IccCurveSegment segment) { - var curve = new IccOneDimensionalCurve(new float[0], new[] { segment }); + IccOneDimensionalCurve curve = new(new float[0], new[] { segment }); return new IccCurveSetProcessElement(new[] { curve }); } private static IccCurveSetProcessElement Create1DMultiCurveSet(float[] breakPoints, params IccCurveSegment[] segments) { - var curve = new IccOneDimensionalCurve(breakPoints, segments); + IccOneDimensionalCurve curve = new(breakPoints, segments); return new IccCurveSetProcessElement(new[] { curve }); } diff --git a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs index 6cd99367a..d0ba39e4c 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs @@ -10,7 +10,7 @@ public static class IccConversionDataTrc { internal static IccCurveTagDataEntry IdentityCurve = new(); internal static IccCurveTagDataEntry Gamma2Curve = new(2); - internal static IccCurveTagDataEntry LutCurve = new(new float[] { 0, 0.7f, 1 }); + internal static IccCurveTagDataEntry LutCurve = new([0, 0.7f, 1]); internal static IccParametricCurveTagDataEntry ParamCurve1 = new(new IccParametricCurve(2.2f)); internal static IccParametricCurveTagDataEntry ParamCurve2 = new(new IccParametricCurve(2.2f, 1.5f, -0.5f)); @@ -19,58 +19,56 @@ public static class IccConversionDataTrc internal static IccParametricCurveTagDataEntry ParamCurve5 = new(new IccParametricCurve(2.2f, 0.7f, 0.2f, 0.3f, 0.1f, 0.5f, 0.2f)); public static object[][] TrcArrayConversionTestData { get; } = - { - new object[] - { + [ + [ new IccTagDataEntry[] { IdentityCurve, Gamma2Curve, ParamCurve1 }, false, new Vector4(2, 2, 0.5f, 0), - new Vector4(2, 4, 0.217637628f, 0), - }, - new object[] - { + new Vector4(2, 4, 0.217637628f, 0) + ], + [ new IccTagDataEntry[] { IdentityCurve, Gamma2Curve, ParamCurve1 }, true, new Vector4(1, 4, 0.217637628f, 0), - new Vector4(1, 2, 0.5f, 0), - }, - }; + new Vector4(1, 2, 0.5f, 0) + ] + ]; public static object[][] CurveConversionTestData { get; } = - { - new object[] { IdentityCurve, false, 2, 2 }, - new object[] { Gamma2Curve, false, 2, 4 }, - new object[] { LutCurve, false, 0.1, 0.14 }, - new object[] { LutCurve, false, 0.5, 0.7 }, - new object[] { LutCurve, false, 0.75, 0.85 }, + [ + [IdentityCurve, false, 2, 2], + [Gamma2Curve, false, 2, 4], + [LutCurve, false, 0.1, 0.14], + [LutCurve, false, 0.5, 0.7], + [LutCurve, false, 0.75, 0.85], - new object[] { IdentityCurve, true, 2, 2 }, - new object[] { Gamma2Curve, true, 4, 2 }, - new object[] { LutCurve, true, 0.14, 0.1 }, - new object[] { LutCurve, true, 0.7, 0.5 }, - new object[] { LutCurve, true, 0.85, 0.75 }, - }; + [IdentityCurve, true, 2, 2], + [Gamma2Curve, true, 4, 2], + [LutCurve, true, 0.14, 0.1], + [LutCurve, true, 0.7, 0.5], + [LutCurve, true, 0.85, 0.75] + ]; public static object[][] ParametricCurveConversionTestData { get; } = - { - new object[] { ParamCurve1, false, 0.5f, 0.217637628f }, - new object[] { ParamCurve2, false, 0.6f, 0.133208528f }, - new object[] { ParamCurve2, false, 0.21f, 0 }, - new object[] { ParamCurve3, false, 0.61f, 0.444446117f }, - new object[] { ParamCurve3, false, 0.22f, 0.3f }, - new object[] { ParamCurve4, false, 0.3f, 0.0732389539f }, - new object[] { ParamCurve4, false, 0.03f, 0.00232198136f }, - new object[] { ParamCurve5, false, 0.2f, 0.593165159f }, - new object[] { ParamCurve5, false, 0.05f, 0.215f }, + [ + [ParamCurve1, false, 0.5f, 0.217637628f], + [ParamCurve2, false, 0.6f, 0.133208528f], + [ParamCurve2, false, 0.21f, 0], + [ParamCurve3, false, 0.61f, 0.444446117f], + [ParamCurve3, false, 0.22f, 0.3f], + [ParamCurve4, false, 0.3f, 0.0732389539f], + [ParamCurve4, false, 0.03f, 0.00232198136f], + [ParamCurve5, false, 0.2f, 0.593165159f], + [ParamCurve5, false, 0.05f, 0.215f], - new object[] { ParamCurve1, true, 0.217637628f, 0.5f }, - new object[] { ParamCurve2, true, 0.133208528f, 0.6f }, - new object[] { ParamCurve2, true, 0, 1 / 3f }, - new object[] { ParamCurve3, true, 0.444446117f, 0.61f }, - new object[] { ParamCurve3, true, 0.3f, 1 / 3f }, - new object[] { ParamCurve4, true, 0.0732389539f, 0.3f }, - new object[] { ParamCurve4, true, 0.00232198136f, 0.03f }, - new object[] { ParamCurve5, true, 0.593165159f, 0.2f }, - new object[] { ParamCurve5, true, 0.215f, 0.05f }, - }; + [ParamCurve1, true, 0.217637628f, 0.5f], + [ParamCurve2, true, 0.133208528f, 0.6f], + [ParamCurve2, true, 0, 1 / 3f], + [ParamCurve3, true, 0.444446117f, 0.61f], + [ParamCurve3, true, 0.3f, 1 / 3f], + [ParamCurve4, true, 0.0732389539f, 0.3f], + [ParamCurve4, true, 0.00232198136f, 0.03f], + [ParamCurve5, true, 0.593165159f, 0.2f], + [ParamCurve5, true, 0.215f, 0.05f] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataArray.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataArray.cs index cedd20f2d..379964181 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataArray.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataArray.cs @@ -5,14 +5,14 @@ namespace SixLabors.ImageSharp.Tests.TestDataIcc; internal static class IccTestDataArray { - public static readonly byte[] UInt8 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static readonly byte[] UInt8 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; public static readonly object[][] UInt8TestData = - { - new object[] { UInt8, UInt8 } - }; + [ + [UInt8, UInt8] + ]; - public static readonly ushort[] UInt16Val = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static readonly ushort[] UInt16Val = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; public static readonly byte[] UInt16Arr = ArrayHelper.Concat( IccTestDataPrimitives.UInt160, @@ -27,11 +27,11 @@ internal static class IccTestDataArray IccTestDataPrimitives.UInt169); public static readonly object[][] UInt16TestData = - { - new object[] { UInt16Arr, UInt16Val } - }; + [ + [UInt16Arr, UInt16Val] + ]; - public static readonly short[] Int16Val = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static readonly short[] Int16Val = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; public static readonly byte[] Int16Arr = ArrayHelper.Concat( IccTestDataPrimitives.Int160, @@ -46,11 +46,11 @@ internal static class IccTestDataArray IccTestDataPrimitives.Int169); public static readonly object[][] Int16TestData = - { - new object[] { Int16Arr, Int16Val } - }; + [ + [Int16Arr, Int16Val] + ]; - public static readonly uint[] UInt32Val = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static readonly uint[] UInt32Val = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; public static readonly byte[] UInt32Arr = ArrayHelper.Concat( IccTestDataPrimitives.UInt320, @@ -65,11 +65,11 @@ internal static class IccTestDataArray IccTestDataPrimitives.UInt329); public static readonly object[][] UInt32TestData = - { - new object[] { UInt32Arr, UInt32Val } - }; + [ + [UInt32Arr, UInt32Val] + ]; - public static readonly int[] Int32Val = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static readonly int[] Int32Val = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; public static readonly byte[] Int32Arr = ArrayHelper.Concat( IccTestDataPrimitives.Int320, @@ -84,11 +84,11 @@ internal static class IccTestDataArray IccTestDataPrimitives.Int329); public static readonly object[][] Int32TestData = - { - new object[] { Int32Arr, Int32Val } - }; + [ + [Int32Arr, Int32Val] + ]; - public static readonly ulong[] UInt64Val = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static readonly ulong[] UInt64Val = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; public static readonly byte[] UInt64Arr = ArrayHelper.Concat( IccTestDataPrimitives.UInt640, @@ -103,7 +103,7 @@ internal static class IccTestDataArray IccTestDataPrimitives.UInt649); public static readonly object[][] UInt64TestData = - { - new object[] { UInt64Arr, UInt64Val } - }; + [ + [UInt64Arr, UInt64Val] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataCurves.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataCurves.cs index 6f8244f1c..be0d077b6 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataCurves.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataCurves.cs @@ -12,18 +12,16 @@ internal static class IccTestDataCurves /// public static readonly IccResponseCurve ResponseValGrad = new( IccCurveMeasurementEncodings.StatusA, - new[] - { + [ IccTestDataNonPrimitives.XyzNumberValVar1, IccTestDataNonPrimitives.XyzNumberValVar2, IccTestDataNonPrimitives.XyzNumberValVar3 - }, - new[] - { - new[] { IccTestDataNonPrimitives.ResponseNumberVal1, IccTestDataNonPrimitives.ResponseNumberVal2 }, - new[] { IccTestDataNonPrimitives.ResponseNumberVal3, IccTestDataNonPrimitives.ResponseNumberVal4 }, - new[] { IccTestDataNonPrimitives.ResponseNumberVal5, IccTestDataNonPrimitives.ResponseNumberVal6 }, - }); + ], + [ + [IccTestDataNonPrimitives.ResponseNumberVal1, IccTestDataNonPrimitives.ResponseNumberVal2], + [IccTestDataNonPrimitives.ResponseNumberVal3, IccTestDataNonPrimitives.ResponseNumberVal4], + [IccTestDataNonPrimitives.ResponseNumberVal5, IccTestDataNonPrimitives.ResponseNumberVal6] + ]); /// /// Channels: 3 @@ -44,9 +42,9 @@ internal static class IccTestDataCurves IccTestDataNonPrimitives.ResponseNumber6); public static readonly object[][] ResponseCurveTestData = - { - new object[] { ResponseGrad, ResponseValGrad, 3 }, - }; + [ + [ResponseGrad, ResponseValGrad, 3] + ]; public static readonly IccParametricCurve ParametricValVar1 = new(1); public static readonly IccParametricCurve ParametricValVar2 = new(1, 2, 3); @@ -110,13 +108,13 @@ internal static class IccTestDataCurves IccTestDataPrimitives.Fix167); public static readonly object[][] ParametricCurveTestData = - { - new object[] { ParametricVar1, ParametricValVar1 }, - new object[] { ParametricVar2, ParametricValVar2 }, - new object[] { ParametricVar3, ParametricValVar3 }, - new object[] { ParametricVar4, ParametricValVar4 }, - new object[] { ParametricVar5, ParametricValVar5 }, - }; + [ + [ParametricVar1, ParametricValVar1], + [ParametricVar2, ParametricValVar2], + [ParametricVar3, ParametricValVar3], + [ParametricVar4, ParametricValVar4], + [ParametricVar5, ParametricValVar5] + ]; // Formula Segment public static readonly IccFormulaCurveElement FormulaValVar1 = new(IccFormulaCurveType.Type1, 1, 2, 3, 4, 0, 0); @@ -159,15 +157,15 @@ internal static class IccTestDataCurves IccTestDataPrimitives.Single6); public static readonly object[][] FormulaCurveSegmentTestData = - { - new object[] { FormulaVar1, FormulaValVar1 }, - new object[] { FormulaVar2, FormulaValVar2 }, - new object[] { FormulaVar3, FormulaValVar3 }, - }; + [ + [FormulaVar1, FormulaValVar1], + [FormulaVar2, FormulaValVar2], + [FormulaVar3, FormulaValVar3] + ]; // Sampled Segment - public static readonly IccSampledCurveElement SampledValGrad1 = new(new float[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); - public static readonly IccSampledCurveElement SampledValGrad2 = new(new float[] { 9, 8, 7, 6, 5, 4, 3, 2, 1 }); + public static readonly IccSampledCurveElement SampledValGrad1 = new([1, 2, 3, 4, 5, 6, 7, 8, 9]); + public static readonly IccSampledCurveElement SampledValGrad2 = new([9, 8, 7, 6, 5, 4, 3, 2, 1]); public static readonly byte[] SampledGrad1 = ArrayHelper.Concat( IccTestDataPrimitives.UInt329, @@ -194,10 +192,10 @@ internal static class IccTestDataCurves IccTestDataPrimitives.Single1); public static readonly object[][] SampledCurveSegmentTestData = - { - new object[] { SampledGrad1, SampledValGrad1 }, - new object[] { SampledGrad2, SampledValGrad2 }, - }; + [ + [SampledGrad1, SampledValGrad1], + [SampledGrad2, SampledValGrad2] + ]; public static readonly IccCurveSegment SegmentValFormula1 = FormulaValVar1; public static readonly IccCurveSegment SegmentValFormula2 = FormulaValVar2; @@ -246,25 +244,25 @@ internal static class IccTestDataCurves SampledGrad2); public static readonly object[][] CurveSegmentTestData = - { - new object[] { SegmentFormula1, SegmentValFormula1 }, - new object[] { SegmentFormula2, SegmentValFormula2 }, - new object[] { SegmentFormula3, SegmentValFormula3 }, - new object[] { SegmentSampled1, SegmentValSampled1 }, - new object[] { SegmentSampled2, SegmentValSampled2 }, - }; + [ + [SegmentFormula1, SegmentValFormula1], + [SegmentFormula2, SegmentValFormula2], + [SegmentFormula3, SegmentValFormula3], + [SegmentSampled1, SegmentValSampled1], + [SegmentSampled2, SegmentValSampled2] + ]; public static readonly IccOneDimensionalCurve OneDimensionalValFormula1 = new( - new float[] { 0, 1 }, - new[] { SegmentValFormula1, SegmentValFormula2, SegmentValFormula3 }); + [0, 1], + [SegmentValFormula1, SegmentValFormula2, SegmentValFormula3]); public static readonly IccOneDimensionalCurve OneDimensionalValFormula2 = new( - new float[] { 0, 1 }, - new[] { SegmentValFormula3, SegmentValFormula2, SegmentValFormula1 }); + [0, 1], + [SegmentValFormula3, SegmentValFormula2, SegmentValFormula1]); public static readonly IccOneDimensionalCurve OneDimensionalValSampled = new( - new float[] { 0, 1 }, - new[] { SegmentValSampled1, SegmentValSampled2, SegmentValSampled1 }); + [0, 1], + [SegmentValSampled1, SegmentValSampled2, SegmentValSampled1]); public static readonly byte[] OneDimensionalFormula1 = ArrayHelper.Concat( new byte[] @@ -303,9 +301,9 @@ internal static class IccTestDataCurves SegmentSampled1); public static readonly object[][] OneDimensionalCurveTestData = - { - new object[] { OneDimensionalFormula1, OneDimensionalValFormula1 }, - new object[] { OneDimensionalFormula2, OneDimensionalValFormula2 }, - new object[] { OneDimensionalSampled, OneDimensionalValSampled }, - }; + [ + [OneDimensionalFormula1, OneDimensionalValFormula1], + [OneDimensionalFormula2, OneDimensionalValFormula2], + [OneDimensionalSampled, OneDimensionalValSampled] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs index 2bd47e449..c0404d5f1 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs @@ -33,12 +33,11 @@ internal static class IccTestDataLut } public static readonly object[][] Lut8TestData = - { - new object[] { Lut8Grad, Lut8ValGrad }, - }; + [ + [Lut8Grad, Lut8ValGrad] + ]; - public static readonly IccLut Lut16ValGrad = new(new[] - { + public static readonly IccLut Lut16ValGrad = new([ 1f / ushort.MaxValue, 2f / ushort.MaxValue, 3f / ushort.MaxValue, @@ -50,7 +49,7 @@ internal static class IccTestDataLut 9f / ushort.MaxValue, 32768f / ushort.MaxValue, 1f - }); + ]); public static readonly byte[] Lut16Grad = ArrayHelper.Concat( IccTestDataPrimitives.UInt161, @@ -66,13 +65,12 @@ internal static class IccTestDataLut IccTestDataPrimitives.UInt16Max); public static readonly object[][] Lut16TestData = - { - new object[] { Lut16Grad, Lut16ValGrad, 11 }, - }; + [ + [Lut16Grad, Lut16ValGrad, 11] + ]; public static readonly IccClut Clut8ValGrad = new( - new[] - { + [ 1f / byte.MaxValue, 2f / byte.MaxValue, 3f / byte.MaxValue, 4f / byte.MaxValue, 5f / byte.MaxValue, 6f / byte.MaxValue, 7f / byte.MaxValue, 8f / byte.MaxValue, 9f / byte.MaxValue, @@ -83,9 +81,9 @@ internal static class IccTestDataLut 19f / byte.MaxValue, 20f / byte.MaxValue, 21f / byte.MaxValue, 22f / byte.MaxValue, 23f / byte.MaxValue, 24f / byte.MaxValue, - 25f / byte.MaxValue, 26f / byte.MaxValue, 27f / byte.MaxValue, - }, - new byte[] { 3, 3 }, + 25f / byte.MaxValue, 26f / byte.MaxValue, 27f / byte.MaxValue + ], + [3, 3], IccClutDataType.UInt8, outputChannelCount: 3); @@ -95,7 +93,7 @@ internal static class IccTestDataLut /// Grid-point Count: { 3, 3 } /// public static readonly byte[] Clut8Grad = - { + [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, @@ -106,17 +104,16 @@ internal static class IccTestDataLut 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x19, 0x1A, 0x1B, - }; + 0x19, 0x1A, 0x1B + ]; public static readonly object[][] Clut8TestData = - { - new object[] { Clut8Grad, Clut8ValGrad, 2, 3, new byte[] { 3, 3 } }, - }; + [ + [Clut8Grad, Clut8ValGrad, 2, 3, new byte[] { 3, 3 }] + ]; public static readonly IccClut Clut16ValGrad = new( - new[] - { + [ 1f / ushort.MaxValue, 2f / ushort.MaxValue, 3f / ushort.MaxValue, 4f / ushort.MaxValue, 5f / ushort.MaxValue, 6f / ushort.MaxValue, 7f / ushort.MaxValue, 8f / ushort.MaxValue, 9f / ushort.MaxValue, @@ -127,9 +124,9 @@ internal static class IccTestDataLut 19f / ushort.MaxValue, 20f / ushort.MaxValue, 21f / ushort.MaxValue, 22f / ushort.MaxValue, 23f / ushort.MaxValue, 24f / ushort.MaxValue, - 25f / ushort.MaxValue, 26f / ushort.MaxValue, 27f / ushort.MaxValue, - }, - new byte[] { 3, 3 }, + 25f / ushort.MaxValue, 26f / ushort.MaxValue, 27f / ushort.MaxValue + ], + [3, 3], IccClutDataType.UInt16, outputChannelCount: 3); @@ -139,7 +136,7 @@ internal static class IccTestDataLut /// Grid-point Count: { 3, 3 } /// public static readonly byte[] Clut16Grad = - { + [ 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08, 0x00, 0x09, @@ -150,17 +147,16 @@ internal static class IccTestDataLut 0x00, 0x13, 0x00, 0x14, 0x00, 0x15, 0x00, 0x16, 0x00, 0x17, 0x00, 0x18, - 0x00, 0x19, 0x00, 0x1A, 0x00, 0x1B, - }; + 0x00, 0x19, 0x00, 0x1A, 0x00, 0x1B + ]; public static readonly object[][] Clut16TestData = - { - new object[] { Clut16Grad, Clut16ValGrad, 2, 3, new byte[] { 3, 3 } }, - }; + [ + [Clut16Grad, Clut16ValGrad, 2, 3, new byte[] { 3, 3 }] + ]; public static readonly IccClut CluTf32ValGrad = new( - new[] - { + [ 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, @@ -171,9 +167,9 @@ internal static class IccTestDataLut 1f, 2f, 3f, 4f, 5f, 6f, - 7f, 8f, 9f, - }, - new byte[] { 3, 3 }, + 7f, 8f, 9f + ], + [3, 3], IccClutDataType.Float, outputChannelCount: 3); @@ -212,9 +208,9 @@ internal static class IccTestDataLut IccTestDataPrimitives.Single9); public static readonly object[][] ClutF32TestData = - { - new object[] { CluTf32Grad, CluTf32ValGrad, 2, 3, new byte[] { 3, 3 } }, - }; + [ + [CluTf32Grad, CluTf32ValGrad, 2, 3, new byte[] { 3, 3 }] + ]; public static readonly IccClut ClutVal8 = Clut8ValGrad; public static readonly IccClut ClutVal16 = Clut16ValGrad; @@ -235,9 +231,9 @@ internal static class IccTestDataLut CluTf32Grad); public static readonly object[][] ClutTestData = - { - new object[] { Clut8, ClutVal8, 2, 3, false }, - new object[] { Clut16, ClutVal16, 2, 3, false }, - new object[] { ClutF32, ClutValf32, 2, 3, true }, - }; + [ + [Clut8, ClutVal8, 2, 3, false], + [Clut16, ClutVal16, 2, 3, false], + [ClutF32, ClutValf32, 2, 3, true] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs index 1a72d39b1..6a900a015 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs @@ -90,30 +90,30 @@ internal static class IccTestDataMatrix IccTestDataPrimitives.Single9); public static readonly object[][] Matrix2DFloatArrayTestData = - { - new object[] { Fix162DGrad, 3, 3, false, Single2DArrayValGrad }, - new object[] { Fix162DIdentity, 3, 3, false, Single2DArrayValIdentity }, - new object[] { Single2DGrad, 3, 3, true, Single2DArrayValGrad }, - }; + [ + [Fix162DGrad, 3, 3, false, Single2DArrayValGrad], + [Fix162DIdentity, 3, 3, false, Single2DArrayValIdentity], + [Single2DGrad, 3, 3, true, Single2DArrayValGrad] + ]; public static readonly object[][] Matrix2DDenseMatrixTestData = - { - new object[] { Fix162DGrad, 3, 3, false, SingleDenseMatrixValGrad }, - new object[] { Fix162DIdentity, 3, 3, false, SingleDenseMatrixValIdentity }, - new object[] { Single2DGrad, 3, 3, true, SingleDenseMatrixValGrad }, - }; + [ + [Fix162DGrad, 3, 3, false, SingleDenseMatrixValGrad], + [Fix162DIdentity, 3, 3, false, SingleDenseMatrixValIdentity], + [Single2DGrad, 3, 3, true, SingleDenseMatrixValGrad] + ]; public static readonly object[][] Matrix2DMatrix4X4TestData = - { - new object[] { Fix162DGrad, 3, 3, false, SingleMatrix4X4ValGrad }, - new object[] { Fix162DIdentity, 3, 3, false, SingleMatrix4X4ValIdentity }, - new object[] { Single2DGrad, 3, 3, true, SingleMatrix4X4ValGrad }, - }; + [ + [Fix162DGrad, 3, 3, false, SingleMatrix4X4ValGrad], + [Fix162DIdentity, 3, 3, false, SingleMatrix4X4ValIdentity], + [Single2DGrad, 3, 3, true, SingleMatrix4X4ValGrad] + ]; /// /// 3x1 Matrix /// - public static readonly float[] Single1DArrayValGrad = { 1, 4, 7 }; + public static readonly float[] Single1DArrayValGrad = [1, 4, 7]; /// /// 3x1 Matrix @@ -137,14 +137,14 @@ internal static class IccTestDataMatrix IccTestDataPrimitives.Single7); public static readonly object[][] Matrix1DArrayTestData = - { - new object[] { Fix161DGrad, 3, false, Single1DArrayValGrad }, - new object[] { Single1DGrad, 3, true, Single1DArrayValGrad }, - }; + [ + [Fix161DGrad, 3, false, Single1DArrayValGrad], + [Single1DGrad, 3, true, Single1DArrayValGrad] + ]; public static readonly object[][] Matrix1DVector3TestData = - { - new object[] { Fix161DGrad, 3, false, SingleVector3ValGrad }, - new object[] { Single1DGrad, 3, true, SingleVector3ValGrad }, - }; + [ + [Fix161DGrad, 3, false, SingleVector3ValGrad], + [Single1DGrad, 3, true, SingleVector3ValGrad] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMultiProcessElements.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMultiProcessElements.cs index 2e3679e3a..5219dfdac 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMultiProcessElements.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataMultiProcessElements.cs @@ -11,12 +11,11 @@ internal static class IccTestDataMultiProcessElements /// Input Channel Count: 3 /// Output Channel Count: 3 /// - public static readonly IccCurveSetProcessElement CurvePeValGrad = new(new[] - { + public static readonly IccCurveSetProcessElement CurvePeValGrad = new([ IccTestDataCurves.OneDimensionalValFormula1, IccTestDataCurves.OneDimensionalValFormula2, IccTestDataCurves.OneDimensionalValFormula1 - }); + ]); /// /// Input Channel Count: 3 @@ -28,9 +27,9 @@ internal static class IccTestDataMultiProcessElements IccTestDataCurves.OneDimensionalFormula1); public static readonly object[][] CurveSetTestData = - { - new object[] { CurvePeGrad, CurvePeValGrad, 3, 3 }, - }; + [ + [CurvePeGrad, CurvePeValGrad, 3, 3] + ]; /// /// Input Channel Count: 3 @@ -49,9 +48,9 @@ internal static class IccTestDataMultiProcessElements IccTestDataMatrix.Single1DGrad); public static readonly object[][] MatrixTestData = - { - new object[] { MatrixPeGrad, MatrixPeValGrad, 3, 3 }, - }; + [ + [MatrixPeGrad, MatrixPeValGrad, 3, 3] + ]; /// /// Input Channel Count: 2 @@ -66,9 +65,9 @@ internal static class IccTestDataMultiProcessElements public static readonly byte[] ClutpeGrad = IccTestDataLut.ClutF32; public static readonly object[][] ClutTestData = - { - new object[] { ClutpeGrad, ClutpeValGrad, 2, 3 }, - }; + [ + [ClutpeGrad, ClutpeValGrad, 2, 3] + ]; public static readonly IccMultiProcessElement MpeValMatrix = MatrixPeValGrad; public static readonly IccMultiProcessElement MpeValClut = ClutpeValGrad; @@ -104,27 +103,27 @@ internal static class IccTestDataMultiProcessElements CurvePeGrad); public static readonly byte[] MpeBAcs = - { + [ 0x62, 0x41, 0x43, 0x53, 0x00, 0x03, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; public static readonly byte[] MpeEAcs = - { + [ 0x65, 0x41, 0x43, 0x53, 0x00, 0x03, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + ]; public static readonly object[][] MultiProcessElementTestData = - { - new object[] { MpeMatrix, MpeValMatrix }, - new object[] { MpeClut, MpeValClut }, - new object[] { MpeCurve, MpeValCurve }, - new object[] { MpeBAcs, MpeValbAcs }, - new object[] { MpeEAcs, MpeValeAcs }, - }; + [ + [MpeMatrix, MpeValMatrix], + [MpeClut, MpeValClut], + [MpeCurve, MpeValCurve], + [MpeBAcs, MpeValbAcs], + [MpeEAcs, MpeValeAcs] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs index 067427424..34625aa1c 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs @@ -14,69 +14,69 @@ internal static class IccTestDataNonPrimitives public static readonly DateTime DateTimeValRand1 = new(1990, 11, 26, 3, 19, 47, DateTimeKind.Utc); public static readonly byte[] DateTimeMin = - { + [ 0x00, 0x01, // Year 1 0x00, 0x01, // Month 1 0x00, 0x01, // Day 1 0x00, 0x00, // Hour 0 0x00, 0x00, // Minute 0 - 0x00, 0x00, // Second 0 - }; + 0x00, 0x00 // Second 0 + ]; public static readonly byte[] DateTimeMax = - { - 0x27, 0x0F, // Year 9999 + [ + 0x27, 0x0F, // Year 9999 0x00, 0x0C, // Month 12 0x00, 0x1F, // Day 31 0x00, 0x17, // Hour 23 0x00, 0x3B, // Minute 59 - 0x00, 0x3B, // Second 59 - }; + 0x00, 0x3B // Second 59 + ]; public static readonly byte[] DateTimeInvalid = - { - 0xFF, 0xFF, // Year 65535 + [ + 0xFF, 0xFF, // Year 65535 0x00, 0x0E, // Month 14 0x00, 0x21, // Day 33 0x00, 0x19, // Hour 25 0x00, 0x3D, // Minute 61 - 0x00, 0x3D, // Second 61 - }; + 0x00, 0x3D // Second 61 + ]; public static readonly byte[] DateTimeRand1 = - { - 0x07, 0xC6, // Year 1990 + [ + 0x07, 0xC6, // Year 1990 0x00, 0x0B, // Month 11 0x00, 0x1A, // Day 26 0x00, 0x03, // Hour 3 0x00, 0x13, // Minute 19 - 0x00, 0x2F, // Second 47 - }; + 0x00, 0x2F // Second 47 + ]; public static readonly object[][] DateTimeTestData = - { - new object[] { DateTimeMin, DateTimeValMin }, - new object[] { DateTimeMax, DateTimeValMax }, - new object[] { DateTimeRand1, DateTimeValRand1 }, - }; + [ + [DateTimeMin, DateTimeValMin], + [DateTimeMax, DateTimeValMax], + [DateTimeRand1, DateTimeValRand1] + ]; public static readonly IccVersion VersionNumberValMin = new(0, 0, 0); public static readonly IccVersion VersionNumberVal211 = new(2, 1, 1); public static readonly IccVersion VersionNumberVal430 = new(4, 3, 0); public static readonly IccVersion VersionNumberValMax = new(255, 15, 15); - public static readonly byte[] VersionNumberMin = { 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] VersionNumber211 = { 0x02, 0x11, 0x00, 0x00 }; - public static readonly byte[] VersionNumber430 = { 0x04, 0x30, 0x00, 0x00 }; - public static readonly byte[] VersionNumberMax = { 0xFF, 0xFF, 0x00, 0x00 }; + public static readonly byte[] VersionNumberMin = [0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] VersionNumber211 = [0x02, 0x11, 0x00, 0x00]; + public static readonly byte[] VersionNumber430 = [0x04, 0x30, 0x00, 0x00]; + public static readonly byte[] VersionNumberMax = [0xFF, 0xFF, 0x00, 0x00]; public static readonly object[][] VersionNumberTestData = - { - new object[] { VersionNumberMin, VersionNumberValMin }, - new object[] { VersionNumber211, VersionNumberVal211 }, - new object[] { VersionNumber430, VersionNumberVal430 }, - new object[] { VersionNumberMax, VersionNumberValMax }, - }; + [ + [VersionNumberMin, VersionNumberValMin], + [VersionNumber211, VersionNumberVal211], + [VersionNumber430, VersionNumberVal430], + [VersionNumberMax, VersionNumberValMax] + ]; public static readonly Vector3 XyzNumberValMin = new(IccTestDataPrimitives.Fix16ValMin, IccTestDataPrimitives.Fix16ValMin, IccTestDataPrimitives.Fix16ValMin); public static readonly Vector3 XyzNumberVal0 = new(0, 0, 0); @@ -95,12 +95,12 @@ internal static class IccTestDataNonPrimitives public static readonly byte[] XyzNumberMax = ArrayHelper.Concat(IccTestDataPrimitives.Fix16Max, IccTestDataPrimitives.Fix16Max, IccTestDataPrimitives.Fix16Max); public static readonly object[][] XyzNumberTestData = - { - new object[] { XyzNumberMin, XyzNumberValMin }, - new object[] { XyzNumber0, XyzNumberVal0 }, - new object[] { XyzNumberVar1, XyzNumberValVar1 }, - new object[] { XyzNumberMax, XyzNumberValMax }, - }; + [ + [XyzNumberMin, XyzNumberValMin], + [XyzNumber0, XyzNumberVal0], + [XyzNumberVar1, XyzNumberValVar1], + [XyzNumberMax, XyzNumberValMax] + ]; public static readonly IccProfileId ProfileIdValMin = new(0, 0, 0, 0); public static readonly IccProfileId ProfileIdValRand = new(IccTestDataPrimitives.UInt32ValRand1, IccTestDataPrimitives.UInt32ValRand2, IccTestDataPrimitives.UInt32ValRand3, IccTestDataPrimitives.UInt32ValRand4); @@ -111,11 +111,11 @@ internal static class IccTestDataNonPrimitives public static readonly byte[] ProfileIdMax = ArrayHelper.Concat(IccTestDataPrimitives.UInt32Max, IccTestDataPrimitives.UInt32Max, IccTestDataPrimitives.UInt32Max, IccTestDataPrimitives.UInt32Max); public static readonly object[][] ProfileIdTestData = - { - new object[] { ProfileIdMin, ProfileIdValMin }, - new object[] { ProfileIdRand, ProfileIdValRand }, - new object[] { ProfileIdMax, ProfileIdValMax }, - }; + [ + [ProfileIdMin, ProfileIdValMin], + [ProfileIdRand, ProfileIdValRand], + [ProfileIdMax, ProfileIdValMax] + ]; public static readonly IccPositionNumber PositionNumberValMin = new(0, 0); public static readonly IccPositionNumber PositionNumberValRand = new(IccTestDataPrimitives.UInt32ValRand1, IccTestDataPrimitives.UInt32ValRand2); @@ -126,11 +126,11 @@ internal static class IccTestDataNonPrimitives public static readonly byte[] PositionNumberMax = ArrayHelper.Concat(IccTestDataPrimitives.UInt32Max, IccTestDataPrimitives.UInt32Max); public static readonly object[][] PositionNumberTestData = - { - new object[] { PositionNumberMin, PositionNumberValMin }, - new object[] { PositionNumberRand, PositionNumberValRand }, - new object[] { PositionNumberMax, PositionNumberValMax }, - }; + [ + [PositionNumberMin, PositionNumberValMin], + [PositionNumberRand, PositionNumberValRand], + [PositionNumberMax, PositionNumberValMax] + ]; public static readonly IccResponseNumber ResponseNumberValMin = new(0, IccTestDataPrimitives.Fix16ValMin); public static readonly IccResponseNumber ResponseNumberVal1 = new(1, 1); @@ -157,27 +157,27 @@ internal static class IccTestDataNonPrimitives public static readonly byte[] ResponseNumberMax = ArrayHelper.Concat(IccTestDataPrimitives.UInt16Max, IccTestDataPrimitives.Fix16Max); public static readonly object[][] ResponseNumberTestData = - { - new object[] { ResponseNumberMin, ResponseNumberValMin }, - new object[] { ResponseNumber1, ResponseNumberVal1 }, - new object[] { ResponseNumber4, ResponseNumberVal4 }, - new object[] { ResponseNumberMax, ResponseNumberValMax }, - }; + [ + [ResponseNumberMin, ResponseNumberValMin], + [ResponseNumber1, ResponseNumberVal1], + [ResponseNumber4, ResponseNumberVal4], + [ResponseNumberMax, ResponseNumberValMax] + ]; public static readonly IccNamedColor NamedColorValMin = new( ArrayHelper.Fill('A', 31), - new ushort[] { 0, 0, 0 }, - new ushort[] { 0, 0, 0 }); + [0, 0, 0], + [0, 0, 0]); public static readonly IccNamedColor NamedColorValRand = new( ArrayHelper.Fill('5', 31), - new ushort[] { 10794, 10794, 10794 }, - new ushort[] { 17219, 17219, 17219, 17219, 17219 }); + [10794, 10794, 10794], + [17219, 17219, 17219, 17219, 17219]); public static readonly IccNamedColor NamedColorValMax = new( ArrayHelper.Fill('4', 31), - new[] { ushort.MaxValue, ushort.MaxValue, ushort.MaxValue }, - new[] { ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue }); + [ushort.MaxValue, ushort.MaxValue, ushort.MaxValue], + [ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue]); public static readonly byte[] NamedColorMin = CreateNamedColor(3, 0x41, 0x00, 0x00); public static readonly byte[] NamedColorRand = CreateNamedColor(5, 0x35, 42, 67); @@ -210,11 +210,11 @@ internal static class IccTestDataNonPrimitives } public static readonly object[][] NamedColorTestData = - { - new object[] { NamedColorMin, NamedColorValMin, 3u }, - new object[] { NamedColorRand, NamedColorValRand, 5u }, - new object[] { NamedColorMax, NamedColorValMax, 4u }, - }; + [ + [NamedColorMin, NamedColorValMin, 3u], + [NamedColorRand, NamedColorValRand, 5u], + [NamedColorMax, NamedColorValMax, 4u] + ]; private static readonly CultureInfo CultureEnUs = new("en-US"); private static readonly CultureInfo CultureDeAt = new("de-AT"); @@ -222,19 +222,20 @@ internal static class IccTestDataNonPrimitives private static readonly IccLocalizedString LocalizedStringRand1 = new(CultureEnUs, IccTestDataPrimitives.UnicodeValRand2); private static readonly IccLocalizedString LocalizedStringRand2 = new(CultureDeAt, IccTestDataPrimitives.UnicodeValRand3); - private static readonly IccLocalizedString[] LocalizedStringRandArr1 = { + private static readonly IccLocalizedString[] LocalizedStringRandArr1 = + [ LocalizedStringRand1, - LocalizedStringRand2, - }; + LocalizedStringRand2 + ]; private static readonly IccMultiLocalizedUnicodeTagDataEntry MultiLocalizedUnicodeVal = new(LocalizedStringRandArr1); private static readonly byte[] MultiLocalizedUnicodeArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt322, new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 - new[] { (byte)'e', (byte)'n', (byte)'U', (byte)'S' }, + [(byte)'e', (byte)'n', (byte)'U', (byte)'S'], new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 new byte[] { 0x00, 0x00, 0x00, 0x28 }, // 40 - new[] { (byte)'d', (byte)'e', (byte)'A', (byte)'T' }, + [(byte)'d', (byte)'e', (byte)'A', (byte)'T'], new byte[] { 0x00, 0x00, 0x00, 0x0E }, // 14 new byte[] { 0x00, 0x00, 0x00, 0x34 }, // 52 IccTestDataPrimitives.UnicodeRand2, @@ -251,7 +252,7 @@ internal static class IccTestDataNonPrimitives new byte[] { 0x00, 0x00, 0x00, 0x0B }, // 11 IccTestDataPrimitives.AsciiRand, new byte[] { 0x00 }, // Null terminator - new[] { (byte)'e', (byte)'n', (byte)'U', (byte)'S' }, + [(byte)'e', (byte)'n', (byte)'U', (byte)'S'], new byte[] { 0x00, 0x00, 0x00, 0x07 }, // 7 IccTestDataPrimitives.UnicodeRand2, new byte[] { 0x00, 0x00 }, // Null terminator @@ -272,8 +273,8 @@ internal static class IccTestDataNonPrimitives 2, IccDeviceAttribute.ChromaBlackWhite | IccDeviceAttribute.ReflectivityMatte, IccProfileTag.ProfileDescription, - new[] { LocalizedStringRand1 }, - new[] { LocalizedStringRand1 }); + [LocalizedStringRand1], + [LocalizedStringRand1]); public static readonly byte[] ProfileDescriptionRand1 = ArrayHelper.Concat( IccTestDataPrimitives.UInt321, @@ -300,15 +301,15 @@ internal static class IccTestDataNonPrimitives TextDescriptionArr1); public static readonly object[][] ProfileDescriptionReadTestData = - { - new object[] { ProfileDescriptionRand1, ProfileDescriptionValRand1 }, - new object[] { ProfileDescriptionRand2, ProfileDescriptionValRand2 }, - }; + [ + [ProfileDescriptionRand1, ProfileDescriptionValRand1], + [ProfileDescriptionRand2, ProfileDescriptionValRand2] + ]; public static readonly object[][] ProfileDescriptionWriteTestData = - { - new object[] { ProfileDescriptionRand1, ProfileDescriptionValRand1 }, - }; + [ + [ProfileDescriptionRand1, ProfileDescriptionValRand1] + ]; public static readonly IccColorantTableEntry ColorantTableEntryValRand1 = new(ArrayHelper.Fill('A', 31), 1, 2, 3); public static readonly IccColorantTableEntry ColorantTableEntryValRand2 = new(ArrayHelper.Fill('4', 31), 4, 5, 6); @@ -328,10 +329,10 @@ internal static class IccTestDataNonPrimitives IccTestDataPrimitives.UInt166); public static readonly object[][] ColorantTableEntryTestData = - { - new object[] { ColorantTableEntryRand1, ColorantTableEntryValRand1 }, - new object[] { ColorantTableEntryRand2, ColorantTableEntryValRand2 }, - }; + [ + [ColorantTableEntryRand1, ColorantTableEntryValRand1], + [ColorantTableEntryRand2, ColorantTableEntryValRand2] + ]; public static readonly IccScreeningChannel ScreeningChannelValRand1 = new(4, 6, IccScreeningSpotType.Cross); public static readonly IccScreeningChannel ScreeningChannelValRand2 = new(8, 5, IccScreeningSpotType.Diamond); @@ -347,8 +348,8 @@ internal static class IccTestDataNonPrimitives IccTestDataPrimitives.Int323); public static readonly object[][] ScreeningChannelTestData = - { - new object[] { ScreeningChannelRand1, ScreeningChannelValRand1 }, - new object[] { ScreeningChannelRand2, ScreeningChannelValRand2 }, - }; + [ + [ScreeningChannelRand1, ScreeningChannelValRand1], + [ScreeningChannelRand2, ScreeningChannelValRand2] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataPrimitives.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataPrimitives.cs index 81cfea46f..5f9d70fb2 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataPrimitives.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataPrimitives.cs @@ -5,191 +5,191 @@ namespace SixLabors.ImageSharp.Tests.TestDataIcc; internal static class IccTestDataPrimitives { - public static readonly byte[] UInt160 = { 0x00, 0x00 }; - public static readonly byte[] UInt161 = { 0x00, 0x01 }; - public static readonly byte[] UInt162 = { 0x00, 0x02 }; - public static readonly byte[] UInt163 = { 0x00, 0x03 }; - public static readonly byte[] UInt164 = { 0x00, 0x04 }; - public static readonly byte[] UInt165 = { 0x00, 0x05 }; - public static readonly byte[] UInt166 = { 0x00, 0x06 }; - public static readonly byte[] UInt167 = { 0x00, 0x07 }; - public static readonly byte[] UInt168 = { 0x00, 0x08 }; - public static readonly byte[] UInt169 = { 0x00, 0x09 }; - public static readonly byte[] UInt1632768 = { 0x80, 0x00 }; - public static readonly byte[] UInt16Max = { 0xFF, 0xFF }; - - public static readonly byte[] Int16Min = { 0x80, 0x00 }; - public static readonly byte[] Int160 = { 0x00, 0x00 }; - public static readonly byte[] Int161 = { 0x00, 0x01 }; - public static readonly byte[] Int162 = { 0x00, 0x02 }; - public static readonly byte[] Int163 = { 0x00, 0x03 }; - public static readonly byte[] Int164 = { 0x00, 0x04 }; - public static readonly byte[] Int165 = { 0x00, 0x05 }; - public static readonly byte[] Int166 = { 0x00, 0x06 }; - public static readonly byte[] Int167 = { 0x00, 0x07 }; - public static readonly byte[] Int168 = { 0x00, 0x08 }; - public static readonly byte[] Int169 = { 0x00, 0x09 }; - public static readonly byte[] Int16Max = { 0x7F, 0xFF }; - - public static readonly byte[] UInt320 = { 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] UInt321 = { 0x00, 0x00, 0x00, 0x01 }; - public static readonly byte[] UInt322 = { 0x00, 0x00, 0x00, 0x02 }; - public static readonly byte[] UInt323 = { 0x00, 0x00, 0x00, 0x03 }; - public static readonly byte[] UInt324 = { 0x00, 0x00, 0x00, 0x04 }; - public static readonly byte[] UInt325 = { 0x00, 0x00, 0x00, 0x05 }; - public static readonly byte[] UInt326 = { 0x00, 0x00, 0x00, 0x06 }; - public static readonly byte[] UInt327 = { 0x00, 0x00, 0x00, 0x07 }; - public static readonly byte[] UInt328 = { 0x00, 0x00, 0x00, 0x08 }; - public static readonly byte[] UInt329 = { 0x00, 0x00, 0x00, 0x09 }; - public static readonly byte[] UInt32Max = { 0xFF, 0xFF, 0xFF, 0xFF }; + public static readonly byte[] UInt160 = [0x00, 0x00]; + public static readonly byte[] UInt161 = [0x00, 0x01]; + public static readonly byte[] UInt162 = [0x00, 0x02]; + public static readonly byte[] UInt163 = [0x00, 0x03]; + public static readonly byte[] UInt164 = [0x00, 0x04]; + public static readonly byte[] UInt165 = [0x00, 0x05]; + public static readonly byte[] UInt166 = [0x00, 0x06]; + public static readonly byte[] UInt167 = [0x00, 0x07]; + public static readonly byte[] UInt168 = [0x00, 0x08]; + public static readonly byte[] UInt169 = [0x00, 0x09]; + public static readonly byte[] UInt1632768 = [0x80, 0x00]; + public static readonly byte[] UInt16Max = [0xFF, 0xFF]; + + public static readonly byte[] Int16Min = [0x80, 0x00]; + public static readonly byte[] Int160 = [0x00, 0x00]; + public static readonly byte[] Int161 = [0x00, 0x01]; + public static readonly byte[] Int162 = [0x00, 0x02]; + public static readonly byte[] Int163 = [0x00, 0x03]; + public static readonly byte[] Int164 = [0x00, 0x04]; + public static readonly byte[] Int165 = [0x00, 0x05]; + public static readonly byte[] Int166 = [0x00, 0x06]; + public static readonly byte[] Int167 = [0x00, 0x07]; + public static readonly byte[] Int168 = [0x00, 0x08]; + public static readonly byte[] Int169 = [0x00, 0x09]; + public static readonly byte[] Int16Max = [0x7F, 0xFF]; + + public static readonly byte[] UInt320 = [0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] UInt321 = [0x00, 0x00, 0x00, 0x01]; + public static readonly byte[] UInt322 = [0x00, 0x00, 0x00, 0x02]; + public static readonly byte[] UInt323 = [0x00, 0x00, 0x00, 0x03]; + public static readonly byte[] UInt324 = [0x00, 0x00, 0x00, 0x04]; + public static readonly byte[] UInt325 = [0x00, 0x00, 0x00, 0x05]; + public static readonly byte[] UInt326 = [0x00, 0x00, 0x00, 0x06]; + public static readonly byte[] UInt327 = [0x00, 0x00, 0x00, 0x07]; + public static readonly byte[] UInt328 = [0x00, 0x00, 0x00, 0x08]; + public static readonly byte[] UInt329 = [0x00, 0x00, 0x00, 0x09]; + public static readonly byte[] UInt32Max = [0xFF, 0xFF, 0xFF, 0xFF]; public static readonly uint UInt32ValRand1 = 1749014123; public static readonly uint UInt32ValRand2 = 3870560989; public static readonly uint UInt32ValRand3 = 1050090334; public static readonly uint UInt32ValRand4 = 3550252874; - public static readonly byte[] UInt32Rand1 = { 0x68, 0x3F, 0xD6, 0x6B }; - public static readonly byte[] UInt32Rand2 = { 0xE6, 0xB4, 0x12, 0xDD }; - public static readonly byte[] UInt32Rand3 = { 0x3E, 0x97, 0x1B, 0x5E }; - public static readonly byte[] UInt32Rand4 = { 0xD3, 0x9C, 0x8F, 0x4A }; - - public static readonly byte[] Int32Min = { 0x80, 0x00, 0x00, 0x00 }; - public static readonly byte[] Int320 = { 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] Int321 = { 0x00, 0x00, 0x00, 0x01 }; - public static readonly byte[] Int322 = { 0x00, 0x00, 0x00, 0x02 }; - public static readonly byte[] Int323 = { 0x00, 0x00, 0x00, 0x03 }; - public static readonly byte[] Int324 = { 0x00, 0x00, 0x00, 0x04 }; - public static readonly byte[] Int325 = { 0x00, 0x00, 0x00, 0x05 }; - public static readonly byte[] Int326 = { 0x00, 0x00, 0x00, 0x06 }; - public static readonly byte[] Int327 = { 0x00, 0x00, 0x00, 0x07 }; - public static readonly byte[] Int328 = { 0x00, 0x00, 0x00, 0x08 }; - public static readonly byte[] Int329 = { 0x00, 0x00, 0x00, 0x09 }; - public static readonly byte[] Int32Max = { 0x7F, 0xFF, 0xFF, 0xFF }; - - public static readonly byte[] UInt640 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] UInt641 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - public static readonly byte[] UInt642 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }; - public static readonly byte[] UInt643 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; - public static readonly byte[] UInt644 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04 }; - public static readonly byte[] UInt645 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 }; - public static readonly byte[] UInt646 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06 }; - public static readonly byte[] UInt647 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 }; - public static readonly byte[] UInt648 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 }; - public static readonly byte[] UInt649 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09 }; - public static readonly byte[] UInt64Max = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - - public static readonly byte[] Int64Min = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] Int640 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] Int641 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; - public static readonly byte[] Int642 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }; - public static readonly byte[] Int643 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 }; - public static readonly byte[] Int644 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04 }; - public static readonly byte[] Int645 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 }; - public static readonly byte[] Int646 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06 }; - public static readonly byte[] Int647 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 }; - public static readonly byte[] Int648 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 }; - public static readonly byte[] Int649 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09 }; - public static readonly byte[] Int64Max = { 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - - public static readonly byte[] SingleMin = { 0xFF, 0x7F, 0xFF, 0xFF }; - public static readonly byte[] Single0 = { 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] Single1 = { 0x3F, 0x80, 0x00, 0x00 }; - public static readonly byte[] Single2 = { 0x40, 0x00, 0x00, 0x00 }; - public static readonly byte[] Single3 = { 0x40, 0x40, 0x00, 0x00 }; - public static readonly byte[] Single4 = { 0x40, 0x80, 0x00, 0x00 }; - public static readonly byte[] Single5 = { 0x40, 0xA0, 0x00, 0x00 }; - public static readonly byte[] Single6 = { 0x40, 0xC0, 0x00, 0x00 }; - public static readonly byte[] Single7 = { 0x40, 0xE0, 0x00, 0x00 }; - public static readonly byte[] Single8 = { 0x41, 0x00, 0x00, 0x00 }; - public static readonly byte[] Single9 = { 0x41, 0x10, 0x00, 0x00 }; - public static readonly byte[] SingleMax = { 0x7F, 0x7F, 0xFF, 0xFF }; - - public static readonly byte[] DoubleMin = { 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - public static readonly byte[] Double0 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] Double1 = { 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] DoubleMax = { 0x7F, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + public static readonly byte[] UInt32Rand1 = [0x68, 0x3F, 0xD6, 0x6B]; + public static readonly byte[] UInt32Rand2 = [0xE6, 0xB4, 0x12, 0xDD]; + public static readonly byte[] UInt32Rand3 = [0x3E, 0x97, 0x1B, 0x5E]; + public static readonly byte[] UInt32Rand4 = [0xD3, 0x9C, 0x8F, 0x4A]; + + public static readonly byte[] Int32Min = [0x80, 0x00, 0x00, 0x00]; + public static readonly byte[] Int320 = [0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] Int321 = [0x00, 0x00, 0x00, 0x01]; + public static readonly byte[] Int322 = [0x00, 0x00, 0x00, 0x02]; + public static readonly byte[] Int323 = [0x00, 0x00, 0x00, 0x03]; + public static readonly byte[] Int324 = [0x00, 0x00, 0x00, 0x04]; + public static readonly byte[] Int325 = [0x00, 0x00, 0x00, 0x05]; + public static readonly byte[] Int326 = [0x00, 0x00, 0x00, 0x06]; + public static readonly byte[] Int327 = [0x00, 0x00, 0x00, 0x07]; + public static readonly byte[] Int328 = [0x00, 0x00, 0x00, 0x08]; + public static readonly byte[] Int329 = [0x00, 0x00, 0x00, 0x09]; + public static readonly byte[] Int32Max = [0x7F, 0xFF, 0xFF, 0xFF]; + + public static readonly byte[] UInt640 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] UInt641 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]; + public static readonly byte[] UInt642 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02]; + public static readonly byte[] UInt643 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03]; + public static readonly byte[] UInt644 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04]; + public static readonly byte[] UInt645 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05]; + public static readonly byte[] UInt646 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06]; + public static readonly byte[] UInt647 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07]; + public static readonly byte[] UInt648 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08]; + public static readonly byte[] UInt649 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09]; + public static readonly byte[] UInt64Max = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]; + + public static readonly byte[] Int64Min = [0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] Int640 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] Int641 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]; + public static readonly byte[] Int642 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02]; + public static readonly byte[] Int643 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03]; + public static readonly byte[] Int644 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04]; + public static readonly byte[] Int645 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05]; + public static readonly byte[] Int646 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06]; + public static readonly byte[] Int647 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07]; + public static readonly byte[] Int648 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08]; + public static readonly byte[] Int649 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09]; + public static readonly byte[] Int64Max = [0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]; + + public static readonly byte[] SingleMin = [0xFF, 0x7F, 0xFF, 0xFF]; + public static readonly byte[] Single0 = [0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] Single1 = [0x3F, 0x80, 0x00, 0x00]; + public static readonly byte[] Single2 = [0x40, 0x00, 0x00, 0x00]; + public static readonly byte[] Single3 = [0x40, 0x40, 0x00, 0x00]; + public static readonly byte[] Single4 = [0x40, 0x80, 0x00, 0x00]; + public static readonly byte[] Single5 = [0x40, 0xA0, 0x00, 0x00]; + public static readonly byte[] Single6 = [0x40, 0xC0, 0x00, 0x00]; + public static readonly byte[] Single7 = [0x40, 0xE0, 0x00, 0x00]; + public static readonly byte[] Single8 = [0x41, 0x00, 0x00, 0x00]; + public static readonly byte[] Single9 = [0x41, 0x10, 0x00, 0x00]; + public static readonly byte[] SingleMax = [0x7F, 0x7F, 0xFF, 0xFF]; + + public static readonly byte[] DoubleMin = [0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]; + public static readonly byte[] Double0 = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] Double1 = [0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] DoubleMax = [0x7F, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]; public const float Fix16ValMin = short.MinValue; public const float Fix16ValMax = short.MaxValue + (65535f / 65536f); - public static readonly byte[] Fix16Min = { 0x80, 0x00, 0x00, 0x00 }; - public static readonly byte[] Fix160 = { 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] Fix161 = { 0x00, 0x01, 0x00, 0x00 }; - public static readonly byte[] Fix162 = { 0x00, 0x02, 0x00, 0x00 }; - public static readonly byte[] Fix163 = { 0x00, 0x03, 0x00, 0x00 }; - public static readonly byte[] Fix164 = { 0x00, 0x04, 0x00, 0x00 }; - public static readonly byte[] Fix165 = { 0x00, 0x05, 0x00, 0x00 }; - public static readonly byte[] Fix166 = { 0x00, 0x06, 0x00, 0x00 }; - public static readonly byte[] Fix167 = { 0x00, 0x07, 0x00, 0x00 }; - public static readonly byte[] Fix168 = { 0x00, 0x08, 0x00, 0x00 }; - public static readonly byte[] Fix169 = { 0x00, 0x09, 0x00, 0x00 }; - public static readonly byte[] Fix16Max = { 0x7F, 0xFF, 0xFF, 0xFF }; + public static readonly byte[] Fix16Min = [0x80, 0x00, 0x00, 0x00]; + public static readonly byte[] Fix160 = [0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] Fix161 = [0x00, 0x01, 0x00, 0x00]; + public static readonly byte[] Fix162 = [0x00, 0x02, 0x00, 0x00]; + public static readonly byte[] Fix163 = [0x00, 0x03, 0x00, 0x00]; + public static readonly byte[] Fix164 = [0x00, 0x04, 0x00, 0x00]; + public static readonly byte[] Fix165 = [0x00, 0x05, 0x00, 0x00]; + public static readonly byte[] Fix166 = [0x00, 0x06, 0x00, 0x00]; + public static readonly byte[] Fix167 = [0x00, 0x07, 0x00, 0x00]; + public static readonly byte[] Fix168 = [0x00, 0x08, 0x00, 0x00]; + public static readonly byte[] Fix169 = [0x00, 0x09, 0x00, 0x00]; + public static readonly byte[] Fix16Max = [0x7F, 0xFF, 0xFF, 0xFF]; public static readonly object[][] Fix16TestData = - { - new object[] { Fix16Min, Fix16ValMin }, - new object[] { Fix160, 0 }, - new object[] { Fix164, 4 }, - new object[] { Fix16Max, Fix16ValMax }, - }; + [ + [Fix16Min, Fix16ValMin], + [Fix160, 0], + [Fix164, 4], + [Fix16Max, Fix16ValMax] + ]; public const float UFix16ValMin = 0; public const float UFix16ValMax = ushort.MaxValue + (65535f / 65536f); - public static readonly byte[] UFix160 = { 0x00, 0x00, 0x00, 0x00 }; - public static readonly byte[] UFix161 = { 0x00, 0x01, 0x00, 0x00 }; - public static readonly byte[] UFix162 = { 0x00, 0x02, 0x00, 0x00 }; - public static readonly byte[] UFix163 = { 0x00, 0x03, 0x00, 0x00 }; - public static readonly byte[] UFix164 = { 0x00, 0x04, 0x00, 0x00 }; - public static readonly byte[] UFix165 = { 0x00, 0x05, 0x00, 0x00 }; - public static readonly byte[] UFix166 = { 0x00, 0x06, 0x00, 0x00 }; - public static readonly byte[] UFix167 = { 0x00, 0x07, 0x00, 0x00 }; - public static readonly byte[] UFix168 = { 0x00, 0x08, 0x00, 0x00 }; - public static readonly byte[] UFix169 = { 0x00, 0x09, 0x00, 0x00 }; - public static readonly byte[] UFix16Max = { 0xFF, 0xFF, 0xFF, 0xFF }; + public static readonly byte[] UFix160 = [0x00, 0x00, 0x00, 0x00]; + public static readonly byte[] UFix161 = [0x00, 0x01, 0x00, 0x00]; + public static readonly byte[] UFix162 = [0x00, 0x02, 0x00, 0x00]; + public static readonly byte[] UFix163 = [0x00, 0x03, 0x00, 0x00]; + public static readonly byte[] UFix164 = [0x00, 0x04, 0x00, 0x00]; + public static readonly byte[] UFix165 = [0x00, 0x05, 0x00, 0x00]; + public static readonly byte[] UFix166 = [0x00, 0x06, 0x00, 0x00]; + public static readonly byte[] UFix167 = [0x00, 0x07, 0x00, 0x00]; + public static readonly byte[] UFix168 = [0x00, 0x08, 0x00, 0x00]; + public static readonly byte[] UFix169 = [0x00, 0x09, 0x00, 0x00]; + public static readonly byte[] UFix16Max = [0xFF, 0xFF, 0xFF, 0xFF]; public static readonly object[][] UFix16TestData = - { - new object[] { UFix160, 0 }, - new object[] { UFix164, 4 }, - new object[] { UFix16Max, UFix16ValMax }, - }; + [ + [UFix160, 0], + [UFix164, 4], + [UFix16Max, UFix16ValMax] + ]; public const float U1Fix15ValMin = 0; public const float U1Fix15ValMax = 1f + (32767f / 32768f); - public static readonly byte[] U1Fix150 = { 0x00, 0x00 }; - public static readonly byte[] U1Fix151 = { 0x80, 0x00 }; - public static readonly byte[] U1Fix15Max = { 0xFF, 0xFF }; + public static readonly byte[] U1Fix150 = [0x00, 0x00]; + public static readonly byte[] U1Fix151 = [0x80, 0x00]; + public static readonly byte[] U1Fix15Max = [0xFF, 0xFF]; public static readonly object[][] U1Fix15TestData = - { - new object[] { U1Fix150, 0 }, - new object[] { U1Fix151, 1 }, - new object[] { U1Fix15Max, U1Fix15ValMax }, - }; + [ + [U1Fix150, 0], + [U1Fix151, 1], + [U1Fix15Max, U1Fix15ValMax] + ]; public const float UFix8ValMin = 0; public const float UFix8ValMax = byte.MaxValue + (255f / 256f); - public static readonly byte[] UFix80 = { 0x00, 0x00 }; - public static readonly byte[] UFix81 = { 0x01, 0x00 }; - public static readonly byte[] UFix82 = { 0x02, 0x00 }; - public static readonly byte[] UFix83 = { 0x03, 0x00 }; - public static readonly byte[] UFix84 = { 0x04, 0x00 }; - public static readonly byte[] UFix85 = { 0x05, 0x00 }; - public static readonly byte[] UFix86 = { 0x06, 0x00 }; - public static readonly byte[] UFix87 = { 0x07, 0x00 }; - public static readonly byte[] UFix88 = { 0x08, 0x00 }; - public static readonly byte[] UFix89 = { 0x09, 0x00 }; - public static readonly byte[] UFix8Max = { 0xFF, 0xFF }; + public static readonly byte[] UFix80 = [0x00, 0x00]; + public static readonly byte[] UFix81 = [0x01, 0x00]; + public static readonly byte[] UFix82 = [0x02, 0x00]; + public static readonly byte[] UFix83 = [0x03, 0x00]; + public static readonly byte[] UFix84 = [0x04, 0x00]; + public static readonly byte[] UFix85 = [0x05, 0x00]; + public static readonly byte[] UFix86 = [0x06, 0x00]; + public static readonly byte[] UFix87 = [0x07, 0x00]; + public static readonly byte[] UFix88 = [0x08, 0x00]; + public static readonly byte[] UFix89 = [0x09, 0x00]; + public static readonly byte[] UFix8Max = [0xFF, 0xFF]; public static readonly object[][] UFix8TestData = - { - new object[] { UFix80, 0 }, - new object[] { UFix84, 4 }, - new object[] { UFix8Max, UFix8ValMax }, - }; + [ + [UFix80, 0], + [UFix84, 4], + [UFix8Max, UFix8ValMax] + ]; public const string AsciiValRand = "aBcdEf1234"; public const string AsciiValRand1 = "Ecf3a"; @@ -199,14 +199,14 @@ internal static class IccTestDataPrimitives public const string AsciiValRandLength4 = "aBcd"; public const string AsciiValNullRand = "aBcd\0Ef\0123"; - public static readonly byte[] AsciiRand = { 97, 66, 99, 100, 69, 102, 49, 50, 51, 52 }; - public static readonly byte[] AsciiRand1 = { 69, 99, 102, 51, 97 }; - public static readonly byte[] AsciiRand2 = { 50, 66, 100, 52, 99 }; - public static readonly byte[] AsciiRand3 = { 99, 97, 100, 49, 52 }; - public static readonly byte[] AsciiRand4 = { 102, 100, 52, 69, 49 }; - public static readonly byte[] AsciiRandLength4 = { 97, 66, 99, 100 }; - public static readonly byte[] AsciiPaddedRand = { 97, 66, 99, 100, 69, 102, 49, 50, 51, 52, 0, 0, 0, 0 }; - public static readonly byte[] AsciiNullRand = { 97, 66, 99, 100, 0, 69, 102, 0, 49, 50, 51 }; + public static readonly byte[] AsciiRand = [97, 66, 99, 100, 69, 102, 49, 50, 51, 52]; + public static readonly byte[] AsciiRand1 = [69, 99, 102, 51, 97]; + public static readonly byte[] AsciiRand2 = [50, 66, 100, 52, 99]; + public static readonly byte[] AsciiRand3 = [99, 97, 100, 49, 52]; + public static readonly byte[] AsciiRand4 = [102, 100, 52, 69, 49]; + public static readonly byte[] AsciiRandLength4 = [97, 66, 99, 100]; + public static readonly byte[] AsciiPaddedRand = [97, 66, 99, 100, 69, 102, 49, 50, 51, 52, 0, 0, 0, 0]; + public static readonly byte[] AsciiNullRand = [97, 66, 99, 100, 0, 69, 102, 0, 49, 50, 51]; public const int AsciiRandLength = 10; public const int AsciiPaddedRandLength = 14; @@ -214,30 +214,30 @@ internal static class IccTestDataPrimitives public const int AsciiNullRandLengthNoNull = 4; public static readonly object[][] AsciiTestData = - { - new object[] { AsciiRand, AsciiRandLength, AsciiValRand }, - new object[] { AsciiRand, 4, AsciiValRandLength4 }, - new object[] { AsciiNullRand, AsciiNullRandLengthNoNull, AsciiValRandLength4 }, - }; + [ + [AsciiRand, AsciiRandLength, AsciiValRand], + [AsciiRand, 4, AsciiValRandLength4], + [AsciiNullRand, AsciiNullRandLengthNoNull, AsciiValRandLength4] + ]; public static readonly object[][] AsciiWriteTestData = - { - new object[] { AsciiRand, AsciiValRand }, - new object[] { AsciiNullRand, AsciiValNullRand }, - }; + [ + [AsciiRand, AsciiValRand], + [AsciiNullRand, AsciiValNullRand] + ]; public static readonly object[][] AsciiPaddingTestData = - { - new object[] { AsciiPaddedRand, AsciiPaddedRandLength, AsciiValRand, true }, - new object[] { AsciiRandLength4, 4, AsciiValRand, false }, - }; + [ + [AsciiPaddedRand, AsciiPaddedRandLength, AsciiValRand, true], + [AsciiRandLength4, 4, AsciiValRand, false] + ]; public const string UnicodeValRand1 = ".6Abäñ$€βð·ð¤­¢"; public const string UnicodeValRand2 = ".6Abäñ"; public const string UnicodeValRand3 = "$€βð·ð¤­¢"; public static readonly byte[] UnicodeRand1 = - { + [ 0x00, 0x2e, // . 0x00, 0x36, // 6 0x00, 0x41, // A @@ -248,25 +248,25 @@ internal static class IccTestDataPrimitives 0x20, 0xAC, // € 0x03, 0xb2, // β 0xD8, 0x01, 0xDC, 0x37, // ð· - 0xD8, 0x52, 0xDF, 0x62, // 𤭢 - }; + 0xD8, 0x52, 0xDF, 0x62 // 𤭢 + ]; public static readonly byte[] UnicodeRand2 = - { + [ 0x00, 0x2e, // . 0x00, 0x36, // 6 0x00, 0x41, // A 0x00, 0x62, // b 0x00, 0xe4, // ä - 0x00, 0xf1, // ñ - }; + 0x00, 0xf1 // ñ + ]; public static readonly byte[] UnicodeRand3 = - { + [ 0x00, 0x24, // $ 0x20, 0xAC, // € 0x03, 0xb2, // β 0xD8, 0x01, 0xDC, 0x37, // ð· - 0xD8, 0x52, 0xDF, 0x62, // 𤭢 - }; + 0xD8, 0x52, 0xDF, 0x62 // 𤭢 + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs index 7441bede8..6e097a0be 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs @@ -12,14 +12,14 @@ internal static class IccTestDataProfiles public static readonly IccProfileId ProfileRandomIdValue = new(0x917D6DE6, 0x84C958D1, 0x3BB0F5BB, 0xADD1134F); public static readonly byte[] HeaderRandomIdArray = - { - 0x84, 0xA8, 0xD4, 0x60, 0xC7, 0x16, 0xB6, 0xF3, 0x9B, 0x0E, 0x4C, 0x3D, 0xAB, 0x95, 0xF8, 0x38, - }; + [ + 0x84, 0xA8, 0xD4, 0x60, 0xC7, 0x16, 0xB6, 0xF3, 0x9B, 0x0E, 0x4C, 0x3D, 0xAB, 0x95, 0xF8, 0x38 + ]; public static readonly byte[] ProfileRandomIdArray = - { - 0x91, 0x7D, 0x6D, 0xE6, 0x84, 0xC9, 0x58, 0xD1, 0x3B, 0xB0, 0xF5, 0xBB, 0xAD, 0xD1, 0x13, 0x4F, - }; + [ + 0x91, 0x7D, 0x6D, 0xE6, 0x84, 0xC9, 0x58, 0xD1, 0x3B, 0xB0, 0xF5, 0xBB, 0xAD, 0xD1, 0x13, 0x4F + ]; public static readonly IccProfileHeader HeaderRandomWrite = CreateHeaderRandomValue( 562, // should be overwritten @@ -106,10 +106,10 @@ internal static class IccTestDataProfiles 168, ProfileRandomIdValue, "acsp"), - new IccTagDataEntry[] { IccTestDataTagDataEntry.UnknownVal, IccTestDataTagDataEntry.UnknownVal }); + [IccTestDataTagDataEntry.UnknownVal, IccTestDataTagDataEntry.UnknownVal]); public static readonly byte[] HeaderCorruptDataColorSpaceArray = - { + [ 0x00, 0x00, 0x00, 0x80, // Size 0x61, 0x62, 0x63, 0x64, // CmmType 0x04, 0x30, 0x00, 0x00, // Version @@ -134,11 +134,11 @@ internal static class IccTestDataProfiles 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static readonly byte[] HeaderCorruptProfileConnectionSpaceArray = - { + [ 0x00, 0x00, 0x00, 0x80, // Size 0x62, 0x63, 0x64, 0x65, // CmmType 0x04, 0x30, 0x00, 0x00, // Version @@ -163,11 +163,11 @@ internal static class IccTestDataProfiles 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static readonly byte[] HeaderCorruptRenderingIntentArray = - { + [ 0x00, 0x00, 0x00, 0x80, // Size 0x63, 0x64, 0x65, 0x66, // CmmType 0x04, 0x30, 0x00, 0x00, // Version @@ -192,8 +192,8 @@ internal static class IccTestDataProfiles 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static readonly byte[] HeaderDataTooSmallArray = new byte[127]; @@ -204,20 +204,20 @@ internal static class IccTestDataProfiles public static readonly byte[] HeaderSizeBiggerThanDataArray = CreateHeaderRandomArray(160, 0, HeaderRandomIdArray); public static readonly object[][] ProfileIdTestData = - { - new object[] { HeaderRandomArray, HeaderRandomIdValue }, - new object[] { ProfileRandomArray, ProfileRandomIdValue }, - }; + [ + [HeaderRandomArray, HeaderRandomIdValue], + [ProfileRandomArray, ProfileRandomIdValue] + ]; public static readonly object[][] ProfileValidityTestData = - { - new object[] { HeaderCorruptDataColorSpaceArray, false }, - new object[] { HeaderCorruptProfileConnectionSpaceArray, false }, - new object[] { HeaderCorruptRenderingIntentArray, false }, - new object[] { HeaderDataTooSmallArray, false }, - new object[] { HeaderInvalidSizeSmallArray, false }, - new object[] { HeaderInvalidSizeBigArray, false }, - new object[] { HeaderSizeBiggerThanDataArray, false }, - new object[] { HeaderRandomArray, true }, - }; + [ + [HeaderCorruptDataColorSpaceArray, false], + [HeaderCorruptProfileConnectionSpaceArray, false], + [HeaderCorruptRenderingIntentArray, false], + [HeaderDataTooSmallArray, false], + [HeaderInvalidSizeSmallArray, false], + [HeaderInvalidSizeBigArray, false], + [HeaderSizeBiggerThanDataArray, false], + [HeaderRandomArray, true] + ]; } diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs index a83dc3575..979b0044d 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs @@ -10,40 +10,40 @@ internal static class IccTestDataTagDataEntry { public static readonly IccTypeSignature TagDataEntryHeaderUnknownVal = IccTypeSignature.Unknown; public static readonly byte[] TagDataEntryHeaderUnknownArr = - { - 0x00, 0x00, 0x00, 0x00, + [ 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static readonly IccTypeSignature TagDataEntryHeaderMultiLocalizedUnicodeVal = IccTypeSignature.MultiLocalizedUnicode; public static readonly byte[] TagDataEntryHeaderMultiLocalizedUnicodeArr = - { + [ 0x6D, 0x6C, 0x75, 0x63, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static readonly IccTypeSignature TagDataEntryHeaderCurveVal = IccTypeSignature.Curve; public static readonly byte[] TagDataEntryHeaderCurveArr = - { + [ 0x63, 0x75, 0x72, 0x76, - 0x00, 0x00, 0x00, 0x00, - }; + 0x00, 0x00, 0x00, 0x00 + ]; public static readonly object[][] TagDataEntryHeaderTestData = - { - new object[] { TagDataEntryHeaderUnknownArr, TagDataEntryHeaderUnknownVal }, - new object[] { TagDataEntryHeaderMultiLocalizedUnicodeArr, TagDataEntryHeaderMultiLocalizedUnicodeVal }, - new object[] { TagDataEntryHeaderCurveArr, TagDataEntryHeaderCurveVal }, - }; + [ + [TagDataEntryHeaderUnknownArr, TagDataEntryHeaderUnknownVal], + [TagDataEntryHeaderMultiLocalizedUnicodeArr, TagDataEntryHeaderMultiLocalizedUnicodeVal], + [TagDataEntryHeaderCurveArr, TagDataEntryHeaderCurveVal] + ]; - public static readonly IccUnknownTagDataEntry UnknownVal = new(new byte[] { 0x00, 0x01, 0x02, 0x03 }); + public static readonly IccUnknownTagDataEntry UnknownVal = new([0x00, 0x01, 0x02, 0x03]); - public static readonly byte[] UnknownArr = { 0x00, 0x01, 0x02, 0x03 }; + public static readonly byte[] UnknownArr = [0x00, 0x01, 0x02, 0x03]; public static readonly object[][] UnknownTagDataEntryTestData = - { - new object[] { UnknownArr, UnknownVal, 12u }, - }; + [ + [UnknownArr, UnknownVal, 12u] + ]; public static readonly IccChromaticityTagDataEntry ChromaticityVal1 = new(IccColorantEncoding.ItuRBt709_2); public static readonly byte[] ChromaticityArr1 = ArrayHelper.Concat( @@ -57,11 +57,10 @@ internal static class IccTestDataTagDataEntry new byte[] { 0x00, 0x00, 0x0F, 0x5C }); // 0.060 public static readonly IccChromaticityTagDataEntry ChromaticityVal2 = new( - new[] - { - new double[] { 1, 2 }, - new double[] { 3, 4 }, - }); + [ + [1, 2], + [3, 4] + ]); public static readonly byte[] ChromaticityArr2 = ArrayHelper.Concat( IccTestDataPrimitives.UInt162, @@ -86,25 +85,24 @@ internal static class IccTestDataTagDataEntry IccTestDataPrimitives.UInt169); public static readonly object[][] ChromaticityTagDataEntryTestData = - { - new object[] { ChromaticityArr1, ChromaticityVal1 }, - new object[] { ChromaticityArr2, ChromaticityVal2 }, - }; + [ + [ChromaticityArr1, ChromaticityVal1], + [ChromaticityArr2, ChromaticityVal2] + ]; - public static readonly IccColorantOrderTagDataEntry ColorantOrderVal = new(new byte[] { 0x00, 0x01, 0x02 }); + public static readonly IccColorantOrderTagDataEntry ColorantOrderVal = new([0x00, 0x01, 0x02]); public static readonly byte[] ColorantOrderArr = ArrayHelper.Concat(IccTestDataPrimitives.UInt323, new byte[] { 0x00, 0x01, 0x02 }); public static readonly object[][] ColorantOrderTagDataEntryTestData = - { - new object[] { ColorantOrderArr, ColorantOrderVal }, - }; + [ + [ColorantOrderArr, ColorantOrderVal] + ]; public static readonly IccColorantTableTagDataEntry ColorantTableVal = new( - new[] - { - IccTestDataNonPrimitives.ColorantTableEntryValRand1, + [ + IccTestDataNonPrimitives.ColorantTableEntryValRand1, IccTestDataNonPrimitives.ColorantTableEntryValRand2 - }); + ]); public static readonly byte[] ColorantTableArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt322, @@ -112,9 +110,9 @@ internal static class IccTestDataTagDataEntry IccTestDataNonPrimitives.ColorantTableEntryRand2); public static readonly object[][] ColorantTableTagDataEntryTestData = - { - new object[] { ColorantTableArr, ColorantTableVal }, - }; + [ + [ColorantTableArr, ColorantTableVal] + ]; public static readonly IccCurveTagDataEntry CurveVal0 = new(); public static readonly byte[] CurveArr0 = IccTestDataPrimitives.UInt320; @@ -124,7 +122,7 @@ internal static class IccTestDataTagDataEntry IccTestDataPrimitives.UInt321, IccTestDataPrimitives.UFix81); - public static readonly IccCurveTagDataEntry CurveVal2 = new(new float[] { 1 / 65535f, 2 / 65535f, 3 / 65535f }); + public static readonly IccCurveTagDataEntry CurveVal2 = new([1 / 65535f, 2 / 65535f, 3 / 65535f]); public static readonly byte[] CurveArr2 = ArrayHelper.Concat( IccTestDataPrimitives.UInt323, IccTestDataPrimitives.UInt161, @@ -132,46 +130,47 @@ internal static class IccTestDataTagDataEntry IccTestDataPrimitives.UInt163); public static readonly object[][] CurveTagDataEntryTestData = - { - new object[] { CurveArr0, CurveVal0 }, - new object[] { CurveArr1, CurveVal1 }, - new object[] { CurveArr2, CurveVal2 }, - }; + [ + [CurveArr0, CurveVal0], + [CurveArr1, CurveVal1], + [CurveArr2, CurveVal2] + ]; - public static readonly IccDataTagDataEntry DataValNoAscii = new(new byte[] { 0x01, 0x02, 0x03, 0x04 }, false); + public static readonly IccDataTagDataEntry DataValNoAscii = new([0x01, 0x02, 0x03, 0x04], false); public static readonly byte[] DataArrNoAscii = - { + [ 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04 - }; + ]; - public static readonly IccDataTagDataEntry DataValAscii = new(new[] { (byte)'A', (byte)'S', (byte)'C', (byte)'I', (byte)'I' }, true); + public static readonly IccDataTagDataEntry DataValAscii = new([(byte)'A', (byte)'S', (byte)'C', (byte)'I', (byte)'I' + ], true); public static readonly byte[] DataArrAscii = - { + [ 0x00, 0x00, 0x00, 0x01, (byte)'A', (byte)'S', (byte)'C', (byte)'I', (byte)'I' - }; + ]; public static readonly object[][] DataTagDataEntryTestData = - { - new object[] { DataArrNoAscii, DataValNoAscii, 16u }, - new object[] { DataArrAscii, DataValAscii, 17u }, - }; + [ + [DataArrNoAscii, DataValNoAscii, 16u], + [DataArrAscii, DataValAscii, 17u] + ]; public static readonly IccDateTimeTagDataEntry DateTimeVal = new(IccTestDataNonPrimitives.DateTimeValRand1); public static readonly byte[] DateTimeArr = IccTestDataNonPrimitives.DateTimeRand1; public static readonly object[][] DateTimeTagDataEntryTestData = - { - new object[] { DateTimeArr, DateTimeVal }, - }; + [ + [DateTimeArr, DateTimeVal] + ]; public static readonly IccLut16TagDataEntry Lut16Val = new( - new[] { IccTestDataLut.Lut16ValGrad, IccTestDataLut.Lut16ValGrad }, + [IccTestDataLut.Lut16ValGrad, IccTestDataLut.Lut16ValGrad], IccTestDataLut.Clut16ValGrad, - new[] { IccTestDataLut.Lut16ValGrad, IccTestDataLut.Lut16ValGrad, IccTestDataLut.Lut16ValGrad }); + [IccTestDataLut.Lut16ValGrad, IccTestDataLut.Lut16ValGrad, IccTestDataLut.Lut16ValGrad]); public static readonly byte[] Lut16Arr = ArrayHelper.Concat( new byte[] { 0x02, 0x03, 0x03, 0x00 }, @@ -185,14 +184,14 @@ internal static class IccTestDataTagDataEntry IccTestDataLut.Lut16Grad); public static readonly object[][] Lut16TagDataEntryTestData = - { - new object[] { Lut16Arr, Lut16Val }, - }; + [ + [Lut16Arr, Lut16Val] + ]; public static readonly IccLut8TagDataEntry Lut8Val = new( - new IccLut[] { IccTestDataLut.Lut8ValGrad, IccTestDataLut.Lut8ValGrad }, + [IccTestDataLut.Lut8ValGrad, IccTestDataLut.Lut8ValGrad], IccTestDataLut.Clut8ValGrad, - new IccLut[] { IccTestDataLut.Lut8ValGrad, IccTestDataLut.Lut8ValGrad, IccTestDataLut.Lut8ValGrad }); + [IccTestDataLut.Lut8ValGrad, IccTestDataLut.Lut8ValGrad, IccTestDataLut.Lut8ValGrad]); public static readonly byte[] Lut8Arr = ArrayHelper.Concat( new byte[] { 0x02, 0x03, 0x03, 0x00 }, @@ -204,7 +203,7 @@ internal static class IccTestDataTagDataEntry IccTestDataLut.Lut8Grad, IccTestDataLut.Lut8Grad); - public static readonly object[][] Lut8TagDataEntryTestData = { new object[] { Lut8Arr, Lut8Val }, }; + public static readonly object[][] Lut8TagDataEntryTestData = [[Lut8Arr, Lut8Val]]; private static readonly byte[] CurveFull0 = ArrayHelper.Concat(TagDataEntryHeaderCurveArr, CurveArr0); @@ -214,17 +213,16 @@ internal static class IccTestDataTagDataEntry public static readonly IccLutAToBTagDataEntry LutAToBVal = new( - new[] - { - CurveVal0, + [ + CurveVal0, CurveVal1, - CurveVal2, - }, + CurveVal2 + ], IccTestDataMatrix.Single2DArrayValGrad, IccTestDataMatrix.Single1DArrayValGrad, - new[] { CurveVal1, CurveVal2, CurveVal0 }, + [CurveVal1, CurveVal2, CurveVal0], IccTestDataLut.ClutVal16, - new[] { CurveVal2, CurveVal1 }); + [CurveVal2, CurveVal1]); public static readonly byte[] LutAToBArr = ArrayHelper.Concat( new byte[] { 0x02, 0x03, 0x00, 0x00 }, @@ -262,19 +260,18 @@ internal static class IccTestDataTagDataEntry CurveFull1, // 14 bytes new byte[] { 0x00, 0x00 }); // Padding - public static readonly object[][] LutAToBTagDataEntryTestData = { new object[] { LutAToBArr, LutAToBVal }, }; + public static readonly object[][] LutAToBTagDataEntryTestData = [[LutAToBArr, LutAToBVal]]; public static readonly IccLutBToATagDataEntry LutBToAVal = new( - new[] - { + [ CurveVal0, - CurveVal1, - }, + CurveVal1 + ], null, null, null, IccTestDataLut.ClutVal16, - new[] { CurveVal2, CurveVal1, CurveVal0 }); + [CurveVal2, CurveVal1, CurveVal0]); public static readonly byte[] LutBToAArr = ArrayHelper.Concat( new byte[] { 0x02, 0x03, 0x00, 0x00 }, @@ -301,9 +298,9 @@ internal static class IccTestDataTagDataEntry CurveFull0); // 12 bytes public static readonly object[][] LutBToATagDataEntryTestData = - { - new object[] { LutBToAArr, LutBToAVal }, - }; + [ + [LutBToAArr, LutBToAVal] + ]; public static readonly IccMeasurementTagDataEntry MeasurementVal = new( IccStandardObserver.Cie1931Observer, @@ -320,9 +317,9 @@ internal static class IccTestDataTagDataEntry IccTestDataPrimitives.UInt321); public static readonly object[][] MeasurementTagDataEntryTestData = - { - new object[] { MeasurementArr, MeasurementVal }, - }; + [ + [MeasurementArr, MeasurementVal] + ]; private static readonly IccLocalizedString LocalizedStringRandEnUs = CreateLocalizedString("en", "US", IccTestDataPrimitives.UnicodeValRand2); private static readonly IccLocalizedString LocalizedStringRandDeDe = CreateLocalizedString("de", "DE", IccTestDataPrimitives.UnicodeValRand3); @@ -361,34 +358,34 @@ internal static class IccTestDataTagDataEntry return new IccLocalizedString(culture, text); } - private static readonly IccLocalizedString[] LocalizedStringRandArrEnUsDeDe = new[] - { + private static readonly IccLocalizedString[] LocalizedStringRandArrEnUsDeDe = + [ LocalizedStringRandEnUs, - LocalizedStringRandDeDe, - }; + LocalizedStringRandDeDe + ]; - private static readonly IccLocalizedString[] LocalizedStringRandArrEnInvariant = new[] - { + private static readonly IccLocalizedString[] LocalizedStringRandArrEnInvariant = + [ LocalizedStringRandEn, - LocalizedStringRandInvariant, - }; + LocalizedStringRandInvariant + ]; - private static readonly IccLocalizedString[] LocalizedStringSameArrEnUsDeDeEsXlXyXl = new[] - { + private static readonly IccLocalizedString[] LocalizedStringSameArrEnUsDeDeEsXlXyXl = + [ LocalizedStringRandEnUs, LocalizedStringRand2DeDe, LocalizedStringRand2EsXl, - LocalizedStringRand2XyXl, - }; + LocalizedStringRand2XyXl + ]; public static readonly IccMultiLocalizedUnicodeTagDataEntry MultiLocalizedUnicodeVal = new(LocalizedStringRandArrEnUsDeDe); public static readonly byte[] MultiLocalizedUnicodeArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt322, new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 - new byte[] { (byte)'e', (byte)'n', (byte)'U', (byte)'S' }, + [(byte)'e', (byte)'n', (byte)'U', (byte)'S'], new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 new byte[] { 0x00, 0x00, 0x00, 0x28 }, // 40 - new byte[] { (byte)'d', (byte)'e', (byte)'D', (byte)'E' }, + [(byte)'d', (byte)'e', (byte)'D', (byte)'E'], new byte[] { 0x00, 0x00, 0x00, 0x0E }, // 14 new byte[] { 0x00, 0x00, 0x00, 0x34 }, // 52 IccTestDataPrimitives.UnicodeRand2, @@ -423,40 +420,39 @@ internal static class IccTestDataTagDataEntry public static readonly byte[] MultiLocalizedUnicodeArr3 = ArrayHelper.Concat( IccTestDataPrimitives.UInt324, new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 - new byte[] { (byte)'e', (byte)'n', (byte)'U', (byte)'S' }, + [(byte)'e', (byte)'n', (byte)'U', (byte)'S'], new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 new byte[] { 0x00, 0x00, 0x00, 0x40 }, // 64 - new byte[] { (byte)'d', (byte)'e', (byte)'D', (byte)'E' }, + [(byte)'d', (byte)'e', (byte)'D', (byte)'E'], new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 new byte[] { 0x00, 0x00, 0x00, 0x40 }, // 64 - new byte[] { (byte)'e', (byte)'s', (byte)'X', (byte)'L' }, + [(byte)'e', (byte)'s', (byte)'X', (byte)'L'], new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 new byte[] { 0x00, 0x00, 0x00, 0x40 }, // 64 - new byte[] { (byte)'x', (byte)'y', (byte)'X', (byte)'L' }, + [(byte)'x', (byte)'y', (byte)'X', (byte)'L'], new byte[] { 0x00, 0x00, 0x00, 0x0C }, // 12 new byte[] { 0x00, 0x00, 0x00, 0x40 }, // 64 IccTestDataPrimitives.UnicodeRand2); public static readonly object[][] MultiLocalizedUnicodeTagDataEntryTestDataRead = - { - new object[] { MultiLocalizedUnicodeArr, MultiLocalizedUnicodeVal }, - new object[] { MultiLocalizedUnicodeArr2Read, MultiLocalizedUnicodeVal2 }, - new object[] { MultiLocalizedUnicodeArr3, MultiLocalizedUnicodeVal3 }, - }; + [ + [MultiLocalizedUnicodeArr, MultiLocalizedUnicodeVal], + [MultiLocalizedUnicodeArr2Read, MultiLocalizedUnicodeVal2], + [MultiLocalizedUnicodeArr3, MultiLocalizedUnicodeVal3] + ]; public static readonly object[][] MultiLocalizedUnicodeTagDataEntryTestDataWrite = - { - new object[] { MultiLocalizedUnicodeArr, MultiLocalizedUnicodeVal }, - new object[] { MultiLocalizedUnicodeArr2Write, MultiLocalizedUnicodeVal2 }, - new object[] { MultiLocalizedUnicodeArr3, MultiLocalizedUnicodeVal3 }, - }; + [ + [MultiLocalizedUnicodeArr, MultiLocalizedUnicodeVal], + [MultiLocalizedUnicodeArr2Write, MultiLocalizedUnicodeVal2], + [MultiLocalizedUnicodeArr3, MultiLocalizedUnicodeVal3] + ]; public static readonly IccMultiProcessElementsTagDataEntry MultiProcessElementsVal = new( - new IccMultiProcessElement[] - { - IccTestDataMultiProcessElements.MpeValClut, - IccTestDataMultiProcessElements.MpeValClut, - }); + [ + IccTestDataMultiProcessElements.MpeValClut, + IccTestDataMultiProcessElements.MpeValClut + ]); public static readonly byte[] MultiProcessElementsArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt162, @@ -470,15 +466,15 @@ internal static class IccTestDataTagDataEntry IccTestDataMultiProcessElements.MpeClut); public static readonly object[][] MultiProcessElementsTagDataEntryTestData = - { - new object[] { MultiProcessElementsArr, MultiProcessElementsVal }, - }; + [ + [MultiProcessElementsArr, MultiProcessElementsVal] + ]; public static readonly IccNamedColor2TagDataEntry NamedColor2Val = new( 16909060, ArrayHelper.Fill('A', 31), ArrayHelper.Fill('4', 31), - new IccNamedColor[] { IccTestDataNonPrimitives.NamedColorValMin, IccTestDataNonPrimitives.NamedColorValMin }); + [IccTestDataNonPrimitives.NamedColorValMin, IccTestDataNonPrimitives.NamedColorValMin]); public static readonly byte[] NamedColor2Arr = ArrayHelper.Concat( new byte[] { 0x01, 0x02, 0x03, 0x04 }, @@ -492,24 +488,23 @@ internal static class IccTestDataTagDataEntry IccTestDataNonPrimitives.NamedColorMin); public static readonly object[][] NamedColor2TagDataEntryTestData = - { - new object[] { NamedColor2Arr, NamedColor2Val }, - }; + [ + [NamedColor2Arr, NamedColor2Val] + ]; public static readonly IccParametricCurveTagDataEntry ParametricCurveVal = new(IccTestDataCurves.ParametricValVar1); public static readonly byte[] ParametricCurveArr = IccTestDataCurves.ParametricVar1; public static readonly object[][] ParametricCurveTagDataEntryTestData = - { - new object[] { ParametricCurveArr, ParametricCurveVal }, - }; + [ + [ParametricCurveArr, ParametricCurveVal] + ]; public static readonly IccProfileSequenceDescTagDataEntry ProfileSequenceDescVal = new( - new IccProfileDescription[] - { - IccTestDataNonPrimitives.ProfileDescriptionValRand1, + [ + IccTestDataNonPrimitives.ProfileDescriptionValRand1, IccTestDataNonPrimitives.ProfileDescriptionValRand1 - }); + ]); public static readonly byte[] ProfileSequenceDescArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt322, @@ -517,16 +512,15 @@ internal static class IccTestDataTagDataEntry IccTestDataNonPrimitives.ProfileDescriptionRand1); public static readonly object[][] ProfileSequenceDescTagDataEntryTestData = - { - new object[] { ProfileSequenceDescArr, ProfileSequenceDescVal }, - }; + [ + [ProfileSequenceDescArr, ProfileSequenceDescVal] + ]; public static readonly IccProfileSequenceIdentifierTagDataEntry ProfileSequenceIdentifier_Val = new( - new[] - { - new IccProfileSequenceIdentifier(IccTestDataNonPrimitives.ProfileIdValRand, LocalizedStringRandArrEnUsDeDe), - new IccProfileSequenceIdentifier(IccTestDataNonPrimitives.ProfileIdValRand, LocalizedStringRandArrEnUsDeDe), - }); + [ + new IccProfileSequenceIdentifier(IccTestDataNonPrimitives.ProfileIdValRand, LocalizedStringRandArrEnUsDeDe), + new IccProfileSequenceIdentifier(IccTestDataNonPrimitives.ProfileIdValRand, LocalizedStringRandArrEnUsDeDe) + ]); public static readonly byte[] ProfileSequenceIdentifierArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt322, @@ -544,16 +538,15 @@ internal static class IccTestDataTagDataEntry new byte[] { 0x00, 0x00 }); public static readonly object[][] ProfileSequenceIdentifierTagDataEntryTestData = - { - new object[] { ProfileSequenceIdentifierArr, ProfileSequenceIdentifier_Val }, - }; + [ + [ProfileSequenceIdentifierArr, ProfileSequenceIdentifier_Val] + ]; public static readonly IccResponseCurveSet16TagDataEntry ResponseCurveSet16Val = new( - new[] - { - IccTestDataCurves.ResponseValGrad, - IccTestDataCurves.ResponseValGrad, - }); + [ + IccTestDataCurves.ResponseValGrad, + IccTestDataCurves.ResponseValGrad + ]); public static readonly byte[] ResponseCurveSet16Arr = ArrayHelper.Concat( IccTestDataPrimitives.UInt163, @@ -564,88 +557,88 @@ internal static class IccTestDataTagDataEntry IccTestDataCurves.ResponseGrad); // 88 bytes public static readonly object[][] ResponseCurveSet16TagDataEntryTestData = - { - new object[] { ResponseCurveSet16Arr, ResponseCurveSet16Val }, - }; + [ + [ResponseCurveSet16Arr, ResponseCurveSet16Val] + ]; - public static readonly IccFix16ArrayTagDataEntry Fix16ArrayVal = new(new[] { 1 / 256f, 2 / 256f, 3 / 256f }); + public static readonly IccFix16ArrayTagDataEntry Fix16ArrayVal = new([1 / 256f, 2 / 256f, 3 / 256f]); public static readonly byte[] Fix16ArrayArr = ArrayHelper.Concat( IccTestDataPrimitives.Fix161, IccTestDataPrimitives.Fix162, IccTestDataPrimitives.Fix163); public static readonly object[][] Fix16ArrayTagDataEntryTestData = - { - new object[] { Fix16ArrayArr, Fix16ArrayVal, 20u }, - }; + [ + [Fix16ArrayArr, Fix16ArrayVal, 20u] + ]; public static readonly IccSignatureTagDataEntry SignatureVal = new("ABCD"); - public static readonly byte[] SignatureArr = { 0x41, 0x42, 0x43, 0x44, }; + public static readonly byte[] SignatureArr = [0x41, 0x42, 0x43, 0x44]; public static readonly object[][] SignatureTagDataEntryTestData = - { - new object[] { SignatureArr, SignatureVal }, - }; + [ + [SignatureArr, SignatureVal] + ]; public static readonly IccTextTagDataEntry TextVal = new("ABCD"); - public static readonly byte[] TextArr = { 0x41, 0x42, 0x43, 0x44 }; + public static readonly byte[] TextArr = [0x41, 0x42, 0x43, 0x44]; public static readonly object[][] TextTagDataEntryTestData = - { - new object[] { TextArr, TextVal, 12u }, - }; + [ + [TextArr, TextVal, 12u] + ]; - public static readonly IccUFix16ArrayTagDataEntry UFix16ArrayVal = new(new float[] { 1, 2, 3 }); + public static readonly IccUFix16ArrayTagDataEntry UFix16ArrayVal = new([1, 2, 3]); public static readonly byte[] UFix16ArrayArr = ArrayHelper.Concat( IccTestDataPrimitives.UFix161, IccTestDataPrimitives.UFix162, IccTestDataPrimitives.UFix163); public static readonly object[][] UFix16ArrayTagDataEntryTestData = - { - new object[] { UFix16ArrayArr, UFix16ArrayVal, 20u }, - }; + [ + [UFix16ArrayArr, UFix16ArrayVal, 20u] + ]; - public static readonly IccUInt16ArrayTagDataEntry UInt16ArrayVal = new(new ushort[] { 1, 2, 3 }); + public static readonly IccUInt16ArrayTagDataEntry UInt16ArrayVal = new([1, 2, 3]); public static readonly byte[] UInt16ArrayArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt161, IccTestDataPrimitives.UInt162, IccTestDataPrimitives.UInt163); public static readonly object[][] UInt16ArrayTagDataEntryTestData = - { - new object[] { UInt16ArrayArr, UInt16ArrayVal, 14u }, - }; + [ + [UInt16ArrayArr, UInt16ArrayVal, 14u] + ]; - public static readonly IccUInt32ArrayTagDataEntry UInt32ArrayVal = new(new uint[] { 1, 2, 3 }); + public static readonly IccUInt32ArrayTagDataEntry UInt32ArrayVal = new([1, 2, 3]); public static readonly byte[] UInt32ArrayArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt321, IccTestDataPrimitives.UInt322, IccTestDataPrimitives.UInt323); public static readonly object[][] UInt32ArrayTagDataEntryTestData = - { - new object[] { UInt32ArrayArr, UInt32ArrayVal, 20u }, - }; + [ + [UInt32ArrayArr, UInt32ArrayVal, 20u] + ]; - public static readonly IccUInt64ArrayTagDataEntry UInt64ArrayVal = new(new ulong[] { 1, 2, 3 }); + public static readonly IccUInt64ArrayTagDataEntry UInt64ArrayVal = new([1, 2, 3]); public static readonly byte[] UInt64ArrayArr = ArrayHelper.Concat( IccTestDataPrimitives.UInt641, IccTestDataPrimitives.UInt642, IccTestDataPrimitives.UInt643); public static readonly object[][] UInt64ArrayTagDataEntryTestData = - { - new object[] { UInt64ArrayArr, UInt64ArrayVal, 32u }, - }; + [ + [UInt64ArrayArr, UInt64ArrayVal, 32u] + ]; - public static readonly IccUInt8ArrayTagDataEntry UInt8ArrayVal = new(new byte[] { 1, 2, 3 }); - public static readonly byte[] UInt8ArrayArr = { 1, 2, 3 }; + public static readonly IccUInt8ArrayTagDataEntry UInt8ArrayVal = new([1, 2, 3]); + public static readonly byte[] UInt8ArrayArr = [1, 2, 3]; public static readonly object[][] UInt8ArrayTagDataEntryTestData = - { - new object[] { UInt8ArrayArr, UInt8ArrayVal, 11u }, - }; + [ + [UInt8ArrayArr, UInt8ArrayVal, 11u] + ]; public static readonly IccViewingConditionsTagDataEntry ViewingConditionsVal = new( IccTestDataNonPrimitives.XyzNumberValVar1, @@ -658,16 +651,15 @@ internal static class IccTestDataTagDataEntry IccTestDataPrimitives.UInt321); public static readonly object[][] ViewingConditionsTagDataEntryTestData = - { - new object[] { ViewingConditionsArr, ViewingConditionsVal }, - }; + [ + [ViewingConditionsArr, ViewingConditionsVal] + ]; - public static readonly IccXyzTagDataEntry XyzVal = new(new[] - { + public static readonly IccXyzTagDataEntry XyzVal = new([ IccTestDataNonPrimitives.XyzNumberValVar1, IccTestDataNonPrimitives.XyzNumberValVar2, - IccTestDataNonPrimitives.XyzNumberValVar3, - }); + IccTestDataNonPrimitives.XyzNumberValVar3 + ]); public static readonly byte[] XyzArr = ArrayHelper.Concat( IccTestDataNonPrimitives.XyzNumberVar1, @@ -675,9 +667,9 @@ internal static class IccTestDataTagDataEntry IccTestDataNonPrimitives.XyzNumberVar3); public static readonly object[][] XYZTagDataEntryTestData = - { - new object[] { XyzArr, XyzVal, 44u }, - }; + [ + [XyzArr, XyzVal, 44u] + ]; public static readonly IccTextDescriptionTagDataEntry TextDescriptionVal1 = new( IccTestDataPrimitives.AsciiValRand, @@ -709,10 +701,10 @@ internal static class IccTestDataTagDataEntry ArrayHelper.Fill((byte)0x00, 67)); public static readonly object[][] TextDescriptionTagDataEntryTestData = - { - new object[] { TextDescriptionArr1, TextDescriptionVal1 }, - new object[] { TextDescriptionArr2, TextDescriptionVal2 }, - }; + [ + [TextDescriptionArr1, TextDescriptionVal1], + [TextDescriptionArr2, TextDescriptionVal2] + ]; public static readonly IccCrdInfoTagDataEntry CrdInfoVal = new( IccTestDataPrimitives.AsciiValRand4, @@ -739,13 +731,13 @@ internal static class IccTestDataTagDataEntry new byte[] { 0 }); public static readonly object[][] CrdInfoTagDataEntryTestData = - { - new object[] { CrdInfoArr, CrdInfoVal }, - }; + [ + [CrdInfoArr, CrdInfoVal] + ]; public static readonly IccScreeningTagDataEntry ScreeningVal = new( IccScreeningFlag.DefaultScreens | IccScreeningFlag.UnitLinesPerCm, - new IccScreeningChannel[] { IccTestDataNonPrimitives.ScreeningChannelValRand1, IccTestDataNonPrimitives.ScreeningChannelValRand2 }); + [IccTestDataNonPrimitives.ScreeningChannelValRand1, IccTestDataNonPrimitives.ScreeningChannelValRand2]); public static readonly byte[] ScreeningArr = ArrayHelper.Concat( IccTestDataPrimitives.Int321, @@ -754,13 +746,13 @@ internal static class IccTestDataTagDataEntry IccTestDataNonPrimitives.ScreeningChannelRand2); public static readonly object[][] ScreeningTagDataEntryTestData = - { - new object[] { ScreeningArr, ScreeningVal }, - }; + [ + [ScreeningArr, ScreeningVal] + ]; public static readonly IccUcrBgTagDataEntry UcrBgVal = new( - new ushort[] { 3, 4, 6 }, - new ushort[] { 9, 7, 2, 5 }, + [3, 4, 6], + [9, 7, 2, 5], IccTestDataPrimitives.AsciiValRand); public static readonly byte[] UcrBgArr = ArrayHelper.Concat( @@ -777,9 +769,9 @@ internal static class IccTestDataTagDataEntry new byte[] { 0 }); public static readonly object[][] UcrBgTagDataEntryTestData = - { - new object[] { UcrBgArr, UcrBgVal, 41 }, - }; + [ + [UcrBgArr, UcrBgVal, 41] + ]; public static readonly IccTagDataEntry TagDataEntryCurveVal = CurveVal2; public static readonly byte[] TagDataEntryCurveArr = ArrayHelper.Concat( @@ -801,8 +793,8 @@ internal static class IccTestDataTagDataEntry public static readonly IccTagTableEntry TagDataEntryCurveTable = new(IccProfileTag.Unknown, 0, (uint)TagDataEntryCurveArr.Length - 2); public static readonly object[][] TagDataEntryTestData = - { - new object[] { TagDataEntryCurveArr, TagDataEntryCurveVal }, - new object[] { TagDataEntryMultiLocalizedUnicodeArr, TagDataEntryMultiLocalizedUnicodeVal }, - }; + [ + [TagDataEntryCurveArr, TagDataEntryCurveVal], + [TagDataEntryMultiLocalizedUnicodeArr, TagDataEntryMultiLocalizedUnicodeVal] + ]; } diff --git a/tests/ImageSharp.Tests/TestFile.cs b/tests/ImageSharp.Tests/TestFile.cs index a53e50806..1177152c0 100644 --- a/tests/ImageSharp.Tests/TestFile.cs +++ b/tests/ImageSharp.Tests/TestFile.cs @@ -117,7 +117,7 @@ public sealed class TestFile /// The . /// public Image CreateRgba32Image(IImageDecoder decoder) - => this.CreateRgba32Image(decoder, new()); + => this.CreateRgba32Image(decoder, new DecoderOptions()); /// /// Creates a new image. diff --git a/tests/ImageSharp.Tests/TestFontUtilities.cs b/tests/ImageSharp.Tests/TestFontUtilities.cs index 01b1faa45..a2c203267 100644 --- a/tests/ImageSharp.Tests/TestFontUtilities.cs +++ b/tests/ImageSharp.Tests/TestFontUtilities.cs @@ -37,13 +37,13 @@ public static class TestFontUtilities /// private static string GetFontsDirectory() { - List directories = new List - { - "TestFonts/", // Here for code coverage tests. - "tests/ImageSharp.Tests/TestFonts/", // from travis/build script - "../../../../../ImageSharp.Tests/TestFonts/", // from Sandbox46 - "../../../../TestFonts/" - }; + List directories = + [ + "TestFonts/", // Here for code coverage tests. + "tests/ImageSharp.Tests/TestFonts/", // from travis/build script + "../../../../../ImageSharp.Tests/TestFonts/", // from Sandbox46 + "../../../../TestFonts/" + ]; directories = directories.SelectMany(x => new[] { @@ -59,7 +59,7 @@ public static class TestFontUtilities return directory; } - throw new System.Exception($"Unable to find Fonts directory at any of these locations [{string.Join(", ", directories)}]"); + throw new Exception($"Unable to find Fonts directory at any of these locations [{string.Join(", ", directories)}]"); } /// diff --git a/tests/ImageSharp.Tests/TestFormat.cs b/tests/ImageSharp.Tests/TestFormat.cs index d30ce7846..28bfcfaa8 100644 --- a/tests/ImageSharp.Tests/TestFormat.cs +++ b/tests/ImageSharp.Tests/TestFormat.cs @@ -28,7 +28,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat this.Decoder = new TestDecoder(this); } - public List DecodeCalls { get; } = new(); + public List DecodeCalls { get; } = []; public TestEncoder Encoder { get; } @@ -38,7 +38,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat public MemoryStream CreateStream(byte[] marker = null) { - var ms = new MemoryStream(); + MemoryStream ms = new(); byte[] data = this.header; ms.Write(data, 0, data.Length); if (marker != null) @@ -54,7 +54,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat { byte[] buffer = new byte[size]; this.header.CopyTo(buffer, 0); - var semaphoreStream = new SemaphoreReadMemoryStream(buffer, waitAfterPosition, notifyWaitPositionReachedSemaphore, continueSemaphore); + SemaphoreReadMemoryStream semaphoreStream = new(buffer, waitAfterPosition, notifyWaitPositionReachedSemaphore, continueSemaphore); return seeakable ? semaphoreStream : new AsyncStreamWrapper(semaphoreStream, () => false); } @@ -103,7 +103,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat public string Extension => "test_ext"; - public IEnumerable SupportedExtensions => new[] { "test_ext" }; + public IEnumerable SupportedExtensions => ["test_ext"]; public int HeaderSize => this.header.Length; @@ -111,7 +111,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat public string DefaultMimeType => this.MimeType; - public IEnumerable MimeTypes => new[] { this.MimeType }; + public IEnumerable MimeTypes => [this.MimeType]; public IEnumerable FileExtensions => this.SupportedExtensions; @@ -193,7 +193,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat public TestDecoder(TestFormat testFormat) => this.testFormat = testFormat; - public IEnumerable MimeTypes => new[] { this.testFormat.MimeType }; + public IEnumerable MimeTypes => [this.testFormat.MimeType]; public IEnumerable FileExtensions => this.testFormat.SupportedExtensions; @@ -205,7 +205,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat { using Image image = this.Decode(this.CreateDefaultSpecializedOptions(options), stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; @@ -246,7 +246,7 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat public TestEncoder(TestFormat testFormat) => this.testFormat = testFormat; - public IEnumerable MimeTypes => new[] { this.testFormat.MimeType }; + public IEnumerable MimeTypes => [this.testFormat.MimeType]; public IEnumerable FileExtensions => this.testFormat.SupportedExtensions; diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 0908e6e6b..764954cae 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -62,6 +62,7 @@ public static class TestImages public const string TestPattern31x31HalfTransparent = "Png/testpattern31x31-halftransparent.png"; public const string XmpColorPalette = "Png/xmp-colorpalette.png"; public const string AdamHeadsHlg = "Png/adamHeadsHLG.png"; + public const string IptcMetadata = "Png/iptc-profile.png"; // Animated // https://philip.html5.org/tests/apng/tests.html @@ -163,6 +164,18 @@ public static class TestImages // Issue 2924: https://github.com/SixLabors/ImageSharp/issues/2924 public const string Issue2924 = "Png/issues/Issue_2924.png"; + // Issue 3000: https://github.com/SixLabors/ImageSharp/issues/3000 + public const string Issue3000 = "Png/issues/issue_3000.png"; + + public static class Icc + { + public const string SRgbGray = "Png/icc-profiles/sRGB_Gray.png"; + public const string SRgbGrayInterlacedRgba32 = "Png/icc-profiles/sRGB_Gray_Interlaced_Rgba32.png"; + public const string SRgbGrayInterlacedRgba64 = "Png/icc-profiles/sRGB_Gray_Interlaced_Rgba64.png"; + public const string Perceptual = "Png/icc-profiles/Perceptual.png"; + public const string PerceptualcLUTOnly = "Png/icc-profiles/Perceptual-cLUT-only.png"; + } + public static class Bad { public const string MissingDataChunk = "Png/xdtn0g01.png"; @@ -216,6 +229,9 @@ public static class TestImages public const string AppleRGB = "Jpg/icc-profiles/Momiji-AppleRGB-yes.jpg"; public const string CMYK = "Jpg/icc-profiles/issue-129.jpg"; public const string YCCK = "Jpg/icc-profiles/issue_2723.jpg"; + public const string SRgbGray = "Jpg/icc-profiles/sRGB_Gray.jpg"; + public const string Perceptual = "Jpg/icc-profiles/Perceptual.jpg"; + public const string PerceptualcLUTOnly = "Jpg/icc-profiles/Perceptual-cLUT-only.jpg"; } public static class Progressive @@ -231,7 +247,7 @@ public static class TestImages public const string ExifUndefType = "Jpg/progressive/ExifUndefType.jpg"; } - public static readonly string[] All = { Fb, Progress, Festzug }; + public static readonly string[] All = [Fb, Progress, Festzug]; } public static class Baseline @@ -287,12 +303,12 @@ public static class TestImages public const string ArithmeticCodingWithRestart = "Jpg/baseline/Calliphora-arithmetic-restart.jpg"; public static readonly string[] All = - { + [ Cmyk, Ycck, Exif, Floorplan, Calliphora, Turtle420, GammaDalaiLamaGray, Hiyamugi, Jpeg400, Jpeg420Exif, Jpeg444, Ratio1x1, Testorig12bit, YcckSubsample1222 - }; + ]; } public static class Issues @@ -342,6 +358,7 @@ public static class TestImages public const string Issue2638 = "Jpg/issues/Issue2638.jpg"; public const string Issue2758 = "Jpg/issues/issue-2758.jpg"; public const string Issue2857 = "Jpg/issues/issue-2857-subsub-ifds.jpg"; + public const string Issue2948 = "Jpg/issues/issue-2948-sos.jpg"; public static class Fuzz { @@ -470,24 +487,24 @@ public static class TestImages public const string BlackWhitePalletDataMatrix = "Bmp/bit1datamatrix.bmp"; public static readonly string[] BitFields = - { - Rgb32bfdef, + [ + Rgb32bfdef, Rgb32bf, Rgb16565, Rgb16bfdef, Rgb16565pal, - Issue735, - }; + Issue735 + ]; public static readonly string[] Miscellaneous = - { + [ Car, F, NegHeight - }; + ]; public static readonly string[] Benchmark = - { + [ Car, F, NegHeight, @@ -504,7 +521,7 @@ public static class TestImages Bit16, Bit16Inverted, Bit32Rgb - }; + ]; } public static class Gif @@ -581,10 +598,12 @@ public static class TestImages public const string Issue2866 = "Gif/issues/issue_2866.gif"; public const string Issue2859_A = "Gif/issues/issue_2859_A.gif"; public const string Issue2859_B = "Gif/issues/issue_2859_B.gif"; + public const string Issue2953 = "Gif/issues/issue_2953.gif"; + public const string Issue2980 = "Gif/issues/issue_2980.gif"; } public static readonly string[] Animated = - { + [ M4nb, Giphy, Cheers, @@ -603,7 +622,7 @@ public static class TestImages Issues.Issue1530, Bit18RGBCube, Global256NoTrans - }; + ]; } public static class Tga @@ -875,12 +894,19 @@ public static class TestImages public const string Issue2801 = "Webp/issues/Issue2801.webp"; public const string Issue2866 = "Webp/issues/Issue2866.webp"; public const string Issue2925 = "Webp/issues/Issue2925.webp"; + public const string Issue2906 = "Webp/issues/Issue2906.webp"; } public const string AlphaBlend = "Webp/alpha-blend.webp"; public const string AlphaBlend2 = "Webp/alpha-blend-2.webp"; public const string AlphaBlend3 = "Webp/alpha-blend-3.webp"; public const string AlphaBlend4 = "Webp/alpha-blend-4.webp"; + + public static class Icc + { + public const string Perceptual = "Webp/icc-profiles/Perceptual.webp"; + public const string PerceptualcLUTOnly = "Webp/icc-profiles/Perceptual-cLUT-only.webp"; + } } public static class Tiff @@ -1132,10 +1158,12 @@ public static class TestImages public const string Issues2435 = "Tiff/Issues/Issue2435.tiff"; public const string Issues2454_A = "Tiff/Issues/Issue2454_A.tif"; public const string Issues2454_B = "Tiff/Issues/Issue2454_B.tif"; + public const string Issues3031 = "Tiff/Issues/Issue3031.tiff"; public const string Issues2587 = "Tiff/Issues/Issue2587.tiff"; public const string Issues2679 = "Tiff/Issues/Issue2679.tiff"; public const string JpegCompressedGray0000539558 = "Tiff/Issues/JpegCompressedGray-0000539558.tiff"; public const string Tiled0000023664 = "Tiff/Issues/tiled-0000023664.tiff"; + public const string ExtraSamplesUnspecified = "Tiff/Issues/ExtraSamplesUnspecified.tif"; public const string SmallRgbDeflate = "Tiff/rgb_small_deflate.tiff"; public const string SmallRgbLzw = "Tiff/rgb_small_lzw.tiff"; @@ -1160,10 +1188,20 @@ public static class TestImages public const string IptcData = "Tiff/iptc.tiff"; public const string Issue2909 = "Tiff/Issues/Issue2909.tiff"; + public const string Issue2983 = "Tiff/Issues/Issue2983.tiff"; - public static readonly string[] Multiframes = { MultiframeDeflateWithPreview, MultiframeLzwPredictor /*, MultiFrameDifferentSize, MultiframeDifferentSizeTiled, MultiFrameDifferentVariants,*/ }; + public static readonly string[] Multiframes = [MultiframeDeflateWithPreview, MultiframeLzwPredictor /*, MultiFrameDifferentSize, MultiframeDifferentSizeTiled, MultiFrameDifferentVariants,*/ + ]; - public static readonly string[] Metadata = { SampleMetadata }; + public static readonly string[] Metadata = [SampleMetadata]; + + public static class Icc + { + public const string PerceptualCmyk = "Tiff/icc-profiles/Perceptual_CMYK.tiff"; + public const string PerceptualCieLab = "Tiff/icc-profiles/Perceptual_CIELAB.tiff"; + public const string PerceptualRgb8 = "Tiff/icc-profiles/Perceptual_RGB8.tiff"; + public const string PerceptualRgb16 = "Tiff/icc-profiles/Perceptual_RGB16.tiff"; + } } public static class BigTiff diff --git a/tests/ImageSharp.Tests/TestUtilities/ArrayHelper.cs b/tests/ImageSharp.Tests/TestUtilities/ArrayHelper.cs index 8ff2abd90..90a98d1c8 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ArrayHelper.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ArrayHelper.cs @@ -13,7 +13,7 @@ public static class ArrayHelper /// The concatenated array public static T[] Concat(params T[][] arrays) { - var result = new T[arrays.Sum(t => t.Length)]; + T[] result = new T[arrays.Sum(t => t.Length)]; int offset = 0; for (int i = 0; i < arrays.Length; i++) { @@ -33,7 +33,7 @@ public static class ArrayHelper /// The created array filled with the given value public static T[] Fill(T value, int length) { - var result = new T[length]; + T[] result = new T[length]; for (int i = 0; i < length; i++) { result[i] = value; diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs index 592ebb4eb..7191f3ba7 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs @@ -70,7 +70,7 @@ public abstract class ImageDataAttributeBase : DataAttribute if (!addedRows.Any()) { - addedRows = new[] { Array.Empty() }; + addedRows = [[]]; } bool firstIsProvider = this.FirstIsProvider(testMethod); diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBasicTestPatternImagesAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBasicTestPatternImagesAttribute.cs index d82d5cd91..349db60f2 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBasicTestPatternImagesAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBasicTestPatternImagesAttribute.cs @@ -31,5 +31,6 @@ public class WithBasicTestPatternImagesAttribute : ImageDataAttributeBase protected override string GetFactoryMethodName(MethodInfo testMethod) => "BasicTestPattern"; - protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => new object[] { this.Width, this.Height }; + protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => [this.Width, this.Height + ]; } diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImagesAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImagesAttribute.cs index e9f57a7ab..ec637a7b6 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImagesAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImagesAttribute.cs @@ -46,5 +46,6 @@ public class WithBlankImagesAttribute : ImageDataAttributeBase protected override string GetFactoryMethodName(MethodInfo testMethod) => "Blank"; - protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => new object[] { this.Width, this.Height }; + protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => [this.Width, this.Height + ]; } diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs index cf472699a..3392d97ab 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs @@ -39,7 +39,7 @@ public class WithFileAttribute : ImageDataAttributeBase this.fileName = fileName; } - protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => new object[] { this.fileName }; + protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => [this.fileName]; protected override string GetFactoryMethodName(MethodInfo testMethod) => "File"; } diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs index 57949e7b1..87f6f0479 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs @@ -58,7 +58,7 @@ public class WithFileCollectionAttribute : ImageDataAttributeBase Func accessor = this.GetPropertyAccessor(testMethod.DeclaringType, this.fileEnumeratorMemberName); accessor = accessor ?? this.GetFieldAccessor(testMethod.DeclaringType, this.fileEnumeratorMemberName); - var files = (IEnumerable)accessor(); + IEnumerable files = (IEnumerable)accessor(); return files.Select(f => new object[] { f }); } diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs index cd27eaf0b..59c092b40 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs @@ -29,7 +29,7 @@ public class WithMemberFactoryAttribute : ImageDataAttributeBase protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) { - return new object[] { testMethod.DeclaringType.FullName, this.memberMethodName }; + return [testMethod.DeclaringType.FullName, this.memberMethodName]; } protected override string GetFactoryMethodName(MethodInfo testMethod) => "Lambda"; diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs index a4149f735..cc4f6f7f3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs @@ -160,7 +160,7 @@ public class WithSolidFilledImagesAttribute : WithBlankImagesAttribute public byte A { get; } protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) - => new object[] { this.Width, this.Height, this.R, this.G, this.B, this.A }; + => [this.Width, this.Height, this.R, this.G, this.B, this.A]; protected override string GetFactoryMethodName(MethodInfo testMethod) => "Solid"; } diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImagesAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImagesAttribute.cs index 4b016d5ea..2630acea8 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImagesAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImagesAttribute.cs @@ -50,5 +50,6 @@ public class WithTestPatternImagesAttribute : ImageDataAttributeBase protected override string GetFactoryMethodName(MethodInfo testMethod) => "TestPattern"; - protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => new object[] { this.Width, this.Height }; + protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => [this.Width, this.Height + ]; } diff --git a/tests/ImageSharp.Tests/TestUtilities/ByteArrayUtility.cs b/tests/ImageSharp.Tests/TestUtilities/ByteArrayUtility.cs index 963c3c783..2fb75444e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ByteArrayUtility.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ByteArrayUtility.cs @@ -11,7 +11,7 @@ public static class ByteArrayUtility { if (isLittleEndian != BitConverter.IsLittleEndian) { - var reversedBytes = new byte[bytes.Length]; + byte[] reversedBytes = new byte[bytes.Length]; Array.Copy(bytes, reversedBytes, bytes.Length); Array.Reverse(reversedBytes); return reversedBytes; diff --git a/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs b/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs index 45e1425c7..548354450 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ByteBuffer.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; public class ByteBuffer { - private readonly List bytes = new List(); + private readonly List bytes = new(); private readonly bool isLittleEndian; public ByteBuffer(bool isLittleEndian) diff --git a/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs b/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs index 63126dcbc..d3671abd4 100644 --- a/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs +++ b/tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs @@ -436,37 +436,38 @@ public enum HwIntrinsics : long // Use flags so we can pass multiple values without using params. // Don't base on 0 or use inverse for All as that doesn't translate to string values. DisableHWIntrinsic = 1L << 0, - DisableSSE = 1L << 1, - DisableSSE2 = 1L << 2, - DisableAES = 1L << 3, - DisablePCLMULQDQ = 1L << 4, - DisableSSE3 = 1L << 5, - DisableSSSE3 = 1L << 6, - DisableSSE41 = 1L << 7, - DisableSSE42 = 1L << 8, - DisablePOPCNT = 1L << 9, - DisableAVX = 1L << 10, - DisableFMA = 1L << 11, - DisableAVX2 = 1L << 12, + DisableSSE42 = 1L << 1, + DisableAVX = 1L << 2, + DisableAVX2 = 1L << 3, + DisableAVX512 = 1L << 4, + DisableAVX512v2 = 1L << 5, + DisableAVX512v3 = 1L << 6, + DisableAVX10v1 = 1L << 7, + DisableAVX10v2 = 1L << 8, + DisableAPX = 1L << 9, + DisableAES = 1L << 10, + DisableAVX512VP2INTERSECT = 1L << 11, + DisableAVXIFMA = 1L << 12, DisableAVXVNNI = 1L << 13, - DisableAVX512BW = 1L << 14, - DisableAVX512BW_VL = 1L << 15, - DisableAVX512CD = 1L << 16, - DisableAVX512CD_VL = 1L << 17, - DisableAVX512DQ = 1L << 18, - DisableAVX512DQ_VL = 1L << 19, - DisableAVX512F = 1L << 20, - DisableAVX512F_VL = 1L << 21, - DisableAVX512VBMI = 1L << 22, - DisableAVX512VBMI_VL = 1L << 23, - DisableBMI1 = 1L << 24, - DisableBMI2 = 1L << 25, - DisableLZCNT = 1L << 26, - DisableArm64AdvSimd = 1L << 27, - DisableArm64Crc32 = 1L << 28, - DisableArm64Dp = 1L << 29, - DisableArm64Aes = 1L << 30, - DisableArm64Sha1 = 1L << 31, - DisableArm64Sha256 = 1L << 32, - AllowAll = 1L << 33 + DisableAVXVNNIINT = 1L << 14, + DisableGFNI = 1L << 15, + DisableSHA = 1L << 16, + DisableVAES = 1L << 17, + DisableWAITPKG = 1L << 18, + DisableX86Serialize = 1 << 19, + // Arm64 + DisableArm64Aes = 1L << 20, + DisableArm64Atomics = 1L << 21, + DisableArm64Crc32 = 1L << 22, + DisableArm64Dczva = 1L << 23, + DisableArm64Dp = 1L << 24, + DisableArm64Rdm = 1L << 25, + DisableArm64Sha1 = 1L << 26, + DisableArm64Sha256 = 1L << 27, + DisableArm64Sve = 1L << 28, + DisableArm64Sve2 = 1L << 29, + // RISC-V64 + DisableRiscV64Zba = 1L << 30, + DisableRiscV64Zbb = 1L << 31, + AllowAll = 1L << 32, } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs index 92fc06eff..c6bb38dd8 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs @@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; public class ExactImageComparer : ImageComparer { - public static ExactImageComparer Instance { get; } = new ExactImageComparer(); + public static ExactImageComparer Instance { get; } = new(); public override ImageSimilarityReport CompareImagesOrFrames( int index, @@ -23,10 +23,10 @@ public class ExactImageComparer : ImageComparer int width = actual.Width; // 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 bBuffer = new Rgba64[width]; + Rgba64[] aBuffer = new Rgba64[width]; + Rgba64[] bBuffer = new Rgba64[width]; - var differences = new List(); + List differences = []; Configuration configuration = expected.Configuration; Buffer2D expectedBuffer = expected.PixelBuffer; Buffer2D actualBuffer = actual.PixelBuffer; @@ -46,7 +46,7 @@ public class ExactImageComparer : ImageComparer if (aPixel != bPixel) { - var diff = new PixelDifference(new Point(x, y), aPixel, bPixel); + PixelDifference diff = new(new Point(x, y), aPixel, bPixel); differences.Add(diff); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs index 7153674e6..d7352de58 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparer.cs @@ -51,7 +51,7 @@ public static class ImageComparerExtensions where TPixelA : unmanaged, IPixel where TPixelB : unmanaged, IPixel { - List> result = new(); + List> result = []; int expectedFrameCount = actual.Frames.Count; if (predicate != null) @@ -147,7 +147,7 @@ public static class ImageComparerExtensions IEnumerable> reports = comparer.CompareImages(expected, actual); if (reports.Any()) { - var cleanedReports = new List>(reports.Count()); + List> cleanedReports = new(reports.Count()); foreach (ImageSimilarityReport r in reports) { IEnumerable outsideChanges = r.Differences.Where( diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs index c50ae5e21..1594258e0 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs @@ -61,7 +61,7 @@ public class ImageSimilarityReport private string PrintDifference() { - var sb = new StringBuilder(); + StringBuilder sb = new(); if (this.TotalNormalizedDifference.HasValue) { sb.AppendLine(); @@ -103,7 +103,7 @@ public class ImageSimilarityReport : ImageSimilarityReport } public static ImageSimilarityReport Empty => - new ImageSimilarityReport(0, null, null, Enumerable.Empty(), 0f); + new(0, null, null, Enumerable.Empty(), 0f); public new ImageFrame ExpectedImage => (ImageFrame)base.ExpectedImage; diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs index d057267da..47cf7e6a5 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs @@ -65,12 +65,12 @@ public class TolerantImageComparer : ImageComparer int width = actual.Width; // TODO: Comparing through Rgba64 may not robust enough because of the existence of super high precision pixel types. - var aBuffer = new Rgba64[width]; - var bBuffer = new Rgba64[width]; + Rgba64[] aBuffer = new Rgba64[width]; + Rgba64[] bBuffer = new Rgba64[width]; float totalDifference = 0F; - var differences = new List(); + List differences = []; Configuration configuration = expected.Configuration; Buffer2D expectedBuffer = expected.PixelBuffer; Buffer2D actualBuffer = actual.PixelBuffer; @@ -89,7 +89,7 @@ public class TolerantImageComparer : ImageComparer if (d > this.PerPixelManhattanThreshold) { - var diff = new PixelDifference(new Point(x, y), aBuffer[x], bBuffer[x]); + PixelDifference diff = new(new Point(x, y), aBuffer[x], bBuffer[x]); differences.Add(diff); totalDifference += d; diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs index 5a31707bf..c8c3e09c3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs @@ -33,7 +33,7 @@ public abstract partial class TestImageProvider : IXunitSerializable protected int Width { get; private set; } - public override Image GetImage() => new Image(this.Configuration, this.Width, this.Height); + public override Image GetImage() => new(this.Configuration, this.Width, this.Height); public override void Deserialize(IXunitSerializationInfo info) { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs index 3652d77a1..3f6e78a34 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -45,7 +45,7 @@ public abstract partial class TestImageProvider : IXunitSerializable { Type type = options.GetType(); - var data = new Dictionary(); + Dictionary data = new(); while (type != null && type != typeof(object)) { @@ -196,7 +196,7 @@ public abstract partial class TestImageProvider : IXunitSerializable return this.DecodeImage(decoder, options); } - var key = new Key(this.PixelType, this.FilePath, decoder, options, null); + Key key = new(this.PixelType, this.FilePath, decoder, options, null); Image cachedImage = Cache.GetOrAdd(key, _ => this.DecodeImage(decoder, options)); return cachedImage.Clone(this.Configuration); @@ -233,7 +233,7 @@ public abstract partial class TestImageProvider : IXunitSerializable return this.DecodeImage(decoder, options); } - var key = new Key(this.PixelType, this.FilePath, decoder, options.GeneralOptions, options); + Key key = new(this.PixelType, this.FilePath, decoder, options.GeneralOptions, options); Image cachedImage = Cache.GetOrAdd(key, _ => this.DecodeImage(decoder, options)); return cachedImage.Clone(this.Configuration); @@ -270,7 +270,7 @@ public abstract partial class TestImageProvider : IXunitSerializable { options.SetConfiguration(this.Configuration); - var testFile = TestFile.Create(this.FilePath); + TestFile testFile = TestFile.Create(this.FilePath); using Stream stream = new MemoryStream(testFile.Bytes); return decoder.Decode(options, stream); } @@ -280,7 +280,7 @@ public abstract partial class TestImageProvider : IXunitSerializable { options.GeneralOptions.SetConfiguration(this.Configuration); - var testFile = TestFile.Create(this.FilePath); + TestFile testFile = TestFile.Create(this.FilePath); using Stream stream = new MemoryStream(testFile.Bytes); return decoder.Decode(options, stream); } @@ -288,7 +288,7 @@ public abstract partial class TestImageProvider : IXunitSerializable public static string GetFilePathOrNull(ITestImageProvider provider) { - var fileProvider = provider as FileProvider; + FileProvider fileProvider = provider as FileProvider; return fileProvider?.FilePath; } } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/MemberMethodProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/MemberMethodProvider.cs index 390195274..6da5b75f0 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/MemberMethodProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/MemberMethodProvider.cs @@ -54,7 +54,7 @@ public abstract partial class TestImageProvider : IXunitSerializable private Func> GetFactory() { - var declaringType = Type.GetType(this.declaringTypeName); + Type declaringType = Type.GetType(this.declaringTypeName); MethodInfo m = declaringType.GetMethod(this.methodName); Type pixelType = typeof(TPixel); Type imgType = typeof(Image<>).MakeGenericType(pixelType); diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 8f22fb2b2..ab624126b 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -88,10 +88,10 @@ public abstract partial class TestImageProvider : ITestImageProvider, IX public abstract Image GetImage(); public Image GetImage(IImageDecoder decoder) - => this.GetImage(decoder, new()); + => this.GetImage(decoder, new DecoderOptions()); public Task> GetImageAsync(IImageDecoder decoder) - => this.GetImageAsync(decoder, new()); + => this.GetImageAsync(decoder, new DecoderOptions()); public virtual Image GetImage(IImageDecoder decoder, DecoderOptions options) => throw new NotSupportedException($"Decoder specific GetImage() is not supported with {this.GetType().Name}!"); diff --git a/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs b/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs index de42ba0cc..81f16cf6b 100644 --- a/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs +++ b/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs @@ -30,7 +30,7 @@ public class MeasureFixture this.Output?.WriteLine($"{operationName} X {times} ..."); } - var sw = Stopwatch.StartNew(); + Stopwatch sw = Stopwatch.StartNew(); for (int i = 0; i < times; i++) { @@ -60,7 +60,7 @@ public class MeasureGuard : IDisposable { private readonly string operation; - private readonly Stopwatch stopwatch = new Stopwatch(); + private readonly Stopwatch stopwatch = new(); public MeasureGuard(ITestOutputHelper output, string operation) { diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs index bdc78f3f5..862d4b64d 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/MagickReferenceDecoder.cs @@ -32,15 +32,15 @@ public class MagickReferenceDecoder : ImageDecoder this.validate = validate; } - public static MagickReferenceDecoder Png { get; } = new MagickReferenceDecoder(PngFormat.Instance); + public static MagickReferenceDecoder Png { get; } = new(PngFormat.Instance); - public static MagickReferenceDecoder Bmp { get; } = new MagickReferenceDecoder(BmpFormat.Instance); + public static MagickReferenceDecoder Bmp { get; } = new(BmpFormat.Instance); - public static MagickReferenceDecoder Jpeg { get; } = new MagickReferenceDecoder(JpegFormat.Instance); + public static MagickReferenceDecoder Jpeg { get; } = new(JpegFormat.Instance); - public static MagickReferenceDecoder Tiff { get; } = new MagickReferenceDecoder(TiffFormat.Instance); + public static MagickReferenceDecoder Tiff { get; } = new(TiffFormat.Instance); - public static MagickReferenceDecoder WebP { get; } = new MagickReferenceDecoder(WebpFormat.Instance); + public static MagickReferenceDecoder WebP { get; } = new(WebpFormat.Instance); protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken) { @@ -103,7 +103,7 @@ public class MagickReferenceDecoder : ImageDecoder } } - return ReferenceCodecUtilities.EnsureDecodedMetadata(new(configuration, metadata, framesList), this.imageFormat); + return ReferenceCodecUtilities.EnsureDecodedMetadata(new Image(configuration, metadata, framesList), this.imageFormat); } protected override Image Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken) @@ -113,7 +113,7 @@ public class MagickReferenceDecoder : ImageDecoder { using Image image = this.Decode(options, stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs index 04f59979f..84be9e3a9 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs @@ -27,7 +27,7 @@ public static class SystemDrawingBridge int w = bmp.Width; int h = bmp.Height; - var fullRect = new System.Drawing.Rectangle(0, 0, w, h); + System.Drawing.Rectangle fullRect = new(0, 0, w, h); if (bmp.PixelFormat != PixelFormat.Format32bppArgb) { @@ -37,7 +37,7 @@ public static class SystemDrawingBridge } BitmapData data = bmp.LockBits(fullRect, ImageLockMode.ReadWrite, bmp.PixelFormat); - var image = new Image(w, h); + Image image = new(w, h); try { byte* sourcePtrBase = (byte*)data.Scan0; @@ -86,7 +86,7 @@ public static class SystemDrawingBridge int w = bmp.Width; int h = bmp.Height; - var fullRect = new System.Drawing.Rectangle(0, 0, w, h); + System.Drawing.Rectangle fullRect = new(0, 0, w, h); if (bmp.PixelFormat != PixelFormat.Format24bppRgb) { @@ -96,7 +96,7 @@ public static class SystemDrawingBridge } BitmapData data = bmp.LockBits(fullRect, ImageLockMode.ReadWrite, bmp.PixelFormat); - var image = new Image(w, h); + Image image = new(w, h); try { byte* sourcePtrBase = (byte*)data.Scan0; @@ -138,8 +138,8 @@ public static class SystemDrawingBridge int w = image.Width; int h = image.Height; - var resultBitmap = new Bitmap(w, h, PixelFormat.Format32bppArgb); - var fullRect = new System.Drawing.Rectangle(0, 0, w, h); + Bitmap resultBitmap = new(w, h, PixelFormat.Format32bppArgb); + System.Drawing.Rectangle fullRect = new(0, 0, w, h); BitmapData data = resultBitmap.LockBits(fullRect, ImageLockMode.ReadWrite, resultBitmap.PixelFormat); try { diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs index 14a655823..fce2da05f 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs @@ -18,15 +18,15 @@ public class SystemDrawingReferenceDecoder : ImageDecoder public SystemDrawingReferenceDecoder(IImageFormat imageFormat) => this.imageFormat = imageFormat; - public static SystemDrawingReferenceDecoder Png { get; } = new SystemDrawingReferenceDecoder(PngFormat.Instance); + public static SystemDrawingReferenceDecoder Png { get; } = new(PngFormat.Instance); - public static SystemDrawingReferenceDecoder Bmp { get; } = new SystemDrawingReferenceDecoder(BmpFormat.Instance); + public static SystemDrawingReferenceDecoder Bmp { get; } = new(BmpFormat.Instance); protected override ImageInfo Identify(DecoderOptions options, Stream stream, CancellationToken cancellationToken) { using Image image = this.Decode(options, stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs index 0789ab263..f9769b891 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs @@ -15,9 +15,9 @@ public class SystemDrawingReferenceEncoder : IImageEncoder public SystemDrawingReferenceEncoder(ImageFormat imageFormat) => this.imageFormat = imageFormat; - public static SystemDrawingReferenceEncoder Png { get; } = new SystemDrawingReferenceEncoder(ImageFormat.Png); + public static SystemDrawingReferenceEncoder Png { get; } = new(ImageFormat.Png); - public static SystemDrawingReferenceEncoder Bmp { get; } = new SystemDrawingReferenceEncoder(ImageFormat.Bmp); + public static SystemDrawingReferenceEncoder Bmp { get; } = new(ImageFormat.Bmp); public bool SkipMetadata { get; init; } diff --git a/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs b/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs index edae08ce1..d8b0ff785 100644 --- a/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs +++ b/tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs @@ -18,7 +18,7 @@ public class SixLaborsXunitTestFramework : XunitTestFramework public SixLaborsXunitTestFramework(IMessageSink messageSink) : base(messageSink) { - var message = new DiagnosticMessage(HostEnvironmentInfo.GetInformation()); + DiagnosticMessage message = new(HostEnvironmentInfo.GetInformation()); messageSink.OnMessage(message); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/TestDataGenerator.cs b/tests/ImageSharp.Tests/TestUtilities/TestDataGenerator.cs index 31de3909e..53f0f0648 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestDataGenerator.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestDataGenerator.cs @@ -20,7 +20,7 @@ internal static class TestDataGenerator /// The . public static float[] GenerateRandomFloatArray(this Random rnd, int length, float minVal, float maxVal) { - var values = new float[length]; + float[] values = new float[length]; RandomFill(rnd, values, minVal, maxVal); @@ -45,7 +45,7 @@ internal static class TestDataGenerator /// The . public static Vector4[] GenerateRandomVectorArray(this Random rnd, int length, float minVal, float maxVal) { - var values = new Vector4[length]; + Vector4[] values = new Vector4[length]; for (int i = 0; i < length; i++) { @@ -69,7 +69,7 @@ internal static class TestDataGenerator /// The . public static float[] GenerateRandomRoundedFloatArray(this Random rnd, int length, float minVal, float maxVal) { - var values = new float[length]; + float[] values = new float[length]; for (int i = 0; i < length; i++) { @@ -87,14 +87,14 @@ internal static class TestDataGenerator /// The . public static byte[] GenerateRandomByteArray(this Random rnd, int length) { - var values = new byte[length]; + byte[] values = new byte[length]; rnd.NextBytes(values); return values; } public static short[] GenerateRandomInt16Array(this Random rnd, int length, short minVal, short maxVal) { - var values = new short[length]; + short[] values = new short[length]; for (int i = 0; i < values.Length; i++) { values[i] = (short)rnd.Next(minVal, maxVal); diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs index 881883035..5eb5be0d9 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs @@ -19,9 +19,9 @@ public static partial class TestEnvironment private const string ToolsDirectoryRelativePath = @"tests\Images\External\tools"; - private static readonly Lazy SolutionDirectoryFullPathLazy = new Lazy(GetSolutionDirectoryFullPathImpl); + private static readonly Lazy SolutionDirectoryFullPathLazy = new(GetSolutionDirectoryFullPathImpl); - private static readonly Lazy NetCoreVersionLazy = new Lazy(GetNetCoreVersion); + private static readonly Lazy NetCoreVersionLazy = new(GetNetCoreVersion); static TestEnvironment() => PrepareRemoteExecutor(); @@ -52,8 +52,7 @@ public static partial class TestEnvironment internal static string SolutionDirectoryFullPath => SolutionDirectoryFullPathLazy.Value; - private static readonly FileInfo TestAssemblyFile = - new FileInfo(typeof(TestEnvironment).GetTypeInfo().Assembly.Location); + private static readonly FileInfo TestAssemblyFile = new(typeof(TestEnvironment).GetTypeInfo().Assembly.Location); private static string GetSolutionDirectoryFullPathImpl() { @@ -215,7 +214,7 @@ public static partial class TestEnvironment string args = $"{remoteExecutorTmpPath} /32Bit+ /Force"; - var si = new ProcessStartInfo() + ProcessStartInfo si = new() { FileName = corFlagsFile.FullName, Arguments = args, @@ -224,7 +223,7 @@ public static partial class TestEnvironment RedirectStandardError = true }; - using var proc = Process.Start(si); + using Process proc = Process.Start(si); proc.WaitForExit(); string standardOutput = proc.StandardOutput.ReadToEnd(); string standardError = proc.StandardError.ReadToEnd(); @@ -266,7 +265,7 @@ public static partial class TestEnvironment private static Version GetNetCoreVersion() { Assembly assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly; - string[] assemblyPath = assembly.Location.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); + string[] assemblyPath = assembly.Location.Split(['/', '\\'], StringSplitOptions.RemoveEmptyEntries); int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2) { diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs index 994aa670c..4a34529dd 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs @@ -375,7 +375,7 @@ public static class TestImageExtensions appendPixelTypeToFileName, predicate); - List> temporaryFrameImages = new(); + List> temporaryFrameImages = []; IImageDecoder decoder = TestEnvironment.GetReferenceDecoder(frameFiles[0].FileName); diff --git a/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs b/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs index fe94cffc4..a0ff4a466 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestMemoryAllocator.cs @@ -46,7 +46,7 @@ internal class TestMemoryAllocator : MemoryAllocator private T[] AllocateArray(int length, AllocationOptions options) where T : struct { - var array = new T[length + 42]; + T[] array = new T[length + 42]; this.allocationLog?.Add(AllocationRequest.Create(options, length, array)); if (options == AllocationOptions.None) diff --git a/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs b/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs index 50e086d57..7f25fd5aa 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestMemoryManager.cs @@ -34,7 +34,7 @@ public class TestMemoryManager : MemoryManager public static TestMemoryManager CreateAsCopyOf(Span copyThisBuffer) { - var pixelArray = new T[copyThisBuffer.Length]; + T[] pixelArray = new T[copyThisBuffer.Length]; copyThisBuffer.CopyTo(pixelArray); return new TestMemoryManager(pixelArray); } diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs index fbdfb9d61..2e2416952 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs @@ -26,7 +26,7 @@ public static class TestUtils private static readonly Dictionary PixelTypes2ClrTypes = new(); private static readonly PixelTypes[] AllConcretePixelTypes = GetAllPixelTypes() - .Except(new[] { PixelTypes.Undefined, PixelTypes.All }) + .Except([PixelTypes.Undefined, PixelTypes.All]) .ToArray(); static TestUtils() @@ -133,7 +133,7 @@ public static class TestUtils { if (pixelTypes == PixelTypes.Undefined) { - return Enumerable.Empty>(); + return []; } else if (pixelTypes == PixelTypes.All) { diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs index 52447b6c2..1b5b43f03 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/BasicSerializerTests.cs @@ -51,7 +51,7 @@ public class BasicSerializerTests [Fact] public void SerializeDeserialize_ShouldPreserveValues() { - var obj = new DerivedObj() { Length = 123.1, Name = "Lol123!", Lives = 7, Strength = 4.8 }; + DerivedObj obj = new() { Length = 123.1, Name = "Lol123!", Lives = 7, Strength = 4.8 }; string str = BasicSerializer.Serialize(obj); BaseObj mirrorBase = BasicSerializer.Deserialize(str); diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs index 34337600e..ee3d02670 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs @@ -14,9 +14,9 @@ public class FeatureTestRunnerTests public static TheoryData Intrinsics => new() { - { HwIntrinsics.DisableAES | HwIntrinsics.AllowAll, new[] { "EnableAES", "AllowAll" } }, - { HwIntrinsics.DisableHWIntrinsic, new[] { "EnableHWIntrinsic" } }, - { HwIntrinsics.DisableSSE42 | HwIntrinsics.DisableAVX, new[] { "EnableSSE42", "EnableAVX" } } + { HwIntrinsics.DisableAES | HwIntrinsics.AllowAll, ["EnableAES", "AllowAll"] }, + { HwIntrinsics.DisableHWIntrinsic, ["EnableHWIntrinsic"] }, + { HwIntrinsics.DisableSSE42 | HwIntrinsics.DisableAVX, ["EnableSSE42", "EnableAVX"] } }; [Theory] @@ -47,7 +47,7 @@ public class FeatureTestRunnerTests } FeatureTestRunner.RunWithHwIntrinsicsFeature( - () => Assert.True(Vector.IsHardwareAccelerated), + () => Assert.True(Vector.IsHardwareAccelerated, "Vector hardware acceleration should be enabled when AllowAll is specified."), HwIntrinsics.AllowAll); } @@ -56,21 +56,21 @@ public class FeatureTestRunnerTests { static void AssertDisabled() { - Assert.False(Sse.IsSupported); - Assert.False(Sse2.IsSupported); - Assert.False(Aes.IsSupported); - Assert.False(Pclmulqdq.IsSupported); - Assert.False(Sse3.IsSupported); - Assert.False(Ssse3.IsSupported); - Assert.False(Sse41.IsSupported); - Assert.False(Sse42.IsSupported); - Assert.False(Popcnt.IsSupported); - Assert.False(Avx.IsSupported); - Assert.False(Fma.IsSupported); - Assert.False(Avx2.IsSupported); - Assert.False(Bmi1.IsSupported); - Assert.False(Bmi2.IsSupported); - Assert.False(Lzcnt.IsSupported); + Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set."); + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set."); } FeatureTestRunner.RunWithHwIntrinsicsFeature( @@ -88,90 +88,70 @@ public class FeatureTestRunnerTests switch (Enum.Parse(intrinsic)) { case HwIntrinsics.DisableHWIntrinsic: - Assert.False(Sse.IsSupported); - Assert.False(Sse2.IsSupported); - Assert.False(Aes.IsSupported); - Assert.False(Pclmulqdq.IsSupported); - Assert.False(Sse3.IsSupported); - Assert.False(Ssse3.IsSupported); - Assert.False(Sse41.IsSupported); - Assert.False(Sse42.IsSupported); - Assert.False(Popcnt.IsSupported); - Assert.False(Avx.IsSupported); - Assert.False(Fma.IsSupported); - Assert.False(Avx2.IsSupported); - Assert.False(Bmi1.IsSupported); - Assert.False(Bmi2.IsSupported); - Assert.False(Lzcnt.IsSupported); - Assert.False(AdvSimd.IsSupported); - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); - Assert.False(Crc32.IsSupported); - Assert.False(Dp.IsSupported); - Assert.False(Sha1.IsSupported); - Assert.False(Sha256.IsSupported); - break; - case HwIntrinsics.DisableSSE: - Assert.False(Sse.IsSupported); - break; - case HwIntrinsics.DisableSSE2: - Assert.False(Sse2.IsSupported); + Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set."); + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(AdvSimd.IsSupported, "Arm64 AdvSimd should be disabled when DisableHWIntrinsic is set."); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableHWIntrinsic is set."); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableHWIntrinsic is set."); break; case HwIntrinsics.DisableAES: - Assert.False(Aes.IsSupported); - break; - case HwIntrinsics.DisablePCLMULQDQ: - Assert.False(Pclmulqdq.IsSupported); - break; - case HwIntrinsics.DisableSSE3: - Assert.False(Sse3.IsSupported); - break; - case HwIntrinsics.DisableSSSE3: - Assert.False(Ssse3.IsSupported); - break; - case HwIntrinsics.DisableSSE41: - Assert.False(Sse41.IsSupported); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableAES is set."); +#if NET10_0_OR_GREATER + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableAES is set (paired disable)."); +#endif break; case HwIntrinsics.DisableSSE42: - Assert.False(Sse42.IsSupported); - break; - case HwIntrinsics.DisablePOPCNT: - Assert.False(Popcnt.IsSupported); +#if NET10_0_OR_GREATER + Assert.False(Sse3.IsSupported, "Sse3 should be disabled."); + Assert.False(Ssse3.IsSupported, "Ssse3 should be disabled."); + Assert.False(Sse41.IsSupported, "Sse41 should be disabled."); + Assert.False(Popcnt.IsSupported, "Popcnt should be disabled."); +#else + Assert.False(Sse42.IsSupported, "Sse42 should be disabled when DisableSSE42 is set."); +#endif break; case HwIntrinsics.DisableAVX: - Assert.False(Avx.IsSupported); - break; - case HwIntrinsics.DisableFMA: - Assert.False(Fma.IsSupported); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableAVX is set."); break; case HwIntrinsics.DisableAVX2: - Assert.False(Avx2.IsSupported); - break; - case HwIntrinsics.DisableBMI1: - Assert.False(Bmi1.IsSupported); - break; - case HwIntrinsics.DisableBMI2: - Assert.False(Bmi2.IsSupported); - break; - case HwIntrinsics.DisableLZCNT: - Assert.False(Lzcnt.IsSupported); - break; - case HwIntrinsics.DisableArm64AdvSimd: - Assert.False(AdvSimd.IsSupported); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableAVX2 is set."); +#if NET10_0_OR_GREATER + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableAVX2 is set (paired disable)."); +#endif break; case HwIntrinsics.DisableArm64Aes: - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableArm64Aes is set."); break; case HwIntrinsics.DisableArm64Crc32: - Assert.False(Crc32.IsSupported); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableArm64Crc32 is set."); break; case HwIntrinsics.DisableArm64Dp: - Assert.False(Dp.IsSupported); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableArm64Dp is set."); break; case HwIntrinsics.DisableArm64Sha1: - Assert.False(Sha1.IsSupported); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableArm64Sha1 is set."); break; case HwIntrinsics.DisableArm64Sha256: - Assert.False(Sha256.IsSupported); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableArm64Sha256 is set."); break; } } @@ -189,12 +169,12 @@ public class FeatureTestRunnerTests { Assert.NotNull(serializable); Assert.NotNull(FeatureTestRunner.DeserializeForXunit(serializable)); - Assert.False(Sse.IsSupported); + Assert.False(Sse42.IsSupported, "SSE42 should be disabled when DisableSSE42 is set (sanity check using serializable param overload)."); } FeatureTestRunner.RunWithHwIntrinsicsFeature( AssertHwIntrinsicsFeatureDisabled, - HwIntrinsics.DisableSSE, + HwIntrinsics.DisableSSE42, new FakeSerializable()); } @@ -209,90 +189,69 @@ public class FeatureTestRunnerTests switch (Enum.Parse(intrinsic)) { case HwIntrinsics.DisableHWIntrinsic: - Assert.False(Sse.IsSupported); - Assert.False(Sse2.IsSupported); - Assert.False(Aes.IsSupported); - Assert.False(Pclmulqdq.IsSupported); - Assert.False(Sse3.IsSupported); - Assert.False(Ssse3.IsSupported); - Assert.False(Sse41.IsSupported); - Assert.False(Sse42.IsSupported); - Assert.False(Popcnt.IsSupported); - Assert.False(Avx.IsSupported); - Assert.False(Fma.IsSupported); - Assert.False(Avx2.IsSupported); - Assert.False(Bmi1.IsSupported); - Assert.False(Bmi2.IsSupported); - Assert.False(Lzcnt.IsSupported); - Assert.False(AdvSimd.IsSupported); - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); - Assert.False(Crc32.IsSupported); - Assert.False(Dp.IsSupported); - Assert.False(Sha1.IsSupported); - Assert.False(Sha256.IsSupported); - break; - case HwIntrinsics.DisableSSE: - Assert.False(Sse.IsSupported); - break; - case HwIntrinsics.DisableSSE2: - Assert.False(Sse2.IsSupported); + Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set."); + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set."); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set."); + Assert.False(AdvSimd.IsSupported, "Arm64 AdvSimd should be disabled when DisableHWIntrinsic is set."); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableHWIntrinsic is set."); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableHWIntrinsic is set."); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableHWIntrinsic is set."); break; case HwIntrinsics.DisableAES: - Assert.False(Aes.IsSupported); - break; - case HwIntrinsics.DisablePCLMULQDQ: - Assert.False(Pclmulqdq.IsSupported); - break; - case HwIntrinsics.DisableSSE3: - Assert.False(Sse3.IsSupported); - break; - case HwIntrinsics.DisableSSSE3: - Assert.False(Ssse3.IsSupported); - break; - case HwIntrinsics.DisableSSE41: - Assert.False(Sse41.IsSupported); + Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableAES is set."); +#if NET10_0_OR_GREATER + Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableAES is set (paired disable)."); +#endif break; case HwIntrinsics.DisableSSE42: - Assert.False(Sse42.IsSupported); - break; - case HwIntrinsics.DisablePOPCNT: - Assert.False(Popcnt.IsSupported); +#if NET10_0_OR_GREATER + Assert.False(Sse3.IsSupported, "Sse3 should be disabled."); + Assert.False(Ssse3.IsSupported, "Ssse3 should be disabled."); + Assert.False(Sse41.IsSupported, "Sse41 should be disabled."); + Assert.False(Popcnt.IsSupported, "Popcnt should be disabled."); +#endif + Assert.False(Sse42.IsSupported, "Sse42 should be disabled when DisableSSE42 is set."); break; case HwIntrinsics.DisableAVX: - Assert.False(Avx.IsSupported); - break; - case HwIntrinsics.DisableFMA: - Assert.False(Fma.IsSupported); + Assert.False(Avx.IsSupported, "AVX should be disabled when DisableAVX is set."); break; case HwIntrinsics.DisableAVX2: - Assert.False(Avx2.IsSupported); - break; - case HwIntrinsics.DisableBMI1: - Assert.False(Bmi1.IsSupported); - break; - case HwIntrinsics.DisableBMI2: - Assert.False(Bmi2.IsSupported); - break; - case HwIntrinsics.DisableLZCNT: - Assert.False(Lzcnt.IsSupported); - break; - case HwIntrinsics.DisableArm64AdvSimd: - Assert.False(AdvSimd.IsSupported); + Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableAVX2 is set."); +#if NET10_0_OR_GREATER + Assert.False(Fma.IsSupported, "FMA should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableAVX2 is set (paired disable)."); + Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableAVX2 is set (paired disable)."); +#endif break; case HwIntrinsics.DisableArm64Aes: - Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported); + Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableArm64Aes is set."); break; case HwIntrinsics.DisableArm64Crc32: - Assert.False(Crc32.IsSupported); + Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableArm64Crc32 is set."); break; case HwIntrinsics.DisableArm64Dp: - Assert.False(Dp.IsSupported); + Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableArm64Dp is set."); break; case HwIntrinsics.DisableArm64Sha1: - Assert.False(Sha1.IsSupported); + Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableArm64Sha1 is set."); break; case HwIntrinsics.DisableArm64Sha256: - Assert.False(Sha256.IsSupported); + Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableArm64Sha256 is set."); break; } } diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs index 4c1a740e2..349dd258e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs @@ -31,7 +31,7 @@ public class ImageComparerTests { using (Image clone = image.Clone()) { - var comparer = ImageComparer.Tolerant(imageThreshold, pixelThreshold); + ImageComparer comparer = ImageComparer.Tolerant(imageThreshold, pixelThreshold); comparer.VerifySimilarity(image, clone); } } @@ -48,7 +48,7 @@ public class ImageComparerTests { ImagingTestCaseUtility.ModifyPixel(clone, 0, 0, 1); - var comparer = ImageComparer.Tolerant(); + ImageComparer comparer = ImageComparer.Tolerant(); comparer.VerifySimilarity(image, clone); } } @@ -66,7 +66,7 @@ public class ImageComparerTests byte perChannelChange = 20; ImagingTestCaseUtility.ModifyPixel(clone, 3, 1, perChannelChange); - var comparer = ImageComparer.Tolerant(); + ImageComparer comparer = ImageComparer.Tolerant(); ImageDifferenceIsOverThresholdException ex = Assert.ThrowsAny( () => comparer.VerifySimilarity(image, clone)); @@ -90,7 +90,7 @@ public class ImageComparerTests ImagingTestCaseUtility.ModifyPixel(clone, 1, 0, 1); ImagingTestCaseUtility.ModifyPixel(clone, 2, 0, 1); - var comparer = ImageComparer.Tolerant(perPixelManhattanThreshold: 257 * 3); + ImageComparer comparer = ImageComparer.Tolerant(perPixelManhattanThreshold: 257 * 3); comparer.VerifySimilarity(image, clone); } } diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs index 6e1eba28e..a145e7365 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceDecoderBenchmarks.cs @@ -22,20 +22,20 @@ public class ReferenceDecoderBenchmarks public const int DefaultExecutionCount = 50; public static readonly string[] PngBenchmarkFiles = - { - TestImages.Png.CalliphoraPartial, + [ + TestImages.Png.CalliphoraPartial, TestImages.Png.Kaboom, TestImages.Png.Bike, TestImages.Png.Splash, TestImages.Png.SplashInterlaced - }; + ]; public static readonly string[] BmpBenchmarkFiles = - { - TestImages.Bmp.NegHeight, + [ + TestImages.Bmp.NegHeight, TestImages.Bmp.Car, TestImages.Bmp.V5Header - }; + ]; public ReferenceDecoderBenchmarks(ITestOutputHelper output) { @@ -76,7 +76,7 @@ public class ReferenceDecoderBenchmarks private void BenchmarkDecoderImpl(IEnumerable testFiles, IImageDecoder decoder, string info, int times = DefaultExecutionCount) { - var measure = new MeasureFixture(this.Output); + MeasureFixture measure = new(this.Output); measure.Measure( times, () => diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs index e080bda9b..f0a5f4eb4 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/SemaphoreReadMemoryStreamTests.cs @@ -5,8 +5,8 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.Tests; public class SemaphoreReadMemoryStreamTests { - private readonly SemaphoreSlim continueSemaphore = new SemaphoreSlim(0); - private readonly SemaphoreSlim notifyWaitPositionReachedSemaphore = new SemaphoreSlim(0); + private readonly SemaphoreSlim continueSemaphore = new(0); + private readonly SemaphoreSlim notifyWaitPositionReachedSemaphore = new(0); private readonly byte[] buffer = new byte[128]; [Fact] diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs index 460858379..555041890 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/SystemDrawingReferenceCodecTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Drawing; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Png; using SixLabors.ImageSharp.PixelFormats; @@ -35,7 +36,7 @@ public class SystemDrawingReferenceCodecTests { string path = TestFile.GetInputFileFullPath(TestImages.Png.Splash); - using var sdBitmap = new System.Drawing.Bitmap(path); + using Bitmap sdBitmap = new(path); using Image image = SystemDrawingBridge.From32bppArgbSystemDrawingBitmap(sdBitmap); image.DebugSave(dummyProvider); } @@ -49,7 +50,7 @@ public class SystemDrawingReferenceCodecTests sourceImage.Mutate(c => c.MakeOpaque()); } - var encoder = new PngEncoder { ColorType = pngColorType }; + PngEncoder encoder = new() { ColorType = pngColorType }; return provider.Utility.SaveTestOutputFile(sourceImage, "png", encoder); } @@ -65,7 +66,7 @@ public class SystemDrawingReferenceCodecTests string path = SavePng(provider, PngColorType.RgbWithAlpha); - using var sdBitmap = new System.Drawing.Bitmap(path); + using Bitmap sdBitmap = new(path); using Image original = provider.GetImage(); using Image resaved = SystemDrawingBridge.From32bppArgbSystemDrawingBitmap(sdBitmap); ImageComparer comparer = ImageComparer.Exact; @@ -80,7 +81,7 @@ public class SystemDrawingReferenceCodecTests string path = SavePng(provider, PngColorType.Rgb); using Image original = provider.GetImage(); - using var sdBitmap = new System.Drawing.Bitmap(path); + using Bitmap sdBitmap = new(path); using Image resaved = SystemDrawingBridge.From24bppRgbSystemDrawingBitmap(sdBitmap); ImageComparer comparer = ImageComparer.Exact; comparer.VerifySimilarity(original, resaved); diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index f33811206..72ed27e8e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs @@ -368,7 +368,7 @@ public class TestImageProviderTests { using Image image = this.Decode(this.CreateDefaultSpecializedOptions(options), stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; @@ -415,7 +415,7 @@ public class TestImageProviderTests { using Image image = this.Decode(this.CreateDefaultSpecializedOptions(options), stream, cancellationToken); ImageMetadata metadata = image.Metadata; - return new(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) + return new ImageInfo(image.Size, metadata, new List(image.Frames.Select(x => x.Metadata))) { PixelType = metadata.GetDecodedPixelTypeInfo() }; diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Issue3000_Rgba32_issue_3000_p-3-3.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Issue3000_Rgba32_issue_3000_p-3-3.png new file mode 100644 index 000000000..385ac042c --- /dev/null +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Issue3000_Rgba32_issue_3000_p-3-3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d75205909d532dc98da52389c804ff99cb3b796b5657afb521659fe221c2b8f0 +size 122 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Issue3000_Rgba32_issue_3000_p-4-4.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Issue3000_Rgba32_issue_3000_p-4-4.png new file mode 100644 index 000000000..ef4aa03b9 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Issue3000_Rgba32_issue_3000_p-4-4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a75beaec77378de4abb09317afa56b8e99ecba0d1c8571cad31aa790afb1a687 +size 123 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle1_Rgba32_TestPattern96x48.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle1_Rgba32_TestPattern96x48.png index 53ac0ff89..7fad1fcba 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle1_Rgba32_TestPattern96x48.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle1_Rgba32_TestPattern96x48.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bbe1ffaf7b801fd92724438cc810fd0c5506e0a907b970c4f0bf5bec3627ca2a -size 551 +oid sha256:60b050406fda4ff347660e71cb28a9dfceb4b39532f62ee96cb61d2671d3cf00 +size 340 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle1_Rgba32_TestPattern96x48__original.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle1_Rgba32_TestPattern96x48__original.png new file mode 100644 index 000000000..0d610ae03 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle1_Rgba32_TestPattern96x48__original.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74bf3b8655c7548f28c25b1e467992f691dc429f4b06e85cfd04a3b541825811 +size 478 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle2_Rgba32_TestPattern96x48.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle2_Rgba32_TestPattern96x48.png index 2480164d6..b22cbb019 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle2_Rgba32_TestPattern96x48.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_FromSourceRectangle2_Rgba32_TestPattern96x48.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b45933471a1af1b6d4112240e1bc6b6187065a872043ddbf917200ce9e8cc84b -size 371 +oid sha256:fbfb3143d96070c58c949e8d1e8d9ddbcf1e7863514489ea2defc65863c84e73 +size 276 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(1,2)_T(0,0).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(1,2)_T(0,0).png index da8e446c0..df64eea18 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(1,2)_T(0,0).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(1,2)_T(0,0).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b66a5f9d8a7f3f2a78b868bec6c7d1deea927b82d81aa6d1677e0461a3920dc9 -size 3800 +oid sha256:120b661bef4adac64d362d8c987b3427cd8140ccac7404d09a16765ba1199434 +size 5191 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(2,1)_T(0,0).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(2,1)_T(0,0).png index 4c45ba8c6..b1e8764c1 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(2,1)_T(0,0).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(0)_S(2,1)_T(0,0).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d5fdc46ee866e088e0ec3221145a3d2d954a0bcb6d25cbb4d538978272f34949 -size 4871 +oid sha256:0d668ebe5f8857fd21d7eb9ae86860751a6f3061f6c9f76705ff49216dc07870 +size 6215 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(-20,-10).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(-20,-10).png index 480c07da4..6067f0ccc 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(-20,-10).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(-20,-10).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ae57ca0658b1ffa7aca9031f4ec065ab5a9813fb8a9c5acd221526df6a4f729 -size 9747 +oid sha256:2fb676b3af585e7cbe2efdb893157d5f4e152cf810d0693cafb81596e941e121 +size 9697 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(0,0).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(0,0).png index d1ea99cf9..69f862a5a 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(0,0).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(0,0).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0fced9def2b41cbbf215a49ea6ef6baf4c3c041fd180671eb209db5c6e7177e5 -size 10470 +oid sha256:afe7ddbff155b918a4eff91af31e01100355c146cb9c8a12ab2496da8b22821d +size 10446 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(20,10).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(20,10).png index 227f54651..5b88ba508 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(20,10).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1,1)_T(20,10).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e4cc16c2f1b439f8780dead04db01fed95f8e20b68270ae8e7a988af999e3db -size 10561 +oid sha256:ad76301984e5b54eae374adfe130693667053fbed181847b4c68688fb74c9818 +size 10518 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.1,1.3)_T(30,-20).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.1,1.3)_T(30,-20).png index b93742a85..7f08d0dfd 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.1,1.3)_T(30,-20).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.1,1.3)_T(30,-20).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:06e3966550f1c3ae72796e5522f7829cf1f86daca469c479acf49e6fae72e3d0 -size 13227 +oid sha256:fbd57af1fa982f9090f57d820a9b927f894914e5f54774e9cd6fdcfe14e5f761 +size 13139 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.5,1.5)_T(0,0).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.5,1.5)_T(0,0).png index 57c3b02ba..2d4ad649f 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.5,1.5)_T(0,0).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScaleTranslate_Rgba32_TestPattern100x50_R(50)_S(1.5,1.5)_T(0,0).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ce5fefe04cc2a036fddcfcf038901a7a09b4ea5d0621a1e0d3abc8430953ae3 -size 20778 +oid sha256:c4bbc28c203550baf885cefba95c48a3f91dfb5242c09acbf3a8509b7258048e +size 20768 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScale_ManuallyCentered_Rgba32_TestPattern96x96_R(50)_S(0.8).png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScale_ManuallyCentered_Rgba32_TestPattern96x96_R(50)_S(0.8).png index b3bfc7ee5..08182dcfb 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScale_ManuallyCentered_Rgba32_TestPattern96x96_R(50)_S(0.8).png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_RotateScale_ManuallyCentered_Rgba32_TestPattern96x96_R(50)_S(0.8).png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b653c0fe761d351cb15b09f35da578a954d103dea7507e2c1d7c4ebf3bdac49a -size 10943 +oid sha256:566e85b1a527f48c953bcc7bc6c58ebd1fe0b14972c38edd596b025e0dd48624 +size 10940 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png index a295c016d..392d3462f 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a17bb1653cc6d6ecc292ce0670c651bfea032f61c6a0e84636205bde53a86f8 -size 13536 +oid sha256:aa5b0d5de93f26c0a7a03b57a00d4a49cda62f4a4b98b6d374261467c03a8357 +size 13500 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png index 63214687d..56f2a3127 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b8970378312c0d479d618e4d5b8da54175c127db517fbe54f9057188d02cc735 -size 4165 +oid sha256:62267d8d56af3e1452f0e25144f2cfe352b88def98af28e819a3a6982040a4ca +size 4102 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png index a295c016d..5919cce39 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a17bb1653cc6d6ecc292ce0670c651bfea032f61c6a0e84636205bde53a86f8 -size 13536 +oid sha256:878d5c53b84af4d133825206a327fd4cd02a43831ecabf5c61c5d89181c5a107 +size 13499 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png index ef37b3e2d..fa01f13cc 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9bbf7ef00f98b410f309b3bf70ce87d3c6455666a26e89cd004744145a10408a -size 12559 +oid sha256:f0aa3c19852632e603ec425aeecc5243d4c6c24a1ac6e3906d29913bf7ead2df +size 12535 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png index 93a0ce6c5..98ad27d78 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7f9ab86abad276d58bb029bd8e2c2aaffac5618322788cb3619577c7643e10d2 -size 14223 +oid sha256:ec648c2e8006d478ace4a78d2434a4ef7f10d4a3502468cd8b9e2b1f154620b6 +size 14278 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png index c2ca6bf57..feb217ee9 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:05c4dc9af1fef422fd5ada2fa1459c26253e0fb5e5a13226fa2e7445ece32272 -size 17927 +oid sha256:6cb06152d5a0765ad86e8005d6ddac469914ccced89d5ee37d77e7d030b97c9e +size 17281 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png index ade9a1ccd..fd1cf7e77 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82b47e1cad2eea417b99a2e4b68a5ba1a6cd6703f360e8402f3dca8b92373ecc -size 18945 +oid sha256:38ea8596a682be0075bb31ed176b1fe04b518eb887235d551a574e338d45880b +size 18869 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png index cf04e2036..619483421 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b15ce5a201ee6b946de485a58d3d8e779b6841457e096b2bd7a92968a122f9af -size 20844 +oid sha256:965f42f021c63a0f2ccc691723c4ad7f92119294aec407c7ffd46a6238c8f268 +size 20792 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png index 6be0fc0ff..7201a5f15 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1622a48b3f4790d66b229ed29acd18504cedf68d0a548832665c28d47ea663b -size 13857 +oid sha256:86f1b9e8f1e38070ce862d87c927313904ceaa9e6080f5acead90e82d164738c +size 13879 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png index 0064e973f..77c61443b 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:74df7b82e2148cfc8dae7e05c96009c0d70c09bf39cdc5ef9d727063d2a8cb3f -size 4154 +oid sha256:270f9c2bf5d15fcb21796b3b9eb393e0cc00d9c337036637295ad1efb56781b1 +size 4114 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png index 5dd0c5225..22dc949c3 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc740ccd76910e384ad84a780591652ac7ee0ea30abf7fd7f5b146f8ff380f07 -size 13991 +oid sha256:d413162a83c223124a2f29f8154e4bdc08d94bd3e15569ec6cffaa13bdda72c8 +size 13953 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png index a6e120e90..3d86b73ab 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ccdc54e814604d4d339f6083091abf852aae65052ceb731af998208faddb5b0b -size 13744 +oid sha256:941ea7b4d1f2c187f58920546e2f19fc275505929439cc389edcc59e652e8787 +size 13777 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png index d32c11d44..060fdc809 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd24e0a52c7743ab7d3ed255e3757c2d5495b3f56198556a157df589b1fb67ca -size 14889 +oid sha256:cc5e6a607ef2343cb74c5227dbc7861840db956951f1fc4703fe53dbccda0974 +size 14808 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png index 72782b0b9..524072160 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:878f1aab39b0b2405498c24146b8f81248b37b974e5ea7882e96174a034b645f -size 12374 +oid sha256:2ac06a9ba2b2c8bef7e0117ac52fbb790101c0f89313dc49feb1f5a1d929ab02 +size 12381 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png index 6cedab729..669aeba9a 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dcc2bf4f7e0ab3d56ee71ac1e1855dababeb2e4ec167fd5dc264efdc9e727328 -size 17027 +oid sha256:ad0f483fa7fda620860858c4f330ba914480fba15d70b408fb1aa3fed52dbfc1 +size 16839 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_0.0001.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_0.0001.png index 7368a3b00..438450e53 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_0.0001.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_0.0001.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c733878f4c0cc6075a01fbe7cb471f8b3e91c2c5eaf89309ea3c073d9cc4921 -size 854 +oid sha256:ba501a7fc32a68f8989965aa6457b3860ec42947e2bcd4526c7570ff743f38fc +size 841 diff --git a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png index da66b2676..f7f2101d7 100644 --- a/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png +++ b/tests/Images/External/ReferenceOutput/AffineTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af872886136893938aee82b1ac73e7a1820666a9a5f4bbf34159c09b3283169a -size 5520 +oid sha256:8265c5b2e8edd5eaf0aeeccf86cac486e7beec581e696d3b4f4cfee8f4be9b2b +size 5554 diff --git a/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/00.png b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/00.png new file mode 100644 index 000000000..9e3e48a52 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/00.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:003d5986b66f90e0841c3fdfa8c595563c8e237467b8218c6fd7fa283ba28b1d +size 21154 diff --git a/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/01.png b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/01.png new file mode 100644 index 000000000..7d8babf99 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/01.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1d148bd561f33c2435226c533dea539e1b21567d8f985a4059d501846e0bf30 +size 21761 diff --git a/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/02.png b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/02.png new file mode 100644 index 000000000..108ccd1f5 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38519ad5d1d50548fada577d2bd4a8be7f76d1c3071f07bb98f1227c4bc5d303 +size 20522 diff --git a/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/03.png b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/03.png new file mode 100644 index 000000000..28c79f8c2 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/03.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e922f83fd719ba961b8720417befa119000f2c8f3956d3ac8df60c79ff56fe59 +size 21291 diff --git a/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/04.png b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/04.png new file mode 100644 index 000000000..401939430 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawImageAnimatedForegroundRepeatCount_Rgba32_giphy.gif/04.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b7b904032ff6c142632e8c1efffe3d71c28a89d5824d9fe13dbf4ceeddcf5e8 +size 21367 diff --git a/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawTransformed.png b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawTransformed.png index 7e693a583..3692f1a1e 100644 --- a/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawTransformed.png +++ b/tests/Images/External/ReferenceOutput/Drawing/DrawImageTests/DrawTransformed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ba180567e820b145a13c9b26db9c777e95126adfe8e8cacec0ffe1060dcfe8d -size 184124 +oid sha256:7f8a4db4facce1d68b363a3b59ea40c9da9fa3c989c736d97a703c84d8230660 +size 184595 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/00.png index 193cde24d..f9d43792c 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18b60d2066cb53d41988da37b8c521ddcb5355b995320a8413b95522a0492140 -size 687 +oid sha256:07b63781e5481a46955fc26e9023b243aeada231c4957332c80241e1ad119733 +size 273 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/01.png index 4d2d25510..da7411347 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30ff7708250c5f02dc02d74238d398b319d8fc6c071178f32f82a17e3b637afd -size 542 +oid sha256:6bd0b25eafd2fb3f55f593a5243fa1e3b6a7ec43a70b8d0c3a6eddd56fe65ae6 +size 114 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/02.png index 0654e49d4..5d2c89228 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/02.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d21f4576486692122b6ee719d75883849f65ddb07f632ea1c62b42651c289688 -size 591 +oid sha256:e2f7bb0aed90e52d7905014d790f0bcb5df3f05e5cb82b51dda88ac13dc5afcf +size 115 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/03.png index 0c1090f66..a9db965de 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/03.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_firstframerestoreprev_loop.gif/03.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:88db68f2d59301b8ff9326143455a03c94cb616220f6e8e3832f13effe0c09bc -size 545 +oid sha256:b10d33fd285b8a200090bccc35541a608ed062edf1a055357c895935265d216b +size 116 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/00.png index 193cde24d..f9d43792c 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18b60d2066cb53d41988da37b8c521ddcb5355b995320a8413b95522a0492140 -size 687 +oid sha256:07b63781e5481a46955fc26e9023b243aeada231c4957332c80241e1ad119733 +size 273 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/01.png index f289fdca3..0d6140760 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:034b0b6b94c13fbef8c44d650daa07362f113aae6600d63230a3f96e29b16dec -size 790 +oid sha256:9296af767fc47ee67249de4f473633f308a323e9e82676dc00952e05cc23f761 +size 341 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/02.png index 07537b9df..e4bfadab5 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/02.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4b3684db6e3df52a9eb520d562b51b54632e897e9e39bff5ce904ae00799f2f -size 924 +oid sha256:b2926b6f27314950ff21f1357636f933694f8424e391a10d980a1492ef7b3f07 +size 421 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/03.png index e376be689..a2df6ead1 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/03.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_norestore_loop.gif/03.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e33c564f55b653a693105612949401002014821abaecaf654c96d0f2b5d59b4 -size 962 +oid sha256:350624a4f22cbc47b07e5c8ffe0ea2e0f03687d53b77896c7701b04d7c93089d +size 431 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/00.png index 193cde24d..f9d43792c 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18b60d2066cb53d41988da37b8c521ddcb5355b995320a8413b95522a0492140 -size 687 +oid sha256:07b63781e5481a46955fc26e9023b243aeada231c4957332c80241e1ad119733 +size 273 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/01.png index f289fdca3..0d6140760 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:034b0b6b94c13fbef8c44d650daa07362f113aae6600d63230a3f96e29b16dec -size 790 +oid sha256:9296af767fc47ee67249de4f473633f308a323e9e82676dc00952e05cc23f761 +size 341 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/02.png index 27f29acbb..2153fa5cf 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/02.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a4f4eb12da36cd43c620aa5ad1c793bb6eb8431c61d2cc1b77c1118f35a741cc -size 876 +oid sha256:726aff614b67ea2ee9ffd53fff8e304130019de99d3ae641bef97e0a24f756be +size 343 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/03.png index 684c2fa38..369f668fc 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/03.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_frame_restoreprev_loop.gif/03.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:15bf02e06c6819d74a0a79cbfc5c86913c248a8812ff0ec613c0e747a000241b -size 789 +oid sha256:a645f615d592a1c24b94ad3a4fc63503cb8b0504c9464ee5089d9831b23c28e1 +size 336 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/00.png index 193cde24d..f9d43792c 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18b60d2066cb53d41988da37b8c521ddcb5355b995320a8413b95522a0492140 -size 687 +oid sha256:07b63781e5481a46955fc26e9023b243aeada231c4957332c80241e1ad119733 +size 273 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/01.png index 7818cf380..4fa343103 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01f389a2e93023f3132927a9565c04c8c1f827e36111ebe682177adecc3a27ee -size 774 +oid sha256:1e90013c0ea6e60ef68143914fdf4b14f83e869cf90aff42d837b1340d867f77 +size 276 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/02.png index 18bc40863..cdd623a6a 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/02.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:00ef57db2fef89112ac7d1808afb6803612c6a20fc589166be6d6b7007c46400 -size 946 +oid sha256:69c0e3fb7365e09f6acd26e334f3cb65ba8657b2de7b1022256f5aac91f257ac +size 296 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/03.png index bd2ea67ae..36f963ccc 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/03.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_Animated_WithTransparency_Rgba32_animated_transparent_loop.gif/03.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:deafa4d4f8fd84489c061ca1042c2ad9e655fff3b6419248cfb35fa4ea40d9e6 -size 1000 +oid sha256:2be415d41972782f91ad513428796588b0040c4125d604f72d1288c5b3e3742f +size 282 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/00.png index c8b4db92c..06a7b52d6 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2cc0d653e6f3e06b1d8828ff5794fd5f81526a9e411137a2d1a78f9d8894100 -size 7168 +oid sha256:f212a6b0f4e2ce7d38a489dfe0e050adf807a33f8305367ce377f45a6d7c4619 +size 15016 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/01.png index afeab25c3..ae776f82f 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7f721df04021f246e9df9f6b91c3654e8b40ded575473c05d646f7bc632b958 -size 7558 +oid sha256:8612f3caef51ce4f0daf2d37f3bf959382a63770391f2ec242c2af46eab2b3b5 +size 15748 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/02.png index a03761d56..82ba6c23d 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/02.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a40b7f8d2779e6fdf26e2720fdf24f8da03e9ef9d8b1ff68e9bb68f001814b79 -size 6956 +oid sha256:717938369a68299af27a2b42d58c97ddd5fcd2d8a93418af8f92b3d1c2e93064 +size 14485 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/03.png index 848c6be81..f83ea81d9 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/03.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/03.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4fc7fdca7cfec1ae6d119dbccdc7ea78c19584076a197c54e494645b2c84e45e -size 7131 +oid sha256:6a0545794d1384f46acb32bbc4369a226d002eb8ae286e064855d55afd72f4c6 +size 15040 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/04.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/04.png index 11b93c1aa..20ff589c9 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/04.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_giphy.gif/04.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d4b59fa394cc6205e00440428e9a141a627b88b5e2562ec6b1dd0d48651da77f -size 7104 +oid sha256:853a4f2749ff5ca67bd7c49c2e2f0323772a828a215fac0fd02e9b7eb9d63051 +size 15291 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/00.png index 9236bef85..7acd64ad9 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ac324bd9199113897bd986cffe8e7f3770fb2e68e6792d631071ff1db40075f -size 29351 +oid sha256:c41341baee0a461d811cbb8c6cd64d3276d7d4520e95732c5dd12f3834e0a6f3 +size 47309 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/01.png index 91b3c95dc..5822b7e96 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9ec5a3228c71b54a2bccd8aaf929e11436d45cb56f43cd507cfd4e7bb288fb7 -size 30538 +oid sha256:7a0d6d652a7fc1bdf84bd5e1a785d97e1da08ba3397c3644973f221f3a75b59e +size 48583 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/02.png index d9c98dace..e4536355c 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/02.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa0c9f304a6afc62aba3b6567905160f7728f43e3b5ba3dc79bf743c9a5f49ab -size 30754 +oid sha256:2f8ed2197b5a9b9749c572096714251bf23be463b3bbd01329d47296078c5f23 +size 48824 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/03.png index 5573c1519..ca8f63548 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/03.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/03.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7e61d8611c06c4f82c0000ebac4a1b3a53d1342e23f9efb10406ae06a510580c -size 31260 +oid sha256:6c75f616b6460d832ba7b6a0e0551f07d55c2cb0533e95ce16b9a1b9073f75f9 +size 49783 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/04.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/04.png index a595bb707..87d44ffc6 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/04.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/04.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:168bcccba4dffeaec2f2e3978405f802451089790b6377d8c653cfaed7bae833 -size 31741 +oid sha256:0bb07ef91e0f8a82d457ad2ebfed9ca6940d228a4e9954e75c3c1826d4ac5f53 +size 50381 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/05.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/05.png index 29537a2f5..a7b15ecf9 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/05.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/05.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c6675dcca4418fdc529e4de1bc0014a2463d6c6b197dd701b84044a00b31016 -size 30061 +oid sha256:7d80517e1d79f85a5a725d8678011ec5c05748ccc2eb7567573380b610183ea5 +size 47731 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/06.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/06.png index 380b5aad3..86299abfa 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/06.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/06.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d01cfb14c66662f8972f48d62a7cbb70c2ffa174d74a5533be61a2565d923a0 -size 31139 +oid sha256:07a406840c321421e6aa07ad69d14d96e2bb728364c8fabb98151c5693efa2fa +size 49847 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/07.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/07.png index 9c815c41b..bfd4828ad 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/07.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/07.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6918449a54dea19a15f3f4ef9f5d0e890f7dc97e651d4c77bd60dfaa4f49d646 -size 31304 +oid sha256:72678c10f8cd852f87c19ec1c2a7acfb326291e1ae0f48588d5d7d999592bb32 +size 49850 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/08.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/08.png index 09521859c..c7c53dadb 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/08.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/08.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8927c2e34c9ab90c1fbc3d4f8be289f4a47fee5cfe9c4d72bc39eb78c94a3bf -size 32500 +oid sha256:7c9a61f0639bda2fd8690544ad41df7179ea29987b8827b4cae2e959998d27cf +size 51612 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/09.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/09.png index e38de41ab..accff0f9d 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/09.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/09.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a2ffb21368cf6c3e4d567ca19cc40187bee254ea6ebea83c6d6f9c2df02b56eb -size 32374 +oid sha256:ef326f40bdc7f0a43ad1edb51b000388f4f5ca1b7c24633447c03d999bd088c6 +size 51724 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/10.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/10.png index 4d104e273..71c5577c3 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/10.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/10.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b903f04b431ed0d9474ef89cb48d2b7b7fa8c124b5fb1f2562d826eaa2cd3ba -size 32692 +oid sha256:a4e8f6a96ce47d36c778d7fa243d723bca725438fe9d9174b61afb638c1cd815 +size 52070 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/11.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/11.png index 141d2df42..58daa5067 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/11.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/11.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:898566396d44cb9c495ed6c40c56928fe642434ed4888331bb92b17fb0cd4847 -size 33243 +oid sha256:b1f96f15c1a46db19726b6ce0d5a78800b1a430c4323a60e628e7e08aa795189 +size 52829 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/12.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/12.png index 590132fca..164a07efb 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/12.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/12.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18a1888eb6d79f857f8336e76e50b5402127036418183e03869e58021b8f9c47 -size 32797 +oid sha256:d98e70649b2a1971f62eb41d53e064f898b45da47f05e000e4dd80464f5ac290 +size 52329 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/13.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/13.png index 9ab3afd9e..1c1de607e 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/13.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/13.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8384afabdc9133435c61c0cec97fe599719f7cc601fc1444b1b182383dfcbd40 -size 31306 +oid sha256:54ae733a92eb63174fa02708aee26d28cf0d1069ae4514ff244ebea333d87af8 +size 49767 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/14.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/14.png index 33bdd55d4..061dda667 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/14.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/14.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4ea0c2d692d1a5b645af16726b54cc54a0d0166292cc3b3619a96f062996f13f -size 30782 +oid sha256:6a3bc3c870891b220efd95d6da83a166595564e0610766f105496bc77b090e9c +size 48893 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/15.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/15.png index 1ca1ab28e..2958cfc36 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/15.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/15.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e4bb35f4484cb66bf63d46f4311617dc7e675ead33b8f978f564045491eea5bc -size 31875 +oid sha256:e9afd78075471066aa12aeaf33ddda780571faa14a61b842963c53b688432569 +size 50818 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/16.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/16.png index 9dced1b13..27964b46f 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/16.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/16.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21aa4d98c2870022104e44de7c63e16d4a8f7ae139c7a996c862b1cbd55bc3d7 -size 32317 +oid sha256:0caefffa407c227ca906cc21e959d3480a0a35a5a1720a00076a8d2c7ca1afb4 +size 51462 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/17.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/17.png index 110ce0967..8664f2ed2 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/17.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/17.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f7550515971c3af24efb51b4a81c21e3e3a642c53b654512bc6c6ad67d049748 -size 33265 +oid sha256:27e0c6a2204395b0da83c8fed89cf72168641b9318815db2e1d7a169317739d2 +size 52691 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/18.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/18.png index 68406f480..0c61aa82a 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/18.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/18.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:161d80a458dc2418eea4ab8caa851c0632eadd64538843a2c2a5cdd0a54ff66b -size 32545 +oid sha256:ff6af0ab7aabc30f57b1801045f27fcc327103db8f910dcd031cb68bd3e13df9 +size 51515 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/19.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/19.png index b0c387fb8..66a5f9c15 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/19.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/19.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8342d403ab99e900932b52b55f6c6583aac0567c4215c4e187eccf264f4e2c2c -size 32210 +oid sha256:eff399d98ab583c5c8dd26e78bc8920b43e5ee1c142fb9553080850e0506817d +size 51044 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/20.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/20.png index 7178b780d..6c18956a6 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/20.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/20.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a29b4ca76d42a067b3e4f27521e5a0b05c85668002e92a30d12f1a3784062ec -size 31574 +oid sha256:0bbd6daf4825780010d0da77e05ff505e594acef2588a804a4c98501501c8728 +size 50347 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/21.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/21.png index ffb8ced6e..f4f27b24c 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/21.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/21.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be2601503fadee016c5f88b137091b50c6a7451e577f253f166b212ee937b35a -size 31384 +oid sha256:e48f2f7c177ea47fa096d1fa37ef22c4cc818d43b18cdf64c26ed96c79f00b48 +size 49743 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/22.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/22.png index 1b0034ab5..8706c7cf0 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/22.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/22.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2800403642452bff9858db473777b93030dde29c04b0280665a36aa9b57fcb18 -size 31855 +oid sha256:40cbbf0c4d939b696e01302614aab6affe22775783bf1902a33644fbb6ec5bdc +size 50602 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/23.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/23.png index ddf9fbf7a..ed2a543c8 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/23.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/23.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f0225e8395085728e2988ec148e33dc9df009746d5fe0860b12539776337372a -size 32035 +oid sha256:7e7901c37835974abd5163eede0a3049db5e936358089b3de67e99699019582e +size 50810 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/24.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/24.png index 302c97696..4ab5d089f 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/24.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/24.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f348830b798dff6f62a5c279105181efb4e692fe83f3e42cd3cae9b5ca0af7ce -size 32097 +oid sha256:80f0028de9c58117e8a4179ffa890ba0771f7135016fc018a2157bb2cabaa920 +size 50971 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/25.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/25.png index 3c3e74adb..6ac020e21 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/25.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/25.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fd5fb5b83f44bbbc1b32690f54f995eb1709937de780ca35e31598c399c7d8ef -size 31750 +oid sha256:a01abb68b8be21b7531455dbd94b256cd826a52c170a62f88955e2b7a55376e0 +size 50531 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/26.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/26.png index 1b77c89bc..2119d2420 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/26.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Decode_VerifyAllFrames_Rgba32_kumin.gif/26.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a02cb3c82c90b05381126ff3f696e562200442aca34ba54830878701c51d932 -size 31647 +oid sha256:922fa84cc14f0795c8cb7459b6269dc5789018d1f0591560fba0a3c3e80b00b2 +size 50484 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Argb32_trans.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Argb32_trans.png index 1cfc3adb8..08b9fb724 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Argb32_trans.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Argb32_trans.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa4c441acc8fe614c9b375e8e609e735e1c767918ecc1f8f2f028665fdcfcf34 -size 12441 +oid sha256:49eeef6073a5ef2494ecfb138071c22157870e11c903ca81b837b32a813732ac +size 20256 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Rgba32_trans.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Rgba32_trans.png index 1cfc3adb8..08b9fb724 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Rgba32_trans.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_Rgba32_trans.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa4c441acc8fe614c9b375e8e609e735e1c767918ecc1f8f2f028665fdcfcf34 -size 12441 +oid sha256:49eeef6073a5ef2494ecfb138071c22157870e11c903ca81b837b32a813732ac +size 20256 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_RgbaVector_trans.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_RgbaVector_trans.png index 1cfc3adb8..08b9fb724 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_RgbaVector_trans.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/GifDecoder_IsNotBoundToSinglePixelType_RgbaVector_trans.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa4c441acc8fe614c9b375e8e609e735e1c767918ecc1f8f2f028665fdcfcf34 -size 12441 +oid sha256:49eeef6073a5ef2494ecfb138071c22157870e11c903ca81b837b32a813732ac +size 20256 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2012BadMinCode_Rgba32_issue2012_drona1.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2012BadMinCode_Rgba32_issue2012_drona1.png index 5d443b52a..bad4e3803 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2012BadMinCode_Rgba32_issue2012_drona1.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2012BadMinCode_Rgba32_issue2012_drona1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a0e1677baade797de1eaec390f2e475865d24de8bd344edddbb3fce200d6bcb0 -size 135418 +oid sha256:05c72bee64dbf29fe16349d8dfdfbee565779241dbfa860f62a53b649be000e3 +size 1884 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/00.png index f63cc98ad..75ffac608 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f39b23217f1d095eeb8eed5ccea36be813c307a60ef4b1942e9f74028451c38 -size 81944 +oid sha256:bc99ff5deb71c9caff1a645b4175b720edff792982d7c0d4189c769405386a90 +size 9474 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/01.png index f63cc98ad..75ffac608 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2758_BadDescriptorDimensions_Rgba32_issue_2758.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f39b23217f1d095eeb8eed5ccea36be813c307a60ef4b1942e9f74028451c38 -size 81944 +oid sha256:bc99ff5deb71c9caff1a645b4175b720edff792982d7c0d4189c769405386a90 +size 9474 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/00.png index 36c368318..05e989247 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:731299281f942f277ce6803e0adda3b5dd0395eb79cae26cabc9d56905fae0fd +oid sha256:7d41ed74bdeaf5fb851935411dbe95e83c9ccbb8d5bad2d73c43fc5de4c5d798 size 1833 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/01.png index c03e5817f..9ac022ef4 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2859_LZWPixelStackOverflow_Rgba32_issue_2859_B.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50ccac7739142578d99a76b6d39ba377099d4a7ac30cbb0a5aee44ef1e7c9c8c +oid sha256:052fc0cb71e18e6eb599f58bff8f4bfa822f536122f5dad77e6b8fa2c61bb207 size 1271 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/00.png new file mode 100644 index 000000000..7afb1c85b --- /dev/null +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/00.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f47b8bdb0159b3e9c6f3ba81a977fe198dec6cb0c47f33e8ba84203ef40dac9b +size 131 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/01.png new file mode 100644 index 000000000..d892d615a --- /dev/null +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/01.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e3c543efd04b63ee11d0e771f6b2dd2cba244f9b4a63f78a5555adfef13d60c +size 171 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/02.png new file mode 100644 index 000000000..cd8df1479 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/02.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ccae6eb76a1c3a8c7d75c78b7153964cbedc9223297bf67323dd2ec808ca96a +size 159 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/03.png new file mode 100644 index 000000000..5a42c4c6f --- /dev/null +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/Issue2980_Rgba32_issue_2980.gif/03.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6df2819dfd822558f734b70adbcb8edd4afb63072610d5cb79579ca84958c324 +size 151 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/00.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/00.png index 52f14e0f7..46f520cb0 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/00.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:473c5629d7a9f8b3d6c809e8ede40f8fd38e90beddf71851b352c726fc0570d6 -size 534 +oid sha256:4abf8935cd9ed76e3e2fe92d106928ecb7ede58498a550e52d52f0f7d6561c8e +size 466 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/01.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/01.png index b47f34ba0..d4a1f1d91 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/01.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/01.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4b9b9f856c0347b460f824d6b027b343c65c67a29360793181c9a29a76f9002b -size 538 +oid sha256:a5028c4c0250855b9f0f4ec81cb376d5ab6acd73c385c5fe5e6df6537aa95d32 +size 462 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/02.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/02.png index 64869ca3c..c9f0f00c9 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/02.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/02.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:74b8015c60d215808b1d663ae4af956d1454414206ba21326ad35b8952b0cab6 -size 534 +oid sha256:92e36c91cae2dbef6570792d25b9eb08080efc6be3f2e887c2da6d87411f784d +size 471 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/03.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/03.png index ab52225f8..e44b6db71 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/03.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/03.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8dacb6a468d3cdc94613d56264ddf34d3649846edf33619fc13b9522fcf982d6 -size 539 +oid sha256:e9f6c6bee409938823b9a8ca106301142c44ec7479a72c3f6b3ea821ade30b72 +size 466 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/04.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/04.png index 78988aa60..bdc59e93c 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/04.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/04.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8af74db6e01928ad54444fa122e4b87929741052c85abe9c0ffc998adffcbdfc -size 542 +oid sha256:c7c3b861dca59f386fdc88acd8849f71c68ff0af45b2dfa712a55d2d865605d7 +size 462 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/05.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/05.png index ab52225f8..e44b6db71 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/05.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/05.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8dacb6a468d3cdc94613d56264ddf34d3649846edf33619fc13b9522fcf982d6 -size 539 +oid sha256:e9f6c6bee409938823b9a8ca106301142c44ec7479a72c3f6b3ea821ade30b72 +size 466 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/06.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/06.png index 64869ca3c..c9f0f00c9 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/06.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/06.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:74b8015c60d215808b1d663ae4af956d1454414206ba21326ad35b8952b0cab6 -size 534 +oid sha256:92e36c91cae2dbef6570792d25b9eb08080efc6be3f2e887c2da6d87411f784d +size 471 diff --git a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/07.png b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/07.png index 97610dbc0..fd9984855 100644 --- a/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/07.png +++ b/tests/Images/External/ReferenceOutput/GifDecoderTests/IssueTooLargeLzwBits_Rgba32_issue_2743.gif/07.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c816ca1e58d14361b84ba47454e4cbf4d3e4d29dfb7827756eb52ef2604f297c -size 161 +oid sha256:ed091484d552b8c234ab75921e423e6d01172df61124b9b03dcdf2dadab34b85 +size 96 diff --git a/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_Perceptual-cLUT-only.png b/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_Perceptual-cLUT-only.png new file mode 100644 index 000000000..a0b73d299 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_Perceptual-cLUT-only.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe06798b92c9b476c167407e752b4379d50f1b1ad6329eceb368c8c36097b401 +size 95103 diff --git a/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_Perceptual.png b/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_Perceptual.png new file mode 100644 index 000000000..99ae53f93 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_Perceptual.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21f8d54d4b789b783f3020402d4c1b91bb541de6565e2960976b569f60694631 +size 99385 diff --git a/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_sRGB_Gray.png b/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_sRGB_Gray.png new file mode 100644 index 000000000..759b26a60 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/JpegDecoderTests/Decode_RGB_ICC_Jpeg_Rgba32_sRGB_Gray.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18ad361f79b4ab26d452d5cc7ada4c121dfbf45d20da7c23a58f71a9497d17a2 +size 5341 diff --git a/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png new file mode 100644 index 000000000..ffc983901 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b72c885278a066e63c013885c42b772275f25a5f0b2290aa38c87f3dbeac984b +size 81432 diff --git a/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png new file mode 100644 index 000000000..25a97ca48 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:936261278b1a9f5bf9a2bb4f8da09f2a82e1b5c693790e137c5f98fa4d885735 +size 81785 diff --git a/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray.png b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray.png new file mode 100644 index 000000000..5a35cf579 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf856e49e4ece7e59eea684f6fa533ba313a36955be4703894f16b100283cb4a +size 2687 diff --git a/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray_Interlaced_Rgba32.png b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray_Interlaced_Rgba32.png new file mode 100644 index 000000000..270555a55 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray_Interlaced_Rgba32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:337e84b78fb07359a42e7eee0eed32e6728497c64aa30c6bd5ea8a3a5ec67ebc +size 5151 diff --git a/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray_Interlaced_Rgba64.png b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray_Interlaced_Rgba64.png new file mode 100644 index 000000000..dc5f4a559 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray_Interlaced_Rgba64.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:456ae30184b13aa2dc3d922db433017e076ff969862fe506436ed96c2d9be0a1 +size 6143 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=-50, Y=-50 ]-PointF [ X=200, Y=-50 ]-PointF [ X=200, Y=200 ]-PointF [ X=-50, Y=200 ].png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=-50, Y=-50 ]-PointF [ X=200, Y=-50 ]-PointF [ X=200, Y=200 ]-PointF [ X=-50, Y=200 ].png index 38c603855..fc2f4b0c6 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=-50, Y=-50 ]-PointF [ X=200, Y=-50 ]-PointF [ X=200, Y=200 ]-PointF [ X=-50, Y=200 ].png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=-50, Y=-50 ]-PointF [ X=200, Y=-50 ]-PointF [ X=200, Y=200 ]-PointF [ X=-50, Y=200 ].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:abce6af307a81a8ebac8e502142b00b2615403b5570c8dbe7b6895cfdd1a6d60 -size 66879 +oid sha256:ac986987f25d25ab964a5bef710fe81166cb643d85511906218b4f0e72e9e840 +size 30532 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=0, Y=0 ]-PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ].png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=0, Y=0 ]-PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ].png index f7ea0d006..e0357c3f1 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=0, Y=0 ]-PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ].png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=0, Y=0 ]-PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d4cda265a50aa26711efafdbcd947c9a01eff872611df5298920583f9a3d4224 -size 26458 +oid sha256:e0ada2a4d32a3a757b803dbf08148f113f5d358b31af79a77e97c660ce96c302 +size 1608 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ]-PointF [ X=0, Y=0 ].png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ]-PointF [ X=0, Y=0 ].png index 78c37cc44..18d91fe29 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ]-PointF [ X=0, Y=0 ].png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=150, Y=0 ]-PointF [ X=150, Y=150 ]-PointF [ X=0, Y=150 ]-PointF [ X=0, Y=0 ].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:278a488a858b8eda141493fe00c617eb1f664196853da8341d7e5b7f231ddce4 -size 24645 +oid sha256:ffc30373989ec6857797b460931f011b30baaec633b095b6fc3d8fd5d43c77ec +size 2467 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=25, Y=50 ]-PointF [ X=210, Y=25 ]-PointF [ X=140, Y=210 ]-PointF [ X=15, Y=125 ].png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=25, Y=50 ]-PointF [ X=210, Y=25 ]-PointF [ X=140, Y=210 ]-PointF [ X=15, Y=125 ].png index b4740828d..c1b6694f5 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=25, Y=50 ]-PointF [ X=210, Y=25 ]-PointF [ X=140, Y=210 ]-PointF [ X=15, Y=125 ].png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithQuadDistortion_Rgba32_TestPattern150x150_PointF [ X=25, Y=50 ]-PointF [ X=210, Y=25 ]-PointF [ X=140, Y=210 ]-PointF [ X=15, Y=125 ].png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e03e79e6fab3a9e43041e54640a04c7cc3677709e7d879f9f410cf8afc7547a7 -size 42691 +oid sha256:9828ef0faf1a6709673cfe39028ed4202920d346bcc172bda6683bb3d1d0a7a3 +size 36577 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png index 3826753d5..a515475c9 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Bicubic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:543dbf5376386bf518830850645d69934e2ca17ab208ce3fd5274a6a172f5206 -size 10951 +oid sha256:6bff913e6e67129325203fae91278ca17407b10d99c4e4f571e6cfe3b5b7f93c +size 10889 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png index f9aa1ffe0..779e437ff 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Box.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0d0cf291ebf5d8cebab1cd76e2830e5e2d2e0d9a050f7187da72680ead39110c -size 2757 +oid sha256:54b761b76d03216e7aa6238eee92755c03f7b016bffd1400be66ecf136b29c26 +size 2747 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png index 3826753d5..e165b5f3c 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_CatmullRom.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:543dbf5376386bf518830850645d69934e2ca17ab208ce3fd5274a6a172f5206 -size 10951 +oid sha256:16da371a29269dade522b3d602beee8f769723c5712a348d960805b75619376d +size 10889 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png index 2f9109ba3..7d420da8c 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Hermite.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57698b6666029a55edf8bd35a7ba96f68d224988cf01308a3af1c6606ae9d0b1 -size 10174 +oid sha256:b25b190603828131be8d82a27e019353c9bf80dcb38536e325abc5aa065762ed +size 10230 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png index 7dfec7898..96e71e12e 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc7c9da04142a679887c714c43f1838eba0092a869140d234fce3412673207c6 -size 13575 +oid sha256:0cc07a20532c52151388c42d7add4f9749913c4dd7629253400a51d40760df23 +size 13566 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png index 6e3b97f2d..5e04f3fe3 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8b973f41f8afa39b94c71b307b7eb393953e2d083d56e1f0e8f43d6ab1f342a -size 16821 +oid sha256:64aae32ec91233b6a139d2f515db4a3e609fa3ab6c660cb53b05d672e7f70e6f +size 16795 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png index 6986c0391..8206fbdbe 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos5.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:122c1501e09516244f0db36e1cca373ff68514a18e84f57ed3072d52d6112e36 -size 17022 +oid sha256:c6167a1fb585b49167f4c8fa1f19111f10c825ea7d41ae4e266680d22b2bb28e +size 17094 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png index 76b53fabf..76aaf324a 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Lanczos8.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:12181516bce69c9302f15bba928fd530796449599cb9744a2411cc796788ee3b -size 18066 +oid sha256:131e831cc2e2d8eb4f5860d0e685b31006ab846433e38440b6a85a445aed1a12 +size 17890 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png index ae4242a42..10301fd32 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_MitchellNetravali.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1eb5accc5ada5b963ecef6ac15bfb1845f481e51aef63e06a522ea73bbeab945 -size 11194 +oid sha256:aedcc9342e0b37d60759330f62db446646c31da172e21d931ee8e8451ee720ae +size 11193 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png index efb6a2dee..1f736d040 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_NearestNeighbor.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0418f0ea38ec19b407f2b5046d7ff0ed207189ad71db1e50e82c419d83620543 -size 2759 +oid sha256:34f21056cac1ec3f1bd37a6c50466210e7ca7d8263963d2c503535b40e5b31d8 +size 2752 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png index 976be43a3..b5269595c 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Robidoux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1233a9ab2c4b0b17b0248c3d40050c466330c22095287dfbdb8bf7dfbda4ff1f -size 11212 +oid sha256:b4e0cbe71672de45880111fb45c7b544203f67154060fa0707ba9216dfd6d883 +size 11217 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png index 04fb2e87e..81a20c24a 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_RobidouxSharp.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2912d4e42c7b76d9ff48a49921d6472e351662597d69b88bc3708683c7933e3 -size 11221 +oid sha256:e8208cf34114bc87c6244f83a73e7c9dd4455da2fb6d25c34e32ed2fef3cfc9a +size 11214 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png index b35d68aaf..4edc410d9 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Spline.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51b05c38647e0c1d88cc722e4109a882305073a065d2a27ccd3bee82f727127d -size 11775 +oid sha256:c4ee4328adcc71b1d9b3786ab2c03906aa725fefadd1d521206d5a04af421d8d +size 11711 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png index 64b9c6aba..f5877639e 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Triangle.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b260e816b23a43d7efb7507897ba2f5dbb6a596dd67a5abd4c9a0c005e926ee0 -size 9748 +oid sha256:fbc694ac18a702c127c588bb9184bcc39a01c1b8be5ceecadeaab4477260afec +size 9984 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png index 29b95bf52..49633ed22 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithSampler_Rgba32_TestPattern150x150_Welch.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50b03d627bb53048f5e56380500f116da4c503f5bb6a1b1d3c0d67ee4256d8f6 -size 15977 +oid sha256:8e85f331d7c4304fcd8ea8788da04982d9a5e43951be642bd7dbacd8907c3151 +size 15784 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-Both.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-Both.png index 54dca2639..65e75b83e 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-Both.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-Both.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:96454548849147d7c7f0ca507c8521a7d5eaa7771f9f383cc836858870b52c57 -size 280 +oid sha256:92153056f19a20cc1d6ff65dd36ffd215eb50509cc3544e338e76c8d5665fb27 +size 278 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-LeftOrTop.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-LeftOrTop.png index 41f94c9c7..7a9f2794c 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-LeftOrTop.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-LeftOrTop.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e94d224fdb284b6f1ba21b8caa66174edd7e6a3027f9dd03f4757e08296e6508 -size 212 +oid sha256:0db75a869ae36fbca7f57daa4495f2c16050b226474d203aba98cb8e0766d3fb +size 249 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-RightOrBottom.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-RightOrBottom.png index 49cd1c837..4f01d8c13 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-RightOrBottom.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Bottom-RightOrBottom.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1162be9fa1f31bee8d3cba05c1422a1945621a412be11cce13d376efd5c679c -size 173 +oid sha256:09a80b11d888da121313d5f00ab0ec79ccf7bc49800135aa5eb411bd15fc6b86 +size 204 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-Both.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-Both.png index 59f928178..8985e6476 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-Both.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-Both.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ed262e9b885af773a4a40a4506e678630670e208bf7f9ec10307e943b166bed -size 258 +oid sha256:1ff446c4bb62d4492fc561a9dd48c4c0d95d8f4bcd9bbadf1675b2621baf9fa1 +size 212 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-LeftOrTop.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-LeftOrTop.png index 57ee3dc2f..1f9f0557b 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-LeftOrTop.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-LeftOrTop.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a24f2cfc225d01294b8bbc5ca7d7f1738fb0b79217046eb9edf04e4c4c01851 -size 201 +oid sha256:2d76e8055ddbdaaa8f21117ab5e06d3e7d0f5da9d21dd2a992d82e284f028606 +size 235 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-RightOrBottom.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-RightOrBottom.png index 7e47f43ff..c8c5696b1 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-RightOrBottom.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Left-RightOrBottom.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:938186fb3d0f468176988a9530efd22e66241a1361fff027005ec8a8ae323ff3 -size 197 +oid sha256:c7e594fd12ea7863d297d66852d3f80d5d3645636cdd39611c7b6fae068a6dc9 +size 230 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-Both.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-Both.png index 0f756e781..434457ffc 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-Both.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-Both.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4bc4b8ea7e7f10676d8de612fe6bc5144e100b95ff3fe7a1e3d4066a7684ce4d -size 239 +oid sha256:50f7f407d040b1071f7f6fbad96d6cfb2907d87060c671e74f6122ac5d381c30 +size 208 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-LeftOrTop.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-LeftOrTop.png index b2d420886..d3810b9d6 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-LeftOrTop.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-LeftOrTop.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:345337f7dffa48d95251503ee2ae8e91db98b5cbe06b579d73c38a018c781544 -size 182 +oid sha256:f305e35f0f4fac1c099b5d9f0b2775c1bb17f382aba13a068dedff45eda4632d +size 215 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-RightOrBottom.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-RightOrBottom.png index 4f0ad9d04..74d204d7c 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-RightOrBottom.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Right-RightOrBottom.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de4e2b71dade9dfb750a2c614a684963d6962958db79145c87fd23d9f0f8c005 -size 180 +oid sha256:c41784431d5a50746f66b3c34e966cb21fa8a088de797825633349cb077b4f97 +size 212 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-Both.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-Both.png index 78bdb8bbb..308fe3454 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-Both.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-Both.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d8b651663366e7543211635f337c229e2f88f1142886ea3a9b69587daaada97 -size 288 +oid sha256:7a6b2c8e072993c00a96692f10c7ebe6fcc6f4cfdcb9dff2d0aa6c65db54e1c4 +size 267 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-LeftOrTop.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-LeftOrTop.png index 7015a0557..6111bcae1 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-LeftOrTop.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-LeftOrTop.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ab8df31f1716c05bb8687f79c7d1154f6cc6f65e3917abe60ecc42d0df173dc -size 215 +oid sha256:018fe6af5dd7ed2edd163bf3da5e22f8333d3e3287629a2065ebfd15b7a2a8b3 +size 256 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-RightOrBottom.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-RightOrBottom.png index 67a765e8d..a0935a1ce 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-RightOrBottom.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_WithTaperMatrix_Rgba32_Solid30x30_(255,0,0,255)_Top-RightOrBottom.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a1671da9ea7702a37a866fabfb3ca0d746233ee108594198f23cb563af43ae6 -size 180 +oid sha256:530501bed8301799b68ba3dc8d50c877ed3f58073ab1a8a283e8f776e761cd28 +size 200 diff --git a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png index 4b2bb99d9..81863d3ef 100644 --- a/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png +++ b/tests/Images/External/ReferenceOutput/ProjectiveTransformTests/Transform_With_Custom_Dimensions_Rgba32_TestPattern100x100_57.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e7dedec16ccd66543a1d44052a104957ba62099ba2f2ccc72285c233c2ae3fa -size 4411 +oid sha256:73a18d217d0db5e6ed55cbf52801b7f083e083ca2f0a6ac20d320fd29961e6e0 +size 4399 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_CIELAB.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_CIELAB.png new file mode 100644 index 000000000..3863e7202 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_CIELAB.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8dd7d54f362b33c2d2d4b4b3cb3bbece23c14138073403234db7b53012939101 +size 383 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_CMYK.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_CMYK.png new file mode 100644 index 000000000..bc97709c1 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_CMYK.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:370af73b800622a671c0718b2c137ead8401adf20c39b45f153d2c9bb09b40ed +size 385 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_RGB16.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_RGB16.png new file mode 100644 index 000000000..3fcea773a --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_RGB16.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de9cfa53a82b169c533999908c7ace43aa35a8b456d5f0378b539669c7857d1c +size 386 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_RGB8.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_RGB8.png new file mode 100644 index 000000000..3fcea773a --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual_RGB8.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de9cfa53a82b169c533999908c7ace43aa35a8b456d5f0378b539669c7857d1c +size 386 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_Issue3031.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_Issue3031.png new file mode 100644 index 000000000..d5a017475 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_Issue3031.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c33a2f63836975bdc7631f26634b3fb0ae98bfaff730300877339cb568141cde +size 124 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_RgbaAssociatedAlpha16bit_lsb.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_RgbaAssociatedAlpha16bit_lsb.png new file mode 100644 index 000000000..a3317a6b4 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_RgbaAssociatedAlpha16bit_lsb.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e50dfa103459d21642df5e1ca760081fbdfe3b7244624d9d87d8a20f45b51bbe +size 117953 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_RgbaAssociatedAlpha16bit_msb.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_RgbaAssociatedAlpha16bit_msb.png new file mode 100644 index 000000000..5b72c3732 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_64Bit_WithAssociatedAlpha_Rgba64_RgbaAssociatedAlpha16bit_msb.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3333503012aa29e23f0d0e52993ad3499514251208fb3318e2bb1560d54650fa +size 117956 diff --git a/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_BigEndian_AssociatedAlpha_Rgba16161616_Rgba64_Issue3031.png b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_BigEndian_AssociatedAlpha_Rgba16161616_Rgba64_Issue3031.png new file mode 100644 index 000000000..d5a017475 --- /dev/null +++ b/tests/Images/External/ReferenceOutput/TiffDecoderTests/TiffDecoder_CanDecode_BigEndian_AssociatedAlpha_Rgba16161616_Rgba64_Issue3031.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c33a2f63836975bdc7631f26634b3fb0ae98bfaff730300877339cb568141cde +size 124 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-170.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-170.png index 65bb77977..c8b2ee0ce 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-170.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-170.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3594547265b23603b1a76ff6bc6f0eab4af55d6e0070e53356123dfc7ae256f8 -size 9034 +oid sha256:881daeef5b8db99af8b89e7d4e968fb4c43e13c904e936aefa1d0156b767803e +size 9051 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-50.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-50.png index 7c54b1b07..ccd3d8fa5 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-50.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_-50.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ae9ef073f3338b71d2a40fcf2e89d9b6ab62204d6de9b6a1f75f4705ee197f0 -size 10704 +oid sha256:86032d5b7e49574655c1cd54886ac57d6385714481ba6bd72176d858f884cd1a +size 10720 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_170.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_170.png index b6e930224..30a81a5b9 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_170.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_170.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:994dda7da034595aa77d107652bea06c86077d24ef8a6883b18f1f509bb19928 -size 8906 +oid sha256:cb823498eacf5bab12f7607d230523a3488e26fcc10fe1b3ab51de900a9dff97 +size 8835 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_50.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_50.png index d1ea99cf9..69f862a5a 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_50.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern100x50_50.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0fced9def2b41cbbf215a49ea6ef6baf4c3c041fd180671eb209db5c6e7177e5 -size 10470 +oid sha256:afe7ddbff155b918a4eff91af31e01100355c146cb9c8a12ab2496da8b22821d +size 10446 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-170.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-170.png index 2f3f0f17f..b2f18f855 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-170.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-170.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:29c5f48f1ece0b12854b4c44fba84fdfc9ac5751cdf564a32478dcdaed43b2a4 -size 9798 +oid sha256:be885eca2d9771be335a29d3da533a17376efa4c563996ac4cb37138fd1899eb +size 9826 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-50.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-50.png index 5242a9d98..39c4304be 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-50.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_-50.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c7de58474c3f386c4ec31a9088d561a513f82c08d1157132d735169b847b9680 -size 11579 +oid sha256:afea3d7ec03c945d695b3cd85e9ea1d79cb35745256efe1e32273eb08789e5ce +size 11476 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_170.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_170.png index 2af9d2fc2..e98d3115f 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_170.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_170.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ef9b7051d7a5733dfe2534fddefdc28dfbc49d087355f46c4d945b04f0e3936 -size 9672 +oid sha256:096eba716663179933fe6eb526822ac9dedf83c3633d43df328ed33fb16900f6 +size 9687 diff --git a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_50.png b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_50.png index 83c02764f..380b4b7d5 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_50.png +++ b/tests/Images/External/ReferenceOutput/Transforms/RotateTests/Rotate_WithAngle_TestPattern50x100_50.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:825770c9b2e9f265d834eab6b40604df5508bf9bc5b4f82f5d3effd6d5a26935 -size 11434 +oid sha256:c7367063704e10827bb81f46ebb56b6fe87a816eb8ec258ca95d8e26d9276f0f +size 11408 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_-20_-10.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_-20_-10.png index d6dba3f88..e8822425d 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_-20_-10.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_-20_-10.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e283463b0f450dd72cf303acccf3dd1ff7a31fe401ff0f288d67c4baefca240 -size 8742 +oid sha256:37acdbbcebe56ab98e17b025312e5860c471d807603c2ce6f4a50fd5f219c0f7 +size 8732 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_20_10.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_20_10.png index 76bb244d5..0a798ce06 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_20_10.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Bgra32_TestPattern100x50_20_10.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:485d9d9ef955a04af43d17e6bc3952e9bf65a9752b6cf8ba9cbbe8f772f05a18 -size 8995 +oid sha256:722d191e930331e296a548641a80ac163430bdb4017e3d68e4638fbb1d6ed45c +size 9021 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_-20_-10.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_-20_-10.png index c1c1d814f..8d4d2fd9b 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_-20_-10.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_-20_-10.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3d749ac365764051ea16bc39d1aff84c06faf282359805b58bb97c9eed7f0bb -size 6400 +oid sha256:ce2bbe927b718a1b4de05b2baad7016b69490d1b5dfb085420192b7ac6c0ec5d +size 6367 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_20_10.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_20_10.png index 27608881e..2d5fd9e9f 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_20_10.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_IsNotBoundToSinglePixelType_Rgb24_TestPattern100x50_20_10.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d82f2a15502b0a29aa4df1077ec90c88f9211f283fdc0edd7b059ed9b387441 -size 6334 +oid sha256:d79a7044e95a1ca032124366e4705bd93a866609547ebb489ff7d2228547cea5 +size 6330 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Bicubic.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Bicubic.png index 340455428..a9de3011d 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Bicubic.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Bicubic.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e8afa56c5abb0e4b5895f35415db1178d041120d9f8306902f554cfaaada88d -size 26540 +oid sha256:677e4419a1cac8692da2d852f6e169c4a66ef8f164fffa65550fccb71bb54563 +size 26606 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Box.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Box.png index 9ef786692..2ae230ac5 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Box.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Box.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a2c174ef54b68f025352e25800f655fe3b94a0d3f75cb48bd2ac0e8d6931faf8 -size 24827 +oid sha256:0f700e854d2d4ee9c12150ef300e0041fa4706ae595eeea6869894a1e2947eaf +size 24963 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_CatmullRom.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_CatmullRom.png index 14f774853..63f5f9959 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_CatmullRom.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_CatmullRom.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b56ceae2f350a1402beecc5b5e2930be1011a95fbf224cccf73b96f3931b646 -size 26531 +oid sha256:965248b773ea4b3f8e870ff598ccf88784dd700d9aa063b70b0146a00fc806bc +size 26613 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Hermite.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Hermite.png index c8204eacf..bf1e06332 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Hermite.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Hermite.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:049ee7fc2bb758609a64149c338bfae2eab44755f53e6b7c25a5e8b8725ed8ac -size 24416 +oid sha256:cd8e29141de12f1c1a2b3fb057a58b5a017b6db3498023a8f77dc8ac02d7845c +size 24396 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos2.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos2.png index 2bc57092a..c903716e7 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos2.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72c487a2fa3d608021b26a4d6b4517f8548fdcfc62fbafdd8649015dbec8ff87 -size 26504 +oid sha256:a28ac3e9bd2edc2aa7163275006f701672cd7f0b92454a0453a6e73387c70138 +size 26611 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos3.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos3.png index fee364e21..5749ec1ac 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos3.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:099733c9d4490c86cfbb10a016e2dd073539a95f9d5ff9018cf9b5be5404fa13 -size 33435 +oid sha256:2a57780c4145cf1eef6028d7e58ef94ab6d47f80a024f43fe98297f2d398a7fc +size 33409 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos5.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos5.png index 30325ccc6..5f98b4184 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos5.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos5.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27f2a2b21f8ae878e15120ea5a4a983bde7984b3468dc8426055885efc278fe6 -size 35547 +oid sha256:129f1770502c71fcbe67da35a6966a4c72e4d17ee70a8e951a5229db99d03089 +size 35607 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos8.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos8.png index ff81256a7..979b0366a 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos8.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Lanczos8.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b5cbe60e26e123e5a5cdf5a4e88305340f76d32a9c64a220c1fa7512f84e786 -size 39442 +oid sha256:0b7a58c5219ce2b6c91f98b7a75a9c89292e69d816451425b9b829d6a2b1711c +size 39420 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_MitchellNetravali.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_MitchellNetravali.png index 263dd7426..6cfbcee61 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_MitchellNetravali.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_MitchellNetravali.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:102cceb79acb1dfd7ec8887b4906e33456c774d48320d1624b3c73975d26f145 -size 25981 +oid sha256:b80944705b204ab37b1a1a0b7d0705fba4f4eae4ea9453ae8ed0e39104765ee9 +size 25836 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_NearestNeighbor.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_NearestNeighbor.png index 9ef786692..2ae230ac5 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_NearestNeighbor.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_NearestNeighbor.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a2c174ef54b68f025352e25800f655fe3b94a0d3f75cb48bd2ac0e8d6931faf8 -size 24827 +oid sha256:0f700e854d2d4ee9c12150ef300e0041fa4706ae595eeea6869894a1e2947eaf +size 24963 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Robidoux.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Robidoux.png index 85bbd5ec3..8aeed9c8d 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Robidoux.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Robidoux.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e61629aeefac7e0a1a6b46b44ad86ed4a5ba0908bb3febc18bb5f9f3ded1c08d -size 25751 +oid sha256:314e15b8d690b17aa67ee856bcaf55afc62ce86c1b1d86b0f17dffe8739a2d17 +size 25739 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_RobidouxSharp.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_RobidouxSharp.png index f200a5f95..e7e2c554b 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_RobidouxSharp.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_RobidouxSharp.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:45b1b48e1df393f4c435189c71a6bd3bccfe7a055d76d414a8d0c009b59fa0a0 -size 26145 +oid sha256:abf063ddd974a8eef6b24da9e58a10143d9fefa29369b11f7b27685312a0c74b +size 26084 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Spline.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Spline.png index 434bb32a8..0d11b5565 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Spline.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Spline.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d6d186f9e547f658b719bc033e3b110d64cf2a02caecc510d4e2f88359e69746 -size 24176 +oid sha256:f417e1771b2a367f857888ae90bd75f9922d9e5fc8826009ded592d9da010a44 +size 24155 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Triangle.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Triangle.png index e3be1ffe5..0f305ddd3 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Triangle.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Triangle.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:339b3299984f1450f1a8200e487964c0338b511b82e459d67a3583d0bd46b805 -size 24013 +oid sha256:6aebe33dad1ea3a709f54f234cb779956f5b561a9a5ecf23a95e7ec42d91c535 +size 23905 diff --git a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Welch.png b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Welch.png index 7dbeeaf35..835d72907 100644 --- a/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Welch.png +++ b/tests/Images/External/ReferenceOutput/Transforms/SkewTests/Skew_WorksWithAllResamplers_ducky_Welch.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5335c6184829fdc405475bd34d2fae60cf6d5ae050b4d671ac5dd25242ff1368 -size 31888 +oid sha256:bb7684478edd471057076a408c6b32102838db466476929ee58e248f5c20a2b2 +size 31872 diff --git a/tests/Images/External/ReferenceOutput/WebpDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png b/tests/Images/External/ReferenceOutput/WebpDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png new file mode 100644 index 000000000..4a01423ee --- /dev/null +++ b/tests/Images/External/ReferenceOutput/WebpDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a2cbd483eed31cf7b410ef1ee45ae78e77b36e5b9c31f87764a1dfdb9c4e5c8 +size 79768 diff --git a/tests/Images/External/ReferenceOutput/WebpDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png b/tests/Images/External/ReferenceOutput/WebpDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png new file mode 100644 index 000000000..c46b369ef --- /dev/null +++ b/tests/Images/External/ReferenceOutput/WebpDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:547f3ddb5bdb3a3cb5c87440b65728be295c2b5f3c10a1b0b44299bb3d80e8d7 +size 79651 diff --git a/tests/Images/Input/Gif/issues/issue_2953.gif b/tests/Images/Input/Gif/issues/issue_2953.gif new file mode 100644 index 000000000..98c06e5c5 --- /dev/null +++ b/tests/Images/Input/Gif/issues/issue_2953.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fa4a002b264a41677cc10f115f3572111852993a53ee8cea5f4ec0bf8dec195 +size 40 diff --git a/tests/Images/Input/Gif/issues/issue_2980.gif b/tests/Images/Input/Gif/issues/issue_2980.gif new file mode 100644 index 000000000..9c41a0f0b --- /dev/null +++ b/tests/Images/Input/Gif/issues/issue_2980.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3737a411dde845e20fc151e610434b96fb0a47297341db6f435e1ea64ae789b +size 507 diff --git a/tests/Images/Input/Jpg/icc-profiles/Perceptual-cLUT-only.jpg b/tests/Images/Input/Jpg/icc-profiles/Perceptual-cLUT-only.jpg new file mode 100644 index 000000000..7b2e57f65 --- /dev/null +++ b/tests/Images/Input/Jpg/icc-profiles/Perceptual-cLUT-only.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04e552f0bd68bddb40f35c456034b1bf1e590f37e990a28b2fe2e94753bbe685 +size 276191 diff --git a/tests/Images/Input/Jpg/icc-profiles/Perceptual.jpg b/tests/Images/Input/Jpg/icc-profiles/Perceptual.jpg new file mode 100644 index 000000000..879fd05ad --- /dev/null +++ b/tests/Images/Input/Jpg/icc-profiles/Perceptual.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74a0931e320ca938d7dc94c4ab7b27a15880732fc139718629a7234f34bdafba +size 297456 diff --git a/tests/Images/Input/Jpg/icc-profiles/sRGB_Gray.jpg b/tests/Images/Input/Jpg/icc-profiles/sRGB_Gray.jpg new file mode 100644 index 000000000..2abd97686 --- /dev/null +++ b/tests/Images/Input/Jpg/icc-profiles/sRGB_Gray.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22892d1b7965d973c7d8925ad7d749988c6a36b333b264a55d389f1e4faa0245 +size 36854 diff --git a/tests/Images/Input/Jpg/issues/issue-2948-sos.jpg b/tests/Images/Input/Jpg/issues/issue-2948-sos.jpg new file mode 100644 index 000000000..d210e87e5 --- /dev/null +++ b/tests/Images/Input/Jpg/issues/issue-2948-sos.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad9c3a6babb41c5aa2a46fbfe74ed5482028c73f48531cf144e1e324ca7988b3 +size 103789 diff --git a/tests/Images/Input/Png/icc-profiles/Perceptual-cLUT-only.png b/tests/Images/Input/Png/icc-profiles/Perceptual-cLUT-only.png new file mode 100644 index 000000000..8ac1afde9 --- /dev/null +++ b/tests/Images/Input/Png/icc-profiles/Perceptual-cLUT-only.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c734cacc2c6e761bab088cac80ef09da7b56a545ce71c6cced4cac31e661795 +size 119811 diff --git a/tests/Images/Input/Png/icc-profiles/Perceptual.png b/tests/Images/Input/Png/icc-profiles/Perceptual.png new file mode 100644 index 000000000..cac9bcb1e --- /dev/null +++ b/tests/Images/Input/Png/icc-profiles/Perceptual.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:208a325dedea4453b7accce1ec540452af2e9be0f8c1f636f1d61a463eb3a9ae +size 123151 diff --git a/tests/Images/Input/Png/icc-profiles/sRGB_Gray.png b/tests/Images/Input/Png/icc-profiles/sRGB_Gray.png new file mode 100644 index 000000000..3326936ce --- /dev/null +++ b/tests/Images/Input/Png/icc-profiles/sRGB_Gray.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c64e0f6cc38750c83e6ff0cf1911e210c342900bb2cd6c88d3daed30c854e863 +size 4531 diff --git a/tests/Images/Input/Png/icc-profiles/sRGB_Gray_Interlaced_Rgba32.png b/tests/Images/Input/Png/icc-profiles/sRGB_Gray_Interlaced_Rgba32.png new file mode 100644 index 000000000..7afc51cfe --- /dev/null +++ b/tests/Images/Input/Png/icc-profiles/sRGB_Gray_Interlaced_Rgba32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fc63cea5de188e76503bde2fce3ff84518af5064bb46d506420cd6d7e58285b +size 7237 diff --git a/tests/Images/Input/Png/icc-profiles/sRGB_Gray_Interlaced_Rgba64.png b/tests/Images/Input/Png/icc-profiles/sRGB_Gray_Interlaced_Rgba64.png new file mode 100644 index 000000000..822aca4f5 --- /dev/null +++ b/tests/Images/Input/Png/icc-profiles/sRGB_Gray_Interlaced_Rgba64.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64343871be4ad61451ef968fa9f07c6a11dee65d0f8fd718ae8c4941586aa60c +size 8227 diff --git a/tests/Images/Input/Png/iptc-profile.png b/tests/Images/Input/Png/iptc-profile.png new file mode 100644 index 000000000..fa4199a0c --- /dev/null +++ b/tests/Images/Input/Png/iptc-profile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae7f5d11145762b6544b3e289fc6c3bcb13a5f4cd8511b02280da683bec4c96e +size 448011 diff --git a/tests/Images/Input/Png/issues/issue_3000.png b/tests/Images/Input/Png/issues/issue_3000.png new file mode 100644 index 000000000..d7d7ad4c6 --- /dev/null +++ b/tests/Images/Input/Png/issues/issue_3000.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f33e2f343140b01d9c5c913f4ea695748e3a93df145bc0bf2f73763f2d24cadc +size 385 diff --git a/tests/Images/Input/Tiff/Issues/ExtraSamplesUnspecified.tif b/tests/Images/Input/Tiff/Issues/ExtraSamplesUnspecified.tif new file mode 100644 index 000000000..b5835c1ed --- /dev/null +++ b/tests/Images/Input/Tiff/Issues/ExtraSamplesUnspecified.tif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71d28f17d2d56481faa4d241fae882eae4f8303c70f85bc3759f6a0c2074979e +size 1426558 diff --git a/tests/Images/Input/Tiff/Issues/Issue2983.tiff b/tests/Images/Input/Tiff/Issues/Issue2983.tiff new file mode 100644 index 000000000..7332ca42a --- /dev/null +++ b/tests/Images/Input/Tiff/Issues/Issue2983.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7bfe1d8660d11111cdf2674aedc43c1362dc8c2ecfab9b74b43a06c7c195863e +size 13311100 diff --git a/tests/Images/Input/Tiff/Issues/Issue3031.tiff b/tests/Images/Input/Tiff/Issues/Issue3031.tiff new file mode 100644 index 000000000..bc3ef7d7c --- /dev/null +++ b/tests/Images/Input/Tiff/Issues/Issue3031.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e4d2db56a1b7fdea09ed65eab1d10a02952821f6662ca77caa44b8c51b30310 +size 416 diff --git a/tests/Images/Input/Tiff/icc-profiles/Perceptual_CIELAB.tiff b/tests/Images/Input/Tiff/icc-profiles/Perceptual_CIELAB.tiff new file mode 100644 index 000000000..ab2aff820 --- /dev/null +++ b/tests/Images/Input/Tiff/icc-profiles/Perceptual_CIELAB.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9494eea65b2c5b6ef033fb89b4fee2ef97d07773ae4b3988da972e1ba152b890 +size 64418 diff --git a/tests/Images/Input/Tiff/icc-profiles/Perceptual_CMYK.tiff b/tests/Images/Input/Tiff/icc-profiles/Perceptual_CMYK.tiff new file mode 100644 index 000000000..7dd685fe3 --- /dev/null +++ b/tests/Images/Input/Tiff/icc-profiles/Perceptual_CMYK.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfb7fe9e93362fa121d97fa05f61242733d79fa9fa06bb7153e1773e827567dd +size 601124 diff --git a/tests/Images/Input/Tiff/icc-profiles/Perceptual_RGB16.tiff b/tests/Images/Input/Tiff/icc-profiles/Perceptual_RGB16.tiff new file mode 100644 index 000000000..369284819 --- /dev/null +++ b/tests/Images/Input/Tiff/icc-profiles/Perceptual_RGB16.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b0e89ac971c23c12c9edff6f9e9dd066fe99f36e28e89972343d50562dd7dbd +size 65260 diff --git a/tests/Images/Input/Tiff/icc-profiles/Perceptual_RGB8.tiff b/tests/Images/Input/Tiff/icc-profiles/Perceptual_RGB8.tiff new file mode 100644 index 000000000..e2c1ff54c --- /dev/null +++ b/tests/Images/Input/Tiff/icc-profiles/Perceptual_RGB8.tiff @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18b0e5ee58c9f53bf5414fc8244e98d65aa0bc6c3397e201399baff0cd378b23 +size 35236 diff --git a/tests/Images/Input/Webp/icc-profiles/Perceptual-cLUT-only.webp b/tests/Images/Input/Webp/icc-profiles/Perceptual-cLUT-only.webp new file mode 100644 index 000000000..4787b792a --- /dev/null +++ b/tests/Images/Input/Webp/icc-profiles/Perceptual-cLUT-only.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b7ef9eedd1b2a4b93f11ac52807c071f7d0a24513008c3e69b0d4a0fd9b70db +size 186596 diff --git a/tests/Images/Input/Webp/icc-profiles/Perceptual.webp b/tests/Images/Input/Webp/icc-profiles/Perceptual.webp new file mode 100644 index 000000000..b78504f43 --- /dev/null +++ b/tests/Images/Input/Webp/icc-profiles/Perceptual.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aad13221b103b60c21a19e7ecfbab047404f25269485d26fc5dee4be11188865 +size 189800 diff --git a/tests/Images/Input/Webp/issues/Issue2906.webp b/tests/Images/Input/Webp/issues/Issue2906.webp new file mode 100644 index 000000000..0911da047 --- /dev/null +++ b/tests/Images/Input/Webp/issues/Issue2906.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56fe6a91feb9545c0a15966e0f6bc560890b193073c96ae9e39bf387c7e0cbca +size 157092