2020-05-12 21:05:00 +02:00
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
using FFMpegCore.Models;
|
2020-05-12 16:44:14 +02:00
|
|
|
|
|
|
|
|
|
namespace FFMpegCore.Test
|
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class PixelFormatTests
|
|
|
|
|
{
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_Enumerate()
|
|
|
|
|
{
|
2020-05-12 21:05:00 +02:00
|
|
|
|
var formats = FFMpegUtils.GetPixelFormats();
|
2020-05-12 16:44:14 +02:00
|
|
|
|
Assert.IsTrue(formats.Count > 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_TryGetExisting()
|
|
|
|
|
{
|
2020-05-12 21:05:00 +02:00
|
|
|
|
Assert.IsTrue(FFMpegUtils.TryGetPixelFormat("yuv420p", out _));
|
2020-05-12 16:44:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_TryGetNotExisting()
|
|
|
|
|
{
|
2020-05-12 21:05:00 +02:00
|
|
|
|
Assert.IsFalse(FFMpegUtils.TryGetPixelFormat("yuv420pppUnknown", out _));
|
2020-05-12 16:44:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_GetExisting()
|
|
|
|
|
{
|
2020-05-12 21:05:00 +02:00
|
|
|
|
var fmt = FFMpegUtils.GetPixelFormat("yuv420p");
|
2020-05-12 16:44:14 +02:00
|
|
|
|
Assert.IsTrue(fmt.Components == 3 && fmt.BitsPerPixel == 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_GetNotExisting()
|
|
|
|
|
{
|
2020-05-12 21:05:00 +02:00
|
|
|
|
Assert.ThrowsException<FFMpegException>(() => FFMpegUtils.GetPixelFormat("yuv420pppUnknown"));
|
2020-05-12 16:44:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|