Skip to content

Commit 2145794

Browse files
Fix test file
1 parent 5f488ee commit 2145794

File tree

3 files changed

+2
-35
lines changed

3 files changed

+2
-35
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public void IgnoreMetadata_ControlsWhetherMetadataIsParsed(bool ignoreMetadata)
253253
DecoderOptions options = new() { SkipMetadata = ignoreMetadata };
254254

255255
// Snake.jpg has both Exif and ICC profiles defined:
256-
var testFile = TestFile.Create(TestImages.Jpeg.Baseline.Snake);
256+
TestFile testFile = TestFile.Create(TestImages.Jpeg.Baseline.Snake);
257257

258258
using Image<Rgba32> image = testFile.CreateRgba32Image(JpegDecoder, options);
259259
if (ignoreMetadata)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using SixLabors.ImageSharp.PixelFormats;
99
using SixLabors.ImageSharp.Processing;
1010
using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils;
11-
using SixLabors.ImageSharp.Tests.TestUtilities;
1211
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
1312
using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
1413
using Xunit.Abstractions;

tests/ImageSharp.Tests/TestFile.cs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Six Labors Split License.
33

44
using System.Collections.Concurrent;
5-
using SixLabors.ImageSharp.Advanced;
65
using SixLabors.ImageSharp.Formats;
76
using SixLabors.ImageSharp.PixelFormats;
87

@@ -24,16 +23,6 @@ public sealed class TestFile
2423
// ReSharper disable once InconsistentNaming
2524
private static readonly Lazy<string> InputImagesDirectoryValue = new(() => TestEnvironment.InputImagesDirectoryFullPath);
2625

27-
/// <summary>
28-
/// The image (lazy initialized value)
29-
/// </summary>
30-
private volatile Image<Rgba32> image;
31-
32-
/// <summary>
33-
/// Used to ensure image loading is threadsafe.
34-
/// </summary>
35-
private readonly object syncLock = new();
36-
3726
/// <summary>
3827
/// The image bytes
3928
/// </summary>
@@ -65,25 +54,6 @@ public sealed class TestFile
6554
/// </summary>
6655
public string FileNameWithoutExtension => Path.GetFileNameWithoutExtension(this.FullPath);
6756

68-
/// <summary>
69-
/// Gets the image with lazy initialization.
70-
/// </summary>
71-
private Image<Rgba32> Image
72-
{
73-
get
74-
{
75-
if (this.image is null)
76-
{
77-
lock (this.syncLock)
78-
{
79-
this.image ??= ImageSharp.Image.Load<Rgba32>(this.Bytes);
80-
}
81-
}
82-
83-
return this.image;
84-
}
85-
}
86-
8757
/// <summary>
8858
/// Gets the input image directory.
8959
/// </summary>
@@ -137,8 +107,7 @@ public string GetFileNameWithoutExtension(object value)
137107
/// <returns>
138108
/// The <see cref="Image{Rgba32}"/>.
139109
/// </returns>
140-
public Image<Rgba32> CreateRgba32Image()
141-
=> this.Image.Clone();
110+
public Image<Rgba32> CreateRgba32Image() => Image.Load<Rgba32>(this.Bytes);
142111

143112
/// <summary>
144113
/// Creates a new <see cref="Rgba32"/> image.
@@ -160,7 +129,6 @@ public Image<Rgba32> CreateRgba32Image(IImageDecoder decoder)
160129
/// </returns>
161130
public Image<Rgba32> CreateRgba32Image(IImageDecoder decoder, DecoderOptions options)
162131
{
163-
options.Configuration = this.Image.GetConfiguration();
164132
using MemoryStream stream = new(this.Bytes);
165133
return decoder.Decode<Rgba32>(options, stream);
166134
}

0 commit comments

Comments
 (0)