Skip to content

Commit 314e9f6

Browse files
Don't use generics.
Could have saved myself days of issues if i'd just thought of this first.
1 parent 65b1996 commit 314e9f6

File tree

6 files changed

+24
-76
lines changed

6 files changed

+24
-76
lines changed

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,18 @@ public void BmpDecoder_CanDecode_MiscellaneousBitmaps<TPixel>(TestImageProvider<
5252
}
5353
}
5454

55-
[ActiveIssue("https://github.com/dotnet/arcade/issues/6393", TargetFrameworkMonikers.NetFramework)]
5655
[Theory]
5756
[WithFileCollection(nameof(MiscBmpFiles), PixelTypes.Rgba32)]
58-
public void BmpDecoder_CanDecode_MiscellaneousBitmaps_WithLimitedAllocatorBufferCapacity<TPixel>(
59-
TestImageProvider<TPixel> provider)
60-
where TPixel : unmanaged, IPixel<TPixel>
57+
public void BmpDecoder_CanDecode_MiscellaneousBitmaps_WithLimitedAllocatorBufferCapacity(
58+
TestImageProvider<Rgba32> provider)
6159
{
62-
// dotnet xunit doesn't respect filter.
63-
if (TestEnvironment.IsFramework)
64-
{
65-
return;
66-
}
67-
6860
static void RunTest(string providerDump, string nonContiguousBuffersStr)
6961
{
70-
TestImageProvider<TPixel> provider = BasicSerializer.Deserialize<TestImageProvider<TPixel>>(providerDump);
62+
TestImageProvider<Rgba32> provider = BasicSerializer.Deserialize<TestImageProvider<Rgba32>>(providerDump);
7163

7264
provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100);
7365

74-
using Image<TPixel> image = provider.GetImage(BmpDecoder);
66+
using Image<Rgba32> image = provider.GetImage(BmpDecoder);
7567
image.DebugSave(provider, nonContiguousBuffersStr);
7668

7769
if (TestEnvironment.IsWindows)

tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,26 +195,20 @@ public void GifDecoder_DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatExce
195195
Assert.IsType<InvalidMemoryOperationException>(ex.InnerException);
196196
}
197197

198-
[ActiveIssue("https://github.com/dotnet/arcade/issues/6393", TargetFrameworkMonikers.NetFramework)]
199198
[Theory]
200199
[WithFile(TestImages.Gif.Giphy, PixelTypes.Rgba32)]
201200
[WithFile(TestImages.Gif.Kumin, PixelTypes.Rgba32)]
202-
public void GifDecoder_CanDecode_WithLimitedAllocatorBufferCapacity<TPixel>(TestImageProvider<TPixel> provider)
203-
where TPixel : unmanaged, IPixel<TPixel>
201+
public void GifDecoder_CanDecode_WithLimitedAllocatorBufferCapacity(
202+
TestImageProvider<Rgba32> provider)
204203
{
205-
// dotnet xunit doesn't respect filter.
206-
if (TestEnvironment.IsFramework)
207-
{
208-
return;
209-
}
210-
211204
static void RunTest(string providerDump, string nonContiguousBuffersStr)
212205
{
213-
TestImageProvider<TPixel> provider = BasicSerializer.Deserialize<TestImageProvider<TPixel>>(providerDump);
206+
TestImageProvider<Rgba32> provider
207+
= BasicSerializer.Deserialize<TestImageProvider<Rgba32>>(providerDump);
214208

215209
provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100);
216210

217-
using Image<TPixel> image = provider.GetImage(GifDecoder);
211+
using Image<Rgba32> image = provider.GetImage(GifDecoder);
218212
image.DebugSave(provider, nonContiguousBuffersStr);
219213
image.CompareToOriginal(provider);
220214
}

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,18 @@ public void DecodeProgressiveJpeg<TPixel>(TestImageProvider<TPixel> provider)
2828
appendPixelTypeToFileName: false);
2929
}
3030

31-
[ActiveIssue("https://github.com/dotnet/arcade/issues/6393", TargetFrameworkMonikers.NetFramework)]
3231
[Theory]
3332
[WithFile(TestImages.Jpeg.Progressive.Progress, PixelTypes.Rgba32)]
34-
public void DecodeProgressiveJpeg_WithLimitedAllocatorBufferCapacity<TPixel>(TestImageProvider<TPixel> provider)
35-
where TPixel : unmanaged, IPixel<TPixel>
33+
public void DecodeProgressiveJpeg_WithLimitedAllocatorBufferCapacity(TestImageProvider<Rgba32> provider)
3634
{
37-
// dotnet xunit doesn't respect filter.
38-
if (TestEnvironment.IsFramework)
39-
{
40-
return;
41-
}
42-
4335
static void RunTest(string providerDump, string nonContiguousBuffersStr)
4436
{
45-
TestImageProvider<TPixel> provider =
46-
BasicSerializer.Deserialize<TestImageProvider<TPixel>>(providerDump);
37+
TestImageProvider<Rgba32> provider =
38+
BasicSerializer.Deserialize<TestImageProvider<Rgba32>>(providerDump);
4739

4840
provider.LimitAllocatorBufferCapacity().InBytesSqrt(200);
4941

50-
using Image<TPixel> image = provider.GetImage(JpegDecoder);
42+
using Image<Rgba32> image = provider.GetImage(JpegDecoder);
5143
image.DebugSave(provider, nonContiguousBuffersStr);
5244

5345
provider.Utility.TestName = DecodeProgressiveJpegOutputName;
@@ -62,8 +54,8 @@ static void RunTest(string providerDump, string nonContiguousBuffersStr)
6254
RemoteExecutor.Invoke(
6355
RunTest,
6456
providerDump,
65-
"Disco")
66-
.Dispose();
57+
"Disco")
58+
.Dispose();
6759
}
6860
}
6961
}

tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -396,37 +396,23 @@ public void Issue410_MalformedApplePng<TPixel>(TestImageProvider<TPixel> provide
396396
public void PngDecoder_DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatException<TPixel>(TestImageProvider<TPixel> provider)
397397
where TPixel : unmanaged, IPixel<TPixel>
398398
{
399-
// dotnet xunit doesn't respect filter.
400-
if (TestEnvironment.IsFramework)
401-
{
402-
return;
403-
}
404-
405399
provider.LimitAllocatorBufferCapacity().InPixelsSqrt(10);
406400
InvalidImageContentException ex = Assert.Throws<InvalidImageContentException>(() => provider.GetImage(PngDecoder));
407401
Assert.IsType<InvalidMemoryOperationException>(ex.InnerException);
408402
}
409403

410-
[ActiveIssue("https://github.com/dotnet/arcade/issues/6393", TargetFrameworkMonikers.NetFramework)]
411404
[Theory]
412405
[WithFile(TestImages.Png.Splash, PixelTypes.Rgba32)]
413406
[WithFile(TestImages.Png.Bike, PixelTypes.Rgba32)]
414-
public void PngDecoder_CanDecode_WithLimitedAllocatorBufferCapacity<TPixel>(TestImageProvider<TPixel> provider)
415-
where TPixel : unmanaged, IPixel<TPixel>
407+
public void PngDecoder_CanDecode_WithLimitedAllocatorBufferCapacity(TestImageProvider<Rgba32> provider)
416408
{
417-
// dotnet xunit doesn't respect filter.
418-
if (TestEnvironment.IsFramework)
419-
{
420-
return;
421-
}
422-
423409
static void RunTest(string providerDump, string nonContiguousBuffersStr)
424410
{
425-
TestImageProvider<TPixel> provider = BasicSerializer.Deserialize<TestImageProvider<TPixel>>(providerDump);
411+
TestImageProvider<Rgba32> provider = BasicSerializer.Deserialize<TestImageProvider<Rgba32>>(providerDump);
426412

427413
provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100);
428414

429-
using Image<TPixel> image = provider.GetImage(PngDecoder);
415+
using Image<Rgba32> image = provider.GetImage(PngDecoder);
430416
image.DebugSave(provider, testOutputDetails: nonContiguousBuffersStr);
431417
image.CompareToOriginal(provider);
432418
}

tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -534,22 +534,14 @@ public void Encode_WorksWithDiscontiguousBuffers<TPixel>(TestImageProvider<TPixe
534534
}
535535
}
536536

537-
[ActiveIssue("https://github.com/dotnet/arcade/issues/6393", TargetFrameworkMonikers.NetFramework)]
538537
[Theory]
539538
[WithTestPatternImages(100, 100, PixelTypes.Rgba32)]
540-
public void EncodeWorksWithoutSsse3Intrinsics<TPixel>(TestImageProvider<TPixel> provider)
541-
where TPixel : unmanaged, IPixel<TPixel>
539+
public void EncodeWorksWithoutSsse3Intrinsics(TestImageProvider<Rgba32> provider)
542540
{
543-
// dotnet xunit doesn't respect filter.
544-
if (TestEnvironment.IsFramework)
545-
{
546-
return;
547-
}
548-
549541
static void RunTest(string providerDump)
550542
{
551-
TestImageProvider<TPixel> provider =
552-
BasicSerializer.Deserialize<TestImageProvider<TPixel>>(providerDump);
543+
TestImageProvider<Rgba32> provider =
544+
BasicSerializer.Deserialize<TestImageProvider<Rgba32>>(providerDump);
553545
#if SUPPORTS_RUNTIME_INTRINSICS
554546
Assert.False(Ssse3.IsSupported);
555547
#endif

tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -744,26 +744,18 @@ public void TgaDecoder_DegenerateMemoryRequest_ShouldTranslateTo_ImageFormatExce
744744
Assert.IsType<InvalidMemoryOperationException>(ex.InnerException);
745745
}
746746

747-
[ActiveIssue("https://github.com/dotnet/arcade/issues/6393", TargetFrameworkMonikers.NetFramework)]
748747
[Theory]
749748
[WithFile(Bit24BottomLeft, PixelTypes.Rgba32)]
750749
[WithFile(Bit32BottomLeft, PixelTypes.Rgba32)]
751-
public void TgaDecoder_CanDecode_WithLimitedAllocatorBufferCapacity<TPixel>(TestImageProvider<TPixel> provider)
752-
where TPixel : unmanaged, IPixel<TPixel>
750+
public void TgaDecoder_CanDecode_WithLimitedAllocatorBufferCapacity(TestImageProvider<Rgba32> provider)
753751
{
754-
// dotnet xunit doesn't respect filter.
755-
if (TestEnvironment.IsFramework)
756-
{
757-
return;
758-
}
759-
760752
static void RunTest(string providerDump, string nonContiguousBuffersStr)
761753
{
762-
TestImageProvider<TPixel> provider = BasicSerializer.Deserialize<TestImageProvider<TPixel>>(providerDump);
754+
TestImageProvider<Rgba32> provider = BasicSerializer.Deserialize<TestImageProvider<Rgba32>>(providerDump);
763755

764756
provider.LimitAllocatorBufferCapacity().InPixelsSqrt(100);
765757

766-
using Image<TPixel> image = provider.GetImage(TgaDecoder);
758+
using Image<Rgba32> image = provider.GetImage(TgaDecoder);
767759
image.DebugSave(provider, testOutputDetails: nonContiguousBuffersStr);
768760

769761
if (TestEnvironment.IsWindows)

0 commit comments

Comments
 (0)