2020-05-12 21:28:50 +02:00
|
|
|
|
using FFMpegCore.Exceptions;
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2020-05-12 16:44:14 +02:00
|
|
|
|
|
|
|
|
|
namespace FFMpegCore.Test
|
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class PixelFormatTests
|
|
|
|
|
{
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_Enumerate()
|
|
|
|
|
{
|
2020-05-12 21:28:50 +02:00
|
|
|
|
var formats = FFMpeg.GetPixelFormats();
|
2020-05-12 16:44:14 +02:00
|
|
|
|
Assert.IsTrue(formats.Count > 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_TryGetExisting()
|
|
|
|
|
{
|
2020-05-12 21:28:50 +02:00
|
|
|
|
Assert.IsTrue(FFMpeg.TryGetPixelFormat("yuv420p", out _));
|
2020-05-12 16:44:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_TryGetNotExisting()
|
|
|
|
|
{
|
2020-05-12 21:28:50 +02:00
|
|
|
|
Assert.IsFalse(FFMpeg.TryGetPixelFormat("yuv420pppUnknown", out _));
|
2020-05-12 16:44:14 +02:00
|
|
|
|
}
|
2023-02-02 21:19:45 +01:00
|
|
|
|
|
2020-05-12 16:44:14 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
public void PixelFormats_GetExisting()
|
|
|
|
|
{
|
2020-05-12 21:28:50 +02:00
|
|
|
|
var fmt = FFMpeg.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:28:50 +02:00
|
|
|
|
Assert.ThrowsException<FFMpegException>(() => FFMpeg.GetPixelFormat("yuv420pppUnknown"));
|
2020-05-12 16:44:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|