|
|
|
@ -7,6 +7,7 @@ using ImageSharp.Formats; |
|
|
|
|
|
|
|
namespace ImageSharp.Tests |
|
|
|
{ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
@ -17,6 +18,29 @@ namespace ImageSharp.Tests |
|
|
|
|
|
|
|
public class PngEncoderTests : FileTestBase |
|
|
|
{ |
|
|
|
private const PixelTypes PixelTypes = Tests.PixelTypes.StandardImageClass | Tests.PixelTypes.RgbaVector | Tests.PixelTypes.Argb32; |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithTestPatternImages(100, 100, PixelTypes, PngColorType.RgbWithAlpha)] |
|
|
|
[WithTestPatternImages(100, 100, PixelTypes, PngColorType.Rgb)] |
|
|
|
[WithTestPatternImages(100, 100, PixelTypes, PngColorType.Palette)] |
|
|
|
[WithTestPatternImages(100, 100, PixelTypes, PngColorType.Grayscale)] |
|
|
|
[WithTestPatternImages(100, 100, PixelTypes, PngColorType.GrayscaleWithAlpha)] |
|
|
|
public void EncodeGeneratedPatterns<TPixel>(TestImageProvider<TPixel> provider, PngColorType pngColorType) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
{ |
|
|
|
using (Image<TPixel> image = provider.GetImage()) |
|
|
|
{ |
|
|
|
PngEncoderOptions options = new PngEncoderOptions() |
|
|
|
{ |
|
|
|
PngColorType = pngColorType |
|
|
|
}; |
|
|
|
provider.Utility.TestName += "_" + pngColorType; |
|
|
|
|
|
|
|
provider.Utility.SaveTestOutputFile(image, "png", new PngEncoder(), options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithBlankImages(1, 1, PixelTypes.All)] |
|
|
|
public void WritesFileMarker<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
|