mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
// <copyright file="BitmapTests.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
using ImageSharp.Formats;
|
|
|
|
namespace ImageSharp.Tests
|
|
{
|
|
using System.IO;
|
|
|
|
using Xunit;
|
|
|
|
public class BitmapTests : FileTestBase
|
|
{
|
|
public static readonly TheoryData<BmpBitsPerPixel> BitsPerPixel
|
|
= new TheoryData<BmpBitsPerPixel>
|
|
{
|
|
BmpBitsPerPixel.Pixel24 ,
|
|
BmpBitsPerPixel.Pixel32
|
|
};
|
|
|
|
[Theory]
|
|
[MemberData(nameof(BitsPerPixel))]
|
|
public void BitmapCanEncodeDifferentBitRates(BmpBitsPerPixel bitsPerPixel)
|
|
{
|
|
string path = this.CreateOutputDirectory("Bmp");
|
|
|
|
foreach (TestFile file in Files)
|
|
{
|
|
string filename = file.GetFileNameWithoutExtension(bitsPerPixel);
|
|
using (Image image = file.CreateImage())
|
|
{
|
|
using (FileStream output = File.OpenWrite($"{path}/{filename}.bmp"))
|
|
{
|
|
image.Save(output, new BmpEncoder { BitsPerPixel = bitsPerPixel });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|