From 2145794271c41e924275e845f625ae8f89c1c613 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 12 Dec 2022 09:15:14 +1000 Subject: [PATCH] Fix test file --- .../Formats/Jpg/JpegDecoderTests.Metadata.cs | 2 +- .../Formats/Jpg/JpegDecoderTests.cs | 1 - tests/ImageSharp.Tests/TestFile.cs | 34 +------------------ 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs index 9f6b0d751..ebcf9c882 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs @@ -253,7 +253,7 @@ public partial class JpegDecoderTests DecoderOptions options = new() { SkipMetadata = ignoreMetadata }; // Snake.jpg has both Exif and ICC profiles defined: - var testFile = TestFile.Create(TestImages.Jpeg.Baseline.Snake); + TestFile testFile = TestFile.Create(TestImages.Jpeg.Baseline.Snake); using Image image = testFile.CreateRgba32Image(JpegDecoder, options); if (ignoreMetadata) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index a545f8542..4ac86a608 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -8,7 +8,6 @@ using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; -using SixLabors.ImageSharp.Tests.TestUtilities; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/TestFile.cs b/tests/ImageSharp.Tests/TestFile.cs index 72298837c..a53e50806 100644 --- a/tests/ImageSharp.Tests/TestFile.cs +++ b/tests/ImageSharp.Tests/TestFile.cs @@ -2,7 +2,6 @@ // Licensed under the Six Labors Split License. using System.Collections.Concurrent; -using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.PixelFormats; @@ -24,16 +23,6 @@ public sealed class TestFile // ReSharper disable once InconsistentNaming private static readonly Lazy InputImagesDirectoryValue = new(() => TestEnvironment.InputImagesDirectoryFullPath); - /// - /// The image (lazy initialized value) - /// - private volatile Image image; - - /// - /// Used to ensure image loading is threadsafe. - /// - private readonly object syncLock = new(); - /// /// The image bytes /// @@ -65,25 +54,6 @@ public sealed class TestFile /// public string FileNameWithoutExtension => Path.GetFileNameWithoutExtension(this.FullPath); - /// - /// Gets the image with lazy initialization. - /// - private Image Image - { - get - { - if (this.image is null) - { - lock (this.syncLock) - { - this.image ??= ImageSharp.Image.Load(this.Bytes); - } - } - - return this.image; - } - } - /// /// Gets the input image directory. /// @@ -137,8 +107,7 @@ public sealed class TestFile /// /// The . /// - public Image CreateRgba32Image() - => this.Image.Clone(); + public Image CreateRgba32Image() => Image.Load(this.Bytes); /// /// Creates a new image. @@ -160,7 +129,6 @@ public sealed class TestFile /// public Image CreateRgba32Image(IImageDecoder decoder, DecoderOptions options) { - options.Configuration = this.Image.GetConfiguration(); using MemoryStream stream = new(this.Bytes); return decoder.Decode(options, stream); }