using NUnit.Framework;
using System;
+using System.Collections;
+using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
+using System.Linq;
namespace Tizen.Multimedia.MediaCodec.Tests
{
Assert.DoesNotThrow(() => new MediaCodec());
}
+ [Test]
+ [Category("P1")]
+ [Description("Configure throws nothing with various audio/video mimetype")]
+ [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.Configure M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+ public void Configure_CHECK_THROW_NOTHING()
+ {
+ int[] supportedBit = { 16, 32 };
+
+ foreach (MediaFormatAudioMimeType mimetype in Enum.GetValues(typeof(MediaFormatAudioMimeType)))
+ {
+ Log.Info("Tizen.MediaCodec.Tests", mimetype.ToString());
+
+ if (MediaCodec.SupportedAudioCodecs.Contains(mimetype))
+ {
+ foreach (var bit in supportedBit)
+ {
+ Log.Info("Tizen.MediaCodec.Tests",
+ $"{mimetype.ToString()} is supported, test with {bit.ToString()}");
+
+ try
+ {
+ var audioMediaFormat = new AudioMediaFormat(mimetype, 1, 8000, bit, 128);
+ _codec.Configure(audioMediaFormat, false, MediaCodecTypes.Software);
+ break;
+ }
+ catch (ArgumentException)
+ {
+ Log.Info("Tizen.MediaCodec.Tests", "Not supported bit. Try to set another bit.");
+ continue;
+ }
+ catch (Exception)
+ {
+ Assert.Fail("Method should not throw exception.");
+ }
+ }
+ }
+ }
+
+ foreach (MediaFormatVideoMimeType mimetype in Enum.GetValues(typeof(MediaFormatVideoMimeType)))
+ {
+ if (MediaCodec.SupportedVideoCodecs.Contains(mimetype))
+ {
+ Log.Info("Tizen.MediaCodec.Tests", $"{mimetype.ToString()} is supported.");
+ var videoMediaFormat = new VideoMediaFormat(mimetype, 352, 288, 30, 128);
+ Assert.DoesNotThrow(() => _codec.Configure(videoMediaFormat, false, MediaCodecTypes.Software));
+ }
+ }
+ }
+
[Test]
[Category("P2")]
[Description("Configure throws if the specified format is null")]