Browse Source

Change ConvertRgbToYuv with alpha test to use a fixed image as input

pull/1552/head
Brian Popow 5 years ago
parent
commit
91f3f6a49f
  1. 12
      tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs
  2. 2
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Png/testpattern31x31-halftransparent.png
  4. 3
      tests/Images/Input/Png/testpattern31x31.png

12
tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs

@ -132,7 +132,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Webp
}
[Theory]
[WithTestPatternImages(31, 31, PixelTypes.Rgba32)]
[WithFile(TestImages.Png.TestPattern31x31HalfTransparent, PixelTypes.Rgba32)]
public void ConvertRgbToYuv_WithAlpha_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
@ -146,16 +146,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Webp
using System.Buffers.IMemoryOwner<byte> uBuffer = memoryAllocator.Allocate<byte>(uvWidth * image.Height);
using System.Buffers.IMemoryOwner<byte> vBuffer = memoryAllocator.Allocate<byte>(uvWidth * image.Height);
// Make half of the the image transparent.
image.Mutate(c => c.ProcessPixelRowsAsVector4(row =>
{
int halfWidth = row.Length / 2;
for (int x = 0; x < halfWidth; x++)
{
row[x] = new Vector4(row[x].X, row[x].Y, row[x].Z, 0.0f);
}
}));
Span<byte> y = yBuffer.GetSpan();
Span<byte> u = uBuffer.GetSpan();
Span<byte> v = vBuffer.GetSpan();

2
tests/ImageSharp.Tests/TestImages.cs

@ -59,6 +59,8 @@ namespace SixLabors.ImageSharp.Tests
public const string PngWithMetadata = "Png/PngWithMetaData.png";
public const string InvalidTextData = "Png/InvalidTextData.png";
public const string David = "Png/david.png";
public const string TestPattern31x31 = "Png/testpattern31x31.png";
public const string TestPattern31x31HalfTransparent = "Png/testpattern31x31-halftransparent.png";
// Filtered test images from http://www.schaik.com/pngsuite/pngsuite_fil_png.html
public const string Filter0 = "Png/filter0.png";

3
tests/Images/Input/Png/testpattern31x31-halftransparent.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:415483fde21637bdf919244c0625665f4914f7678eb4e047507b9bcd2262ec50
size 472

3
tests/Images/Input/Png/testpattern31x31.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:233dc410d723204dfd63c296ee3ca165f4a3641475627eb82f5515f31d25afe5
size 484
Loading…
Cancel
Save